Class: Grumblr::StatusIcon

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

Instance Method Summary collapse

Constructor Details

#initializeStatusIcon

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, button, time|
    menu.popup nil, nil, button, time
  end
end

Instance Method Details

#aboutObject



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_accountObject

Destroy Config



520
521
522
523
524
525
526
527
# File 'lib/grumblr/ui.rb', line 520

def 
  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


505
506
507
508
509
510
511
# File 'lib/grumblr/ui.rb', line 505

def menu
  menu = Gtk::Menu.new
  for item in [ ontop, sep, , sep, about, sep, quit ]
    menu.append item
  end
  menu.show_all
end

#ontopObject



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 |widget|
    $gui.keep_above = widget.active?
  end
  icon.show
end

#quitObject



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

#sepObject



513
514
515
# File 'lib/grumblr/ui.rb', line 513

def sep
  Gtk::SeparatorMenuItem.new
end