grumblr 2.3.4 → 2.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +5 -1
- data/README +1 -1
- data/VERSION +1 -1
- data/data/pixmaps/blog info.bmp +0 -0
- data/data/pixmaps/blog.bmp +0 -0
- data/data/pixmaps/twitter.bmp +0 -0
- data/lib/grumblr/ui.rb +140 -116
- data/lib/ppds/debug.rb +1 -1
- data/lib/ppds/tumblr.rb +12 -1
- metadata +17 -14
data/Changelog
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
+
version 2.3.5 (2011-02-07)
|
2
|
+
* Added Twitter button.
|
3
|
+
* Refactor code.
|
4
|
+
|
1
5
|
version 2.3.4 (2011-01-25)
|
2
6
|
* Display a default Tumblr avatar for blogs that don't have any.
|
3
7
|
|
4
8
|
version 2.3.3 (2010-12-02)
|
5
9
|
* Added avatar icons to blog selector.
|
6
|
-
* Added setup script
|
10
|
+
* Added setup script.
|
7
11
|
* Changed system tray to use theme icon if exists.
|
8
12
|
|
9
13
|
version 2.3.2 (2010-12-02)
|
data/README
CHANGED
@@ -33,7 +33,7 @@ from a GTK-enabled Linux desktop environment.
|
|
33
33
|
Change directory to the installed gem folder (may vary) and run
|
34
34
|
setup script to copy images and a launcher to their places:
|
35
35
|
|
36
|
-
$ cd /usr/lib/ruby/gems/1.8
|
36
|
+
$ cd /usr/lib/ruby/gems/1.8/gems/grumblr-2.3.5
|
37
37
|
$ sudo ruby setup.rb
|
38
38
|
|
39
39
|
=== Homepage ===
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.5
|
Binary file
|
Binary file
|
Binary file
|
data/lib/grumblr/ui.rb
CHANGED
@@ -20,7 +20,7 @@ module Grumblr
|
|
20
20
|
filename = File.join(Grumblr::DATA_ROOT, 'pixmaps', 'grumblr.svg')
|
21
21
|
self.logo = Gdk::Pixbuf.new(filename, 128, 128)
|
22
22
|
|
23
|
-
set_size_request
|
23
|
+
set_size_request 400, 300
|
24
24
|
set_border_width 0
|
25
25
|
set_allow_shrink false
|
26
26
|
set_title "#{Grumblr::APP_NAME} #{Grumblr::VERSION}"
|
@@ -56,39 +56,40 @@ module Grumblr
|
|
56
56
|
|
57
57
|
class Dashboard < Gtk::VBox
|
58
58
|
def initialize
|
59
|
-
super false,
|
59
|
+
super false, 0
|
60
60
|
|
61
61
|
### Statusbar
|
62
62
|
$statusbar = Gtk::Statusbar.new
|
63
|
-
|
63
|
+
$statusbar.set_border_width 2
|
64
|
+
|
64
65
|
### Notebook
|
65
66
|
@notebook = Gtk::Notebook.new
|
67
|
+
@notebook.set_border_width 0
|
66
68
|
@notebook.set_homogeneous true
|
67
69
|
@notebook.set_tab_pos Gtk::POS_LEFT
|
68
70
|
|
69
71
|
# Text page
|
70
|
-
@text_title = Gtk::LabeledEntry.new
|
71
|
-
|
72
|
-
@text_body = Gtk::LabeledTextView.new 'Body'
|
72
|
+
@text_title = Gtk::LabeledEntry.new('Title (optional)')
|
73
|
+
@text_body = Gtk::LabeledTextView.new('Body')
|
73
74
|
|
74
|
-
page = Gtk::VBox.new
|
75
|
-
page.set_border_width
|
75
|
+
page = Gtk::VBox.new(false, 4)
|
76
|
+
page.set_border_width 4
|
76
77
|
page.pack_start @text_title, false
|
77
78
|
page.pack_start scrollable(@text_body), true
|
78
79
|
|
79
80
|
@notebook.add_page_with_tab page, 'Text'
|
80
81
|
|
81
82
|
# Link page
|
82
|
-
@link_url = Gtk::LabeledEntry.new
|
83
|
-
@link_name = Gtk::LabeledEntry.new
|
84
|
-
@link_description = Gtk::LabeledTextView.new
|
83
|
+
@link_url = Gtk::LabeledEntry.new('URL')
|
84
|
+
@link_name = Gtk::LabeledEntry.new('Name (optional)')
|
85
|
+
@link_description = Gtk::LabeledTextView.new('Description (optional)')
|
85
86
|
scroll = Gtk::ScrolledWindow.new
|
86
87
|
scroll.set_shadow_type Gtk::SHADOW_IN
|
87
88
|
scroll.set_policy Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC
|
88
89
|
scroll.add @link_description
|
89
90
|
|
90
|
-
page = Gtk::VBox.new
|
91
|
-
page.set_border_width
|
91
|
+
page = Gtk::VBox.new(false, 4)
|
92
|
+
page.set_border_width 4
|
92
93
|
page.pack_start @link_url, false
|
93
94
|
page.pack_start @link_name, false
|
94
95
|
page.pack_start scroll, true
|
@@ -96,22 +97,22 @@ module Grumblr
|
|
96
97
|
@notebook.add_page_with_tab page, 'Link'
|
97
98
|
|
98
99
|
# Chat page
|
99
|
-
@chat_title = Gtk::LabeledEntry.new
|
100
|
-
@chat_conversation = Gtk::LabeledTextView.new
|
100
|
+
@chat_title = Gtk::LabeledEntry.new('Title (optional)')
|
101
|
+
@chat_conversation = Gtk::LabeledTextView.new('Conversation')
|
101
102
|
|
102
|
-
page = Gtk::VBox.new
|
103
|
-
page.set_border_width
|
103
|
+
page = Gtk::VBox.new(false, 4)
|
104
|
+
page.set_border_width 4
|
104
105
|
page.pack_start @chat_title, false
|
105
106
|
page.pack_start scrollable(@chat_conversation), true
|
106
107
|
|
107
108
|
@notebook.add_page_with_tab page, 'Chat'
|
108
109
|
|
109
110
|
# Quote page
|
110
|
-
@quote_source = Gtk::LabeledEntry.new
|
111
|
-
@quote_quote = Gtk::LabeledTextView.new
|
111
|
+
@quote_source = Gtk::LabeledEntry.new('Source (optional)')
|
112
|
+
@quote_quote = Gtk::LabeledTextView.new('Quote')
|
112
113
|
|
113
|
-
page = Gtk::VBox.new
|
114
|
-
page.set_border_width
|
114
|
+
page = Gtk::VBox.new(false, 4)
|
115
|
+
page.set_border_width 4
|
115
116
|
page.pack_start scrollable(@quote_quote), true
|
116
117
|
page.pack_start @quote_source, false
|
117
118
|
|
@@ -122,13 +123,13 @@ module Grumblr
|
|
122
123
|
filter.set_name "Images"
|
123
124
|
filter.add_mime_type "image/*"
|
124
125
|
|
125
|
-
photo_data = file_chooser_button
|
126
|
-
@photo_source = Gtk::LabeledEntry.new
|
127
|
-
@photo_click_through_url = Gtk::LabeledEntry.new
|
128
|
-
@photo_caption = Gtk::LabeledTextView.new
|
126
|
+
photo_data = file_chooser_button(:photo_data, filter)
|
127
|
+
@photo_source = Gtk::LabeledEntry.new('Source')
|
128
|
+
@photo_click_through_url = Gtk::LabeledEntry.new('Link (optional)')
|
129
|
+
@photo_caption = Gtk::LabeledTextView.new('Caption')
|
129
130
|
|
130
|
-
page = Gtk::VBox.new
|
131
|
-
page.set_border_width
|
131
|
+
page = Gtk::VBox.new(false, 4)
|
132
|
+
page.set_border_width 4
|
132
133
|
page.pack_start photo_data, false
|
133
134
|
page.pack_start @photo_source, false
|
134
135
|
page.pack_start scrollable(@photo_caption), true
|
@@ -142,12 +143,12 @@ module Grumblr
|
|
142
143
|
filter.set_name "Audio"
|
143
144
|
filter.add_mime_type "audio/*"
|
144
145
|
|
145
|
-
audio_data = file_chooser_button
|
146
|
-
@audio_externally_hosted_url = Gtk::LabeledEntry.new
|
147
|
-
@audio_caption = Gtk::LabeledTextView.new
|
146
|
+
audio_data = file_chooser_button(:audio_data, filter)
|
147
|
+
@audio_externally_hosted_url = Gtk::LabeledEntry.new('Externally Hosted MP3 URL')
|
148
|
+
@audio_caption = Gtk::LabeledTextView.new('Caption (optional)')
|
148
149
|
|
149
|
-
page = Gtk::VBox.new
|
150
|
-
page.set_border_width
|
150
|
+
page = Gtk::VBox.new(false, 4)
|
151
|
+
page.set_border_width 4
|
151
152
|
page.pack_start audio_data, false
|
152
153
|
page.pack_start @audio_externally_hosted_url, false
|
153
154
|
page.pack_start scrollable(@audio_caption), true
|
@@ -156,19 +157,19 @@ module Grumblr
|
|
156
157
|
end
|
157
158
|
|
158
159
|
# Video page
|
159
|
-
@video_embed = Gtk::LabeledEntry.new
|
160
|
-
@video_caption = Gtk::LabeledTextView.new
|
160
|
+
@video_embed = Gtk::LabeledEntry.new('Embed code / YouTube link')
|
161
|
+
@video_caption = Gtk::LabeledTextView.new('Caption (optional)')
|
161
162
|
|
162
|
-
page = Gtk::VBox.new
|
163
|
-
page.set_border_width
|
163
|
+
page = Gtk::VBox.new(false, 4)
|
164
|
+
page.set_border_width 4
|
164
165
|
|
165
166
|
if $api.user.can_upload_video == '1'
|
166
167
|
filter = Gtk::FileFilter.new
|
167
168
|
filter.set_name "Video"
|
168
169
|
filter.add_mime_type "video/*"
|
169
170
|
|
170
|
-
video_data = file_chooser_button
|
171
|
-
@video_title = Gtk::LabeledEntry.new
|
171
|
+
video_data = file_chooser_button(:video_data, filter)
|
172
|
+
@video_title = Gtk::LabeledEntry.new('Title (optional)')
|
172
173
|
|
173
174
|
page.pack_start video_data, false
|
174
175
|
page.pack_start @video_title, false
|
@@ -179,6 +180,51 @@ module Grumblr
|
|
179
180
|
|
180
181
|
@notebook.add_page_with_tab page, 'Video'
|
181
182
|
|
183
|
+
if DEBUG
|
184
|
+
# Blog info page
|
185
|
+
page = Gtk::VBox.new(false, 4)
|
186
|
+
page.set_border_width 4
|
187
|
+
@blog_info = Gtk::LabeledTextView.new('')
|
188
|
+
page.pack_start scrollable(@blog_info), true
|
189
|
+
@notebook.add_page_with_tab page, 'Blog'
|
190
|
+
end
|
191
|
+
|
192
|
+
### Buttons
|
193
|
+
@private_button = Gtk::ToggleButton.new('Private')
|
194
|
+
@private_button.signal_connect(:toggled) do |widget|
|
195
|
+
$cfg.set :private, widget.active?
|
196
|
+
end
|
197
|
+
@private_button.set_active $cfg.get(:private)
|
198
|
+
|
199
|
+
@twitter_button = Gtk::ToggleButton.new('Twitter')
|
200
|
+
@twitter_button.signal_connect(:toggled) do |widget|
|
201
|
+
$cfg.set :twitter, widget.active?
|
202
|
+
end
|
203
|
+
#@twitter_button.set_active $cfg.get(:twitter)
|
204
|
+
|
205
|
+
@tags = Gtk::LabeledEntry.new('space/comma separated tags')
|
206
|
+
|
207
|
+
@format_button = Gtk::ToggleButton.new('Markdown')
|
208
|
+
@format_button.signal_connect(:toggled) do |widget|
|
209
|
+
$cfg.set :format_markdown, widget.active?
|
210
|
+
end
|
211
|
+
@format_button.set_active $cfg.get(:format_markdown)
|
212
|
+
|
213
|
+
@submit_button = Gtk::Button.new('Send')
|
214
|
+
@submit_button.signal_connect(:released) do |widget|
|
215
|
+
post
|
216
|
+
end
|
217
|
+
|
218
|
+
button_box = Gtk::HBox.new(false, 4)
|
219
|
+
button_box.set_border_width 4
|
220
|
+
# button_box.pack_start @clear_button, false
|
221
|
+
button_box.pack_start @private_button, false
|
222
|
+
button_box.pack_start @twitter_button, false
|
223
|
+
button_box.pack_start @tags, true
|
224
|
+
button_box.pack_start @format_button, false
|
225
|
+
button_box.pack_start @submit_button, false
|
226
|
+
|
227
|
+
|
182
228
|
### Toolbar
|
183
229
|
toolbar = Gtk::Toolbar.new
|
184
230
|
toolbar.icon_size = Gtk::IconSize::MENU
|
@@ -224,57 +270,32 @@ module Grumblr
|
|
224
270
|
$app.blog = $api.blogs[widget.active]
|
225
271
|
$cfg.set :active_blog, $app.blog.name
|
226
272
|
$statusbar.push 0, $app.blog.title
|
273
|
+
@blog_info.text = $app.blog.pretty_inspect if DEBUG
|
274
|
+
@twitter_button.set_active $app.blog.twitter_enabled == "1" ? true : false
|
227
275
|
end
|
228
276
|
combo.set_active(active_blog_idx)
|
229
|
-
item =
|
277
|
+
item = Gtk::ToolItem.new
|
230
278
|
item.set_expand true
|
231
279
|
item.add combo
|
232
280
|
toolbar.insert 2, item
|
233
281
|
|
234
|
-
icon = Gtk::Image.new
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
282
|
+
icon = Gtk::Image.new(Gtk::Stock::CLEAR, Gtk::IconSize::MENU)
|
283
|
+
@clear_button = Gtk::ToolButton.new(icon, 'Clear')
|
284
|
+
@clear_button.signal_connect(:clicked) do |widget|
|
285
|
+
page = @notebook.get_nth_page(@notebook.page)
|
286
|
+
message_type = @notebook.get_menu_label_text(page)
|
287
|
+
reset_form message_type.downcase unless message_type == 'Blog'
|
239
288
|
end
|
240
|
-
toolbar.insert 3,
|
289
|
+
toolbar.insert 3, @clear_button
|
241
290
|
|
242
|
-
### Buttons
|
243
|
-
clear_button = Gtk::Button.new ' Clear '
|
244
|
-
clear_button.set_focus_on_click false
|
245
|
-
clear_button.signal_connect(:clicked) do |widget|
|
246
|
-
page = @notebook.get_nth_page @notebook.page
|
247
|
-
message_type = @notebook.get_menu_label_text page
|
248
|
-
reset_form message_type.downcase
|
249
|
-
end
|
250
|
-
|
251
|
-
@private_button = Gtk::ToggleButton.new ' Private '
|
252
|
-
@private_button.signal_connect(:toggled) do |widget|
|
253
|
-
$cfg.set :private, widget.active?
|
254
|
-
end
|
255
|
-
@private_button.set_active $cfg.get(:private)
|
256
291
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
@tags = Gtk::LabeledEntry.new 'space/comma separated tags'
|
263
|
-
|
264
|
-
@format = Gtk::CheckButton.new '_markdown'
|
265
|
-
@format.set_active $cfg.get(:format_markdown)
|
266
|
-
@format.signal_connect(:toggled) do |widget|
|
267
|
-
$cfg.set :format_markdown, widget.active?
|
292
|
+
icon = Gtk::Image.new(Gtk::Stock::QUIT, Gtk::IconSize::MENU)
|
293
|
+
item = Gtk::ToolButton.new(icon, 'Quit')
|
294
|
+
item.set_homogeneous false
|
295
|
+
item.signal_connect(:clicked) do
|
296
|
+
$app.quit
|
268
297
|
end
|
269
|
-
|
270
|
-
format_box.pack_start @format, false
|
271
|
-
|
272
|
-
button_box = Gtk::HBox.new false, 4
|
273
|
-
button_box.pack_start clear_button, false
|
274
|
-
button_box.pack_start @private_button, false
|
275
|
-
button_box.pack_start @tags, true
|
276
|
-
button_box.pack_start format_box, false
|
277
|
-
button_box.pack_start submit_button, false
|
298
|
+
toolbar.insert 4, item
|
278
299
|
|
279
300
|
### Layout
|
280
301
|
pack_start toolbar, false
|
@@ -289,49 +310,52 @@ module Grumblr
|
|
289
310
|
page = @notebook.get_nth_page @notebook.page
|
290
311
|
message_type = @notebook.get_menu_label_text(page).downcase
|
291
312
|
|
292
|
-
mandatory_data = collect_data_for
|
293
|
-
concurent_data = collect_data_for
|
294
|
-
optional_data = collect_data_for
|
313
|
+
mandatory_data = collect_data_for(Ppds::Tumblr::MANDATORY_FIELDS, message_type)
|
314
|
+
concurent_data = collect_data_for(Ppds::Tumblr::CONCURENT_FIELDS, message_type)
|
315
|
+
optional_data = collect_data_for(Ppds::Tumblr::OPTIONAL_FIELDS, message_type)
|
295
316
|
|
296
317
|
mandatory_data.each do |key, value|
|
297
318
|
raise "Mandatory field %s is not set!" % key if not value or value.empty?
|
298
319
|
end unless Ppds::Tumblr::MANDATORY_FIELDS[message_type].empty?
|
299
320
|
|
300
321
|
unless Ppds::Tumblr::CONCURENT_FIELDS[message_type].empty?
|
301
|
-
concurent_data.delete_if { |x,y| y ==
|
322
|
+
concurent_data.delete_if { |x,y| y == '' or y.nil? }
|
302
323
|
raise "None of fields %s is set!" % Ppds::Tumblr::CONCURENT_FIELDS[message_type].join(", ") if concurent_data.empty?
|
303
324
|
end
|
304
325
|
|
305
|
-
optional_data.delete_if { |x,y| y ==
|
326
|
+
optional_data.delete_if { |x,y| y == '' or y.nil? }
|
306
327
|
|
307
328
|
tags = @tags.get_value.gsub(/\s+/,',').split(',').uniq.sort - ['']
|
308
329
|
|
309
330
|
data = {
|
310
331
|
:email => $cfg.get(:email),
|
311
332
|
:password => $cfg.get(:password),
|
312
|
-
:channel_id => $app.blog.name,
|
313
333
|
:type => message_type,
|
314
334
|
:generator => "#{Grumblr::APP_NAME} #{Grumblr::VERSION}",
|
335
|
+
#:date => '2010-12-01 14:50:02',
|
315
336
|
:private => @private_button.active? ? 1 : 0,
|
316
337
|
:tags => tags.join(','),
|
317
|
-
:format => @
|
338
|
+
:format => @format_button.active? ? 'markdown' : 'html',
|
318
339
|
:group => $app.blog.name + '.tumblr.com',
|
319
|
-
#:slug => ,
|
320
|
-
#:state => , # published, draft, submission, queue
|
321
|
-
|
322
|
-
|
340
|
+
#:slug => '',
|
341
|
+
#:state => @state, # published, draft, submission, queue
|
342
|
+
:channel_id => $app.blog.name,
|
343
|
+
:send_to_twitter => @twitter_button.active? ? 'auto' : 'no'
|
323
344
|
}
|
324
345
|
|
346
|
+
# datetime format: 2010-01-01T13:34:00
|
347
|
+
# data.merge!({:publish_on => @publish_on}) if @state == 'queue'
|
348
|
+
|
325
349
|
data.merge! mandatory_data
|
326
350
|
data.merge! concurent_data
|
327
351
|
data.merge! optional_data
|
328
352
|
|
329
|
-
data.update({:data => File.read(data['data'])}) if data.has_key?('data') and data['data'] !=
|
353
|
+
data.update({:data => File.read(data['data'])}) if data.has_key?('data') and data['data'] != ''
|
330
354
|
|
331
355
|
dump(data) if DEBUG
|
332
356
|
|
333
357
|
$api.query 'write', data
|
334
|
-
MessageDialog.new
|
358
|
+
MessageDialog.new("Message posted", Gtk::Stock::DIALOG_INFO)
|
335
359
|
reset_form message_type
|
336
360
|
rescue Exception
|
337
361
|
MessageDialog.new $!
|
@@ -340,12 +364,8 @@ module Grumblr
|
|
340
364
|
def collect_data_for(fieldset, message_type)
|
341
365
|
data = {}
|
342
366
|
fieldset[message_type].each do |key|
|
343
|
-
|
344
|
-
var
|
345
|
-
if var
|
346
|
-
value = var.get_value
|
347
|
-
data.merge!({ key => value })
|
348
|
-
end
|
367
|
+
var = instance_variable_get("@#{message_type}_#{key.gsub(/-/,'_')}")
|
368
|
+
data.merge!({ key.to_sym => var.get_value }) if var
|
349
369
|
end
|
350
370
|
data
|
351
371
|
end
|
@@ -365,8 +385,7 @@ module Grumblr
|
|
365
385
|
|
366
386
|
def reset_fields_for(fieldset, message_type)
|
367
387
|
fieldset[message_type].each do |key|
|
368
|
-
|
369
|
-
var = instance_variable_get(name)
|
388
|
+
var = instance_variable_get("@#{message_type}_#{key.gsub(/-/,'_')}")
|
370
389
|
var.clear if var
|
371
390
|
end
|
372
391
|
end
|
@@ -404,15 +423,15 @@ module Grumblr
|
|
404
423
|
def initialize(text, stock = Gtk::Stock::DIALOG_ERROR)
|
405
424
|
super "Attention!", $gui, Gtk::Dialog::MODAL
|
406
425
|
|
407
|
-
message = Gtk::Label.new
|
408
|
-
icon = Gtk::Image.new
|
426
|
+
message = Gtk::Label.new(text)
|
427
|
+
icon = Gtk::Image.new(stock, Gtk::IconSize::DIALOG)
|
409
428
|
|
410
|
-
hbox = Gtk::HBox.new
|
429
|
+
hbox = Gtk::HBox.new(false, 20)
|
411
430
|
hbox.set_border_width 20
|
412
431
|
hbox.pack_start icon, false
|
413
432
|
hbox.pack_start message, true
|
414
433
|
|
415
|
-
self.add_button
|
434
|
+
self.add_button(Gtk::Stock::OK, Gtk::Dialog::RESPONSE_NONE)
|
416
435
|
self.signal_connect(:response) { self.destroy }
|
417
436
|
self.vbox.add hbox
|
418
437
|
self.show_all
|
@@ -437,11 +456,11 @@ module Grumblr
|
|
437
456
|
|
438
457
|
hbox = Gtk::HBox.new
|
439
458
|
|
440
|
-
button = Gtk::Button.new
|
459
|
+
button = Gtk::Button.new('Cancel')
|
441
460
|
button.signal_connect(:released) { $app.quit }
|
442
461
|
hbox.pack_start button
|
443
462
|
|
444
|
-
button = Gtk::Button.new
|
463
|
+
button = Gtk::Button.new('Sign in')
|
445
464
|
button.signal_connect(:released) { login }
|
446
465
|
hbox.pack_start button
|
447
466
|
|
@@ -449,14 +468,14 @@ module Grumblr
|
|
449
468
|
header.set_alignment 0.0, 0.8
|
450
469
|
header.set_markup '<big><big><b>Grumblr 2</b></big></big>'
|
451
470
|
|
452
|
-
vbox = Gtk::VBox.new
|
471
|
+
vbox = Gtk::VBox.new(false, 4)
|
453
472
|
vbox.pack_start header
|
454
473
|
vbox.pack_with_label '_Email', @text_e
|
455
474
|
vbox.pack_with_label '_Password', @text_p
|
456
475
|
vbox.pack_start @label
|
457
476
|
vbox.pack_start hbox, false
|
458
477
|
|
459
|
-
logo = Gtk::Image.new
|
478
|
+
logo = Gtk::Image.new($gui.logo)
|
460
479
|
|
461
480
|
self.pack_start logo
|
462
481
|
self.pack_start vbox
|
@@ -535,7 +554,7 @@ module Grumblr
|
|
535
554
|
|
536
555
|
## Destroy Config
|
537
556
|
def destroy_account
|
538
|
-
icon = Gtk::ImageMenuItem.new
|
557
|
+
icon = Gtk::ImageMenuItem.new('Forget password')
|
539
558
|
icon.set_image Gtk::Image.new(Gtk::Stock::STOP, Gtk::IconSize::MENU)
|
540
559
|
icon.signal_connect(:activate) do
|
541
560
|
$cfg.destroy
|
@@ -544,7 +563,7 @@ module Grumblr
|
|
544
563
|
end
|
545
564
|
|
546
565
|
def about
|
547
|
-
icon = Gtk::ImageMenuItem.new
|
566
|
+
icon = Gtk::ImageMenuItem.new(Gtk::Stock::ABOUT)
|
548
567
|
icon.signal_connect(:activate) do
|
549
568
|
AboutDialog.new
|
550
569
|
end
|
@@ -552,7 +571,7 @@ module Grumblr
|
|
552
571
|
end
|
553
572
|
|
554
573
|
def ontop
|
555
|
-
icon = Gtk::CheckMenuItem.new
|
574
|
+
icon = Gtk::CheckMenuItem.new('Always on top')
|
556
575
|
icon.signal_connect(:toggled) do |widget|
|
557
576
|
$gui.keep_above = widget.active?
|
558
577
|
end
|
@@ -560,7 +579,7 @@ module Grumblr
|
|
560
579
|
end
|
561
580
|
|
562
581
|
def quit
|
563
|
-
icon = Gtk::ImageMenuItem.new
|
582
|
+
icon = Gtk::ImageMenuItem.new(Gtk::Stock::QUIT)
|
564
583
|
icon.signal_connect(:activate) do
|
565
584
|
$app.quit
|
566
585
|
end
|
@@ -577,7 +596,7 @@ module Gtk
|
|
577
596
|
|
578
597
|
class Box
|
579
598
|
def pack_with_label(text, widget, expand = false)
|
580
|
-
label = Gtk::Label.new
|
599
|
+
label = Gtk::Label.new(text, true)
|
581
600
|
label.set_alignment 0.0, 0.5
|
582
601
|
label.set_mnemonic_widget widget
|
583
602
|
self.pack_start label, false
|
@@ -610,14 +629,14 @@ module Gtk
|
|
610
629
|
class Notebook
|
611
630
|
def add_page_with_tab(page, text)
|
612
631
|
filename = File.join(Grumblr::DATA_ROOT, 'pixmaps', '%s.bmp' % text.downcase)
|
613
|
-
icon = Gtk::Image.new
|
632
|
+
icon = Gtk::Image.new(filename)
|
614
633
|
icon.set_padding 4, 0
|
615
634
|
|
616
|
-
label = Gtk::Label.new
|
635
|
+
label = Gtk::Label.new('_' + text, true)
|
617
636
|
label.set_alignment 0.0, 0.5
|
618
637
|
label.set_padding 2, 2
|
619
638
|
|
620
|
-
box = Gtk::HBox.new
|
639
|
+
box = Gtk::HBox.new(false, 2)
|
621
640
|
box.pack_start icon, false
|
622
641
|
box.pack_start label, true
|
623
642
|
box.show_all
|
@@ -630,6 +649,10 @@ module Gtk
|
|
630
649
|
def get_value
|
631
650
|
self.buffer.get_text
|
632
651
|
end
|
652
|
+
|
653
|
+
def text=(text)
|
654
|
+
self.buffer.set_text(text)
|
655
|
+
end
|
633
656
|
end
|
634
657
|
|
635
658
|
class LabeledEntry < Entry
|
@@ -712,3 +735,4 @@ module Gtk
|
|
712
735
|
end
|
713
736
|
|
714
737
|
end
|
738
|
+
|
data/lib/ppds/debug.rb
CHANGED
data/lib/ppds/tumblr.rb
CHANGED
@@ -80,7 +80,7 @@ module Ppds
|
|
80
80
|
|
81
81
|
def query(action, data)
|
82
82
|
raise 'Cannot authenticate without credentials' unless data[:email] and data[:password]
|
83
|
-
response = RestClient.post(API_URL + action, data)
|
83
|
+
response = RestClient.post(API_URL + action, data.stringify_keys!)
|
84
84
|
dump(response) if DEBUG
|
85
85
|
response.to_str
|
86
86
|
rescue RestClient::RequestFailed => e
|
@@ -112,3 +112,14 @@ module Ppds
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
115
|
+
|
116
|
+
class Hash
|
117
|
+
# taken from Ruby on Rails
|
118
|
+
# modified to replace undercores with dashes
|
119
|
+
def stringify_keys!
|
120
|
+
keys.each do |key|
|
121
|
+
self[key.to_s.gsub(/_/, '-')] = delete(key)
|
122
|
+
end
|
123
|
+
self
|
124
|
+
end
|
125
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grumblr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 9
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 2.3.
|
9
|
+
- 5
|
10
|
+
version: 2.3.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Paul Philippov
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-02-07 00:00:00 +06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -75,21 +75,24 @@ extra_rdoc_files:
|
|
75
75
|
- Changelog
|
76
76
|
files:
|
77
77
|
- bin/grumblr
|
78
|
-
- data/grumblr.desktop
|
79
|
-
- data/pixmaps/grumblr.svg
|
80
|
-
- data/pixmaps/video.bmp
|
81
78
|
- data/pixmaps/photo.bmp
|
82
79
|
- data/pixmaps/text.bmp
|
83
80
|
- data/pixmaps/spinner.gif
|
84
|
-
- data/pixmaps/link.bmp
|
85
81
|
- data/pixmaps/grumblr.png
|
86
|
-
- data/pixmaps/audio.bmp
|
87
|
-
- data/pixmaps/chat.bmp
|
88
82
|
- data/pixmaps/quote.bmp
|
89
|
-
-
|
90
|
-
-
|
83
|
+
- data/pixmaps/grumblr.svg
|
84
|
+
- data/pixmaps/blog info.bmp
|
85
|
+
- data/pixmaps/twitter.bmp
|
86
|
+
- data/pixmaps/blog.bmp
|
87
|
+
- data/pixmaps/chat.bmp
|
88
|
+
- data/pixmaps/link.bmp
|
89
|
+
- data/pixmaps/audio.bmp
|
90
|
+
- data/pixmaps/video.bmp
|
91
|
+
- data/grumblr.desktop
|
91
92
|
- lib/ppds/tumblr.rb
|
92
93
|
- lib/ppds/debug.rb
|
94
|
+
- lib/grumblr/core.rb
|
95
|
+
- lib/grumblr/ui.rb
|
93
96
|
- LICENSE
|
94
97
|
- README
|
95
98
|
- VERSION
|
@@ -126,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
129
|
requirements: []
|
127
130
|
|
128
131
|
rubyforge_project: grumblr
|
129
|
-
rubygems_version: 1.
|
132
|
+
rubygems_version: 1.5.0
|
130
133
|
signing_key:
|
131
134
|
specification_version: 3
|
132
135
|
summary: a Tumblr companion
|