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.
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
# File 'lib/grumblr/ui.rb', line 539 def initialize super self.icon_name = 'grumblr' self.tooltip = "#{Grumblr::APP_NAME} #{Grumblr::VERSION}" 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
578 579 580 581 582 583 584 |
# File 'lib/grumblr/ui.rb', line 578 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
569 570 571 572 573 574 575 576 |
# File 'lib/grumblr/ui.rb', line 569 def destroy_account icon = Gtk::ImageMenuItem.new('Forget password') 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
556 557 558 559 560 561 562 |
# File 'lib/grumblr/ui.rb', line 556 def = Gtk::Menu.new [ ontop, sep, destroy_account, sep, about, sep, quit ].each do |item| .append item end .show_all end |
#ontop ⇒ Object
586 587 588 589 590 591 592 |
# File 'lib/grumblr/ui.rb', line 586 def ontop icon = Gtk::CheckMenuItem.new('Always on top') icon.signal_connect(:toggled) do || $gui.keep_above = .active? end icon.show end |
#quit ⇒ Object
594 595 596 597 598 599 600 |
# File 'lib/grumblr/ui.rb', line 594 def quit icon = Gtk::ImageMenuItem.new(Gtk::Stock::QUIT) icon.signal_connect(:activate) do $app.quit end icon.show end |
#sep ⇒ Object
564 565 566 |
# File 'lib/grumblr/ui.rb', line 564 def sep Gtk::SeparatorMenuItem.new end |