Class: Fliewr::StatusIcon

Inherits:
Gtk::StatusIcon
  • Object
show all
Defined in:
lib/fliewr/ui.rb

Instance Method Summary collapse

Constructor Details

#initializeStatusIcon

Returns a new instance of StatusIcon.



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/fliewr/ui.rb', line 183

def initialize
  super
  self.file = File.join(Fliewr::DATA_ROOT, 'pixmaps', 'fliewr.svg')
  self.set_tooltip 'Flickr Viewr'
  self.signal_connect(:activate) do
    if $gui.visible?
      $gui.minimize
    else
      $gui.move $cfg.get(:window_x_pos), $cfg.get(:window_y_pos)
      $gui.show.present
    end
  end

  menu = Gtk::Menu.new

  self.signal_connect(:popup_menu) do |icon, button, time|
    menu.popup nil, nil, button, time
  end

  separator = Gtk::SeparatorMenuItem.new

  item = Gtk::ImageMenuItem.new Gtk::Stock::HOME
  item.signal_connect(:activate) do
    $app.
  end
  menu.append item

  item = Gtk::ImageMenuItem.new Gtk::Stock::REFRESH
  item.signal_connect(:activate) do
    $app.update
  end
  menu.append item

  item = Gtk::CheckMenuItem.new 'Always on top'
  item.signal_connect(:toggled) do |widget|
    $gui.keep_above = widget.active?
  end
  menu.append item

  item = Gtk::ImageMenuItem.new Gtk::Stock::PREFERENCES
  item.signal_connect(:activate) do
    Fliewr::SettingsDialog.new
  end
  menu.append item

  item = Gtk::ImageMenuItem.new Gtk::Stock::ABOUT
  item.signal_connect(:activate) do
    AboutDialog.new
  end
  menu.append item
  menu.append separator

  item = Gtk::ImageMenuItem.new Gtk::Stock::QUIT
  item.signal_connect(:activate) do
    $app.quit
  end
  menu.append item
  menu.show_all
end