diff --git a/hrafn.py b/hrafn.py index 24c9343..3498115 100755 --- a/hrafn.py +++ b/hrafn.py @@ -75,6 +75,8 @@ class Hrafn(): self.username = self.db['active_user'] + self.minimized = False + try: self.api = self.accounts[self.username] except KeyError: @@ -128,7 +130,7 @@ 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) # Set the account label self.update_account_label() @@ -239,7 +241,7 @@ class Hrafn(): def on_about(self, widget): - print "STUB: help->about not yet implemented" + print "stub: Hrafn.on_about()" def on_reply(self, widget, data): @@ -571,6 +573,21 @@ class Hrafn(): self.accounts_menu.append(menu_item) menu_item.show() + + def on_tray_icon_clicked(self, event): + if self.minimized: + self.window.deiconify() + else: + self.window.iconify() + + + def on_window_state_changed(self, window, event): + if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED: + if event.new_window_state & gtk.gdk.WINDOW_STATE_ICONIFIED: + self.minimized = True + else: + self.minimized = False + ### end class Hrafn diff --git a/ui/default.glade b/ui/default.glade index 1d6e5cc..6789814 100644 --- a/ui/default.glade +++ b/ui/default.glade @@ -23,6 +23,7 @@ + @@ -101,11 +102,10 @@ _Views True - - - - - + + + + @@ -115,11 +115,10 @@ _Accounts True - - - - - + + + +