From fbaf13184906f1478b1d5f103bf438c99ab41e7d Mon Sep 17 00:00:00 2001 From: Anna Date: Mon, 24 May 2010 18:02:07 -0400 Subject: [PATCH] Added a popup menu to the tray icon, but it doesn't pop up in a visible place yet (at least, not in fluxbox) --- hrafn.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hrafn.py b/hrafn.py index 3498115..f095ace 100755 --- a/hrafn.py +++ b/hrafn.py @@ -131,6 +131,12 @@ class Hrafn(): # Add a system tray icon self.tray_icon = gtk.status_icon_new_from_file('ui/icon.svg') self.tray_icon.connect('activate', self.on_tray_icon_clicked) + self.tray_icon.connect('popup-menu', self.on_tray_icon_popup) + self.tray_menu = gtk.Menu() + quit_item = gtk.MenuItem(gtk.STOCK_QUIT) + quit_item.connect('activate', self.gtk_main_quit) + self.tray_menu.attach(quit_item, 0, 1, 0, 1) + # Set the account label self.update_account_label() @@ -580,6 +586,10 @@ class Hrafn(): else: self.window.iconify() + + def on_tray_icon_popup(self, icon, button, activate_time): + self.tray_menu.popup(None, None, gtk.status_icon_position_menu, button, activate_time, self.tray_icon) + def on_window_state_changed(self, window, event): if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED: