grumblr 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/grumblr/ui.rb +31 -42
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.0
1
+ 2.1.1
@@ -16,7 +16,8 @@ module Grumblr
16
16
  filename = File.join(Grumblr::DATA_ROOT, 'pixmaps', 'grumblr.svg')
17
17
  self.logo = Gdk::Pixbuf.new(filename, 128, 128)
18
18
 
19
- set_size_request 440, 320
19
+ set_size_request 440, 340
20
+ set_border_width 4
20
21
  set_allow_shrink false
21
22
  set_title 'Grumblr'
22
23
  set_icon self.logo
@@ -51,21 +52,15 @@ module Grumblr
51
52
  def initialize
52
53
  super false, 4
53
54
 
54
- ##
55
55
  ### Statusbar
56
- ##
57
- @statusbar = Gtk::Statusbar.new
56
+ $statusbar = Gtk::Statusbar.new
58
57
 
59
- ##
60
58
  ### Notebook
61
- ##
62
59
  @notebook = Gtk::Notebook.new
63
60
  @notebook.set_homogeneous true
64
61
  @notebook.set_tab_pos Gtk::POS_LEFT
65
62
 
66
- #
67
63
  # Text page
68
- #
69
64
  @text_title = Gtk::LabeledEntry.new 'Title (optional)'
70
65
 
71
66
  @text_body = Gtk::LabeledTextView.new 'Body'
@@ -77,9 +72,7 @@ module Grumblr
77
72
 
78
73
  @notebook.add_page_with_tab page, 'Text'
79
74
 
80
- #
81
75
  # Link page
82
- #
83
76
  @link_url = Gtk::LabeledEntry.new 'URL'
84
77
  @link_name = Gtk::LabeledEntry.new 'Name (optional)'
85
78
  @link_description = Gtk::LabeledTextView.new 'Description (optional)'
@@ -96,9 +89,7 @@ module Grumblr
96
89
 
97
90
  @notebook.add_page_with_tab page, 'Link'
98
91
 
99
- #
100
92
  # Chat page
101
- #
102
93
  @chat_title = Gtk::LabeledEntry.new 'Title (optional)'
103
94
  @chat_conversation = Gtk::LabeledTextView.new 'Conversation'
104
95
 
@@ -109,9 +100,7 @@ module Grumblr
109
100
 
110
101
  @notebook.add_page_with_tab page, 'Chat'
111
102
 
112
- #
113
103
  # Quote page
114
- #
115
104
  @quote_source = Gtk::LabeledEntry.new 'Source (optional)'
116
105
  @quote_quote = Gtk::LabeledTextView.new 'Quote'
117
106
 
@@ -122,9 +111,7 @@ module Grumblr
122
111
 
123
112
  @notebook.add_page_with_tab page, 'Quote'
124
113
 
125
- #
126
114
  # Photo page
127
- #
128
115
  filter = Gtk::FileFilter.new
129
116
  filter.set_name "Images"
130
117
  filter.add_mime_type "image/*"
@@ -143,9 +130,7 @@ module Grumblr
143
130
 
144
131
  @notebook.add_page_with_tab page, 'Photo'
145
132
 
146
- #
147
133
  # Audio page
148
- #
149
134
  if $api.user.can_upload_audio == '1'
150
135
  filter = Gtk::FileFilter.new
151
136
  filter.set_name "Audio"
@@ -162,9 +147,7 @@ module Grumblr
162
147
  @notebook.add_page_with_tab page, 'Audio'
163
148
  end
164
149
 
165
- #
166
150
  # Video page
167
- #
168
151
  @video_embed = Gtk::LabeledEntry.new 'Embed code / YouTube link'
169
152
  @video_caption = Gtk::LabeledTextView.new 'Caption (optional)'
170
153
 
@@ -188,10 +171,7 @@ module Grumblr
188
171
 
189
172
  @notebook.add_page_with_tab page, 'Video'
190
173
 
191
- ##
192
174
  ### Toolbar
193
- ##
194
-
195
175
  toolbar = Gtk::Toolbar.new
196
176
  toolbar.icon_size = Gtk::IconSize::MENU
197
177
 
@@ -220,7 +200,7 @@ module Grumblr
220
200
  combo.signal_connect(:changed) do |widget|
221
201
  $app.blog = $api.blogs[widget.active]
222
202
  $cfg.set :active_blog, $app.blog.name
