From ce52823cb75ffcbd88677abc0c05108e2f15d092 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Sat, 23 Jan 2010 15:20:41 -0200 Subject: [PATCH] trying to make the statusicon hide/display the main window --- mitterlib/ui/ui_pygtk.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mitterlib/ui/ui_pygtk.py b/mitterlib/ui/ui_pygtk.py index 2b21939..5c8377c 100644 --- a/mitterlib/ui/ui_pygtk.py +++ b/mitterlib/ui/ui_pygtk.py @@ -635,6 +635,14 @@ class Interface(object): return + def _window_to_tray(self, statusicon, user_data=None): + """Minimize/display main window (as in minimize to tray.)""" + if self._main_window.get_property('visible'): + self._main_window.hide_all() + else: + self._main_window.show_all() + return + # ------------------------------------------------------------ # Helper functions # ------------------------------------------------------------ @@ -1421,6 +1429,7 @@ class Interface(object): if self._options[self.NAMESPACE]['statusicon']: self._statusicon = gtk.StatusIcon() self._statusicon.set_from_pixbuf(self._images['icon']) + self._statusicon.connect('activate', self._window_to_tray) else: self._statusicon = None