Commits

boralyl committed 83e5bc9

Added notifications for when syncing starts. Notifications close when syncing is complete.

Comments (0)

Files changed (1)

systray_file_watcher_app/application.py

 from subprocess import Popen, PIPE
 import time
 
-from gi.repository import GObject, Gio, GLib
+from gi.repository import GObject, Gio, GLib, Notify
 import gtk
 
 class FileWatcher(gtk.StatusIcon):
     def __init__(self, watch):
         self.logger = logging.getLogger('FileWatcher')
         self.logger.debug("Initializing...")
-
+        Notify.init('Initializing...')
+        self.notificaiton = Notify.Notification.new('Syncing', 
+            'Syncing in progress...', 'dialog-information')
+        self.notification_active = False
         self.watch = watch
 
         gtk.StatusIcon.__init__(self)
 
         self.ui_reset()
-
-        self.notification_active = False
+        
         self.last_update = datetime.datetime(2000, 1, 1)
 
         self.procs = {}
     # UI bits
 
     def ui_update_new_data(self, data):
+        if not self.notification_active:
+            self.notificaiton.show()
         self.notification_active = True
         self.last_update = datetime.datetime.now()
         self.set_from_file(os.path.join(
         self.set_tooltip("Updates in progress to %s" % self.watch)
 
     def ui_reset(self):
+        if self.notification_active:
+            self.notificaiton.close()
         self.notification_active = False
         self.set_from_file(os.path.join(
                 os.path.dirname(__file__),