223
- @statusbar.push 0, $app.blog.title
203
+ $statusbar.push 0, $app.blog.title
224
204
  end
225
205
  combo.set_active(active_blog_idx)
226
206
  item = Gtk::ToolItem.new
@@ -236,9 +216,7 @@ module Grumblr
236
216
  end
237
217
  toolbar.insert 3, item
238
218
 
239
- ##
240
219
  ### Buttons
241
- ##
242
220
  clear_button = Gtk::Button.new 'Clear'
243
221
  clear_button.set_focus_on_click false
244
222
  clear_button.signal_connect(:clicked) do |widget|
@@ -275,13 +253,12 @@ module Grumblr
275
253
  button_box.pack_start format_box, false
276
254
  button_box.pack_start submit_button, true
277
255
 
278
- ##
279
256
  ### Layout
280
- ##
281
257
  pack_start toolbar, false
282
258
  pack_start @notebook
283
259
  pack_start button_box, false
284
- pack_start @statusbar, false
260
+ pack_start $statusbar, false
261
+
285
262
  show_all
286
263
  end
287
264
 
@@ -516,9 +493,7 @@ module Grumblr
516
493
  Gtk::SeparatorMenuItem.new
517
494
  end
518
495
 
519
- ##
520
496
  ## Destroy Config
521
- ##
522
497
  def destroy_account
523
498
  icon = Gtk::ImageMenuItem.new 'Destroy account'
524
499
  icon.set_image Gtk::Image.new(Gtk::Stock::STOP, Gtk::IconSize::MENU)
@@ -615,9 +590,6 @@ module Gtk
615
590
  def get_value
616
591
  self.buffer.get_text
617
592
  end
618
- def clear
619
- self.buffer.set_text ''
620
- end
621
593
  end
622
594
 
623
595
  class LabeledEntry < Entry
@@ -634,18 +606,21 @@ module Gtk
634
606
  false
635
607
  end
636
608
  self.signal_connect(:focus_out_event) do |widget, type|
637
- if widget.text == ''
638
- widget.modify_text Gtk::STATE_NORMAL, PALE
639
- widget.set_text @label
640
- end
609
+ widget.clear if widget.text == ''
641
610
  false
642
611
  end
643
612
  self.show
644
613
  end
614
+
645
615
  def get_value
646
616
  value = self.text
647
617
  value == @label ? "" : value
648
618
  end
619
+
620
+ def clear
621
+ self.modify_text Gtk::STATE_NORMAL, PALE
622
+ self.set_text @label
623
+ end
649
624
  end
650
625
 
651
626
  class LabeledTextView < TextView
@@ -653,6 +628,7 @@ module Gtk
653
628
  @label = label
654
629
  super()
655
630
  self.set_wrap_mode Gtk::TextTag::WRAP_WORD
631
+ self.set_accepts_tab false
656
632
  self.set_right_margin 5
657
633
  self.set_left_margin 5
658
634
  self.modify_text Gtk::STATE_NORMAL, PALE
@@ -662,20 +638,33 @@ module Gtk
662
638
  widget.modify_text Gtk::STATE_NORMAL, DARK
663
639
  widget.buffer.set_text ''
664
640
  end
641
+ report_length
665
642
  false
666
643
  end
667
644
  self.signal_connect(:focus_out_event) do |widget, type|
668
- if widget.buffer.text == ''
669
- widget.modify_text Gtk::STATE_NORMAL, PALE
670
- widget.buffer.set_text @label
671
- end
645
+ self.clear if widget.buffer.text == ''
646
+ $statusbar.push 0, $app.blog.title
647
+ false
648
+ end
649
+ self.signal_connect(:key_release_event) do |widget, type|
650
+ report_length
672
651
  false
673
652
  end
674
653
  end
654
+
655
+ def report_length
656
+ $statusbar.push 0, "Length: #{self.buffer.text.size}"
657
+ end
658
+
675
659
  def get_value
676
660
  value = self.buffer.get_text
677
661
  value == @label ? "" : value
678
662
  end
663
+
664
+ def clear
665
+ self.modify_text Gtk::STATE_NORMAL, PALE
666
+ self.buffer.set_text @label
667
+ end
679
668
  end
680
669
 
681
670
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grumblr
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Philippov
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-08 00:00:00 +07:00
12
+ date: 2009-10-28 00:00:00 +06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency