Class: Grumblr::StatusIcon
- Inherits:
-
Gtk::StatusIcon
- Object
- Gtk::StatusIcon
- Grumblr::StatusIcon
- Defined in:
- lib/grumblr/ui.rb
Instance Method Summary collapse
- #about ⇒ Object
-
#destroy_account ⇒ Object
Destroy Config.
-
#initialize ⇒ StatusIcon
constructor
A new instance of StatusIcon.
- #menu ⇒ Object
- #ontop ⇒ Object
- #quit ⇒ Object
- #sep ⇒ Object
Constructor Details
#initialize ⇒ StatusIcon
Returns a new instance of StatusIcon.
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
# File 'lib/grumblr/ui.rb', line 488 def initialize super self.file = File.join(Grumblr::DATA_ROOT, 'grumblr.svg') self.tooltip = "Application Name Goes Here" 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 self.signal_connect(:popup_menu) do |icon, , time| .popup nil, nil, , time end end |
Instance Method Details
#about ⇒ Object
529 530 531 532 533 534 535 |
# File 'lib/grumblr/ui.rb', line 529 def about icon = Gtk::ImageMenuItem.new Gtk::Stock::ABOUT icon.signal_connect(:activate) do AboutDialog.new end icon.show end |
#destroy_account ⇒ Object
Destroy Config
520 521 522 523 524 525 526 527 |
# File 'lib/grumblr/ui.rb', line 520 def destroy_account icon = Gtk::ImageMenuItem.new 'Destroy account' icon.set_image Gtk::Image.new(Gtk::Stock::STOP, Gtk::IconSize::MENU) icon.signal_connect(:activate) do $cfg.destroy end icon.show end |
#menu ⇒ Object
505 506 507 508 509 510 511 |
# File 'lib/grumblr/ui.rb', line 505 def = Gtk::Menu.new for item in [ ontop, sep, destroy_account, sep, about, sep, quit ] .append item end .show_all end |
#ontop ⇒ Object
537 538 539 540 541 542 543 |
# File 'lib/grumblr/ui.rb', line 537 def ontop icon = Gtk::CheckMenuItem.new 'Always on top' icon.signal_connect(:toggled) do || $gui.keep_above = .active? end icon.show end |
#quit ⇒ Object
545 546 547 548 549 550 551 |
# File 'lib/grumblr/ui.rb', line 545 def quit icon = Gtk::ImageMenuItem.new Gtk::Stock::QUIT icon.signal_connect(:activate) do $app.quit end icon.show end |
#sep ⇒ Object
513 514 515 |
# File 'lib/grumblr/ui.rb', line 513 def sep Gtk::SeparatorMenuItem.new end |