← Back to team overview

gtg-user team mailing list archive

StatusIcon

 

hi, patch StatusIcon
=== modified file 'GTG/taskbrowser/browser.py'
--- GTG/taskbrowser/browser.py 2009-07-16 16:17:56 +0000
+++ GTG/taskbrowser/browser.py 2009-07-18 05:08:15 +0000
@@ -85,12 +85,18 @@
         self.window = self.wTree.get_widget("MainWindow")
         if (self.window):
             self.window.connect("destroy", gtk.main_quit)
+            self.systray = gtk.StatusIcon()
+            self.systray.connect('activate', self.on_activate)
+            self._systray = True
+            self._xy = None

         icon_dirs = [GTG.DATA_DIR, os.path.join(GTG.DATA_DIR, "icons")]

         for i in icon_dirs:
+            print i
             gtk.icon_theme_get_default().prepend_search_path(i)
             gtk.window_set_default_icon_name("gtg")
+            self.systray.set_from_icon_name("gtg")

         self.tagpopup = self.wTree.get_widget("TagContextMenu")
         self.taskpopup = self.wTree.get_widget("TaskContextMenu")
@@ -405,6 +411,17 @@
                 self.note_toggle.hide()
                 self.new_note_button.hide()

+    def on_activate(self, status_icon):
+        #print self.window.is_active()
+        if self._systray:
+            self._systray = False
+            self._xy = self.window.get_position()
+            self.window.hide()
+        else:
+            self._systray = True
+            self.window.show()
+            self.window.move(*self._xy)
+
     def on_move(self, widget, data): #pylint: disable-msg=W0613
         xpos, ypos = self.window.get_position()
         self.priv["window_xpos"] = xpos


https://code.launchpad.net/~miuler/gtg/gtg_miuler


    _\|/_
    (O-O)
--oOO-(_)-OOo----------------------------------------
Hector Miuler Malpica Gallegos
Universidad Nacional del Callao - Peru
Escuela de Ingenieria Electronica

usuario registrado #308608

Follow ups