psa: added progress bar for updates
[feedingit] / psa_harmattan / feedingit / deb_dist / feedingit-0.1.0 / debian / feedingit / usr / share / feedingit / feedingit.py
index 9755a3d..fbf58ff 100644 (file)
@@ -11,6 +11,8 @@ import codecs
 import dbus
 # import python dbus GLib mainloop support
 import dbus.mainloop.glib
+# Enable glib main loop support
+dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 
 # Comment the line below if you don't want to use OpenGL for QML rendering or if it is not supported
 from PySide import QtOpenGL,  QtCore
@@ -39,7 +41,9 @@ class Controller(QtCore.QObject):
                         completed, in_progress, queued,
                         bytes_downloaded, bytes_updated, bytes_per_second,
                         feed_updated):
-        pass
+        logger.info(feed_updated)
+        total = completed + in_progress + queued
+        root.updateProgress(total, completed)
     
     def update_started(self):
         root.updateStarted()
@@ -112,6 +116,7 @@ class Controller(QtCore.QObject):
     def markAllAsRead(self, key):
         feed = listing.getFeed(key)
         feed.markAllAsRead()
+        listing.updateUnread(key)
 
     @QtCore.Slot(str, str)
     def setEntryRead(self, key, articleid):
@@ -217,23 +222,22 @@ def main():
     controller = Controller(listing)
  
     # listen on dbus for download update progress
-    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
     bus = dbus.SessionBus()
-#        bus.add_signal_receiver(handler_function=self.update_progress,
-#                                bus_name=None,
-#                                signal_name='UpdateProgress',
-#                                dbus_interface='org.marcoz.feedingit',
-#                                path='/org/marcoz/feedingit/update')
-#    bus.add_signal_receiver(handler_function=controller.update_started,
-#                            bus_name=None,
-#                            signal_name='UpdateStarted',
-#                            dbus_interface='org.marcoz.feedingit',
-#                            path='/org/marcoz/feedingit/update')
-#    bus.add_signal_receiver(handler_function=controller.update_finished,
-#                            bus_name=None,
-#                            signal_name='UpdateFinished',
-#                            dbus_interface='org.marcoz.feedingit',
-#                            path='/org/marcoz/feedingit/update')
+    bus.add_signal_receiver(handler_function=controller.update_progress,
+                            bus_name=None,
+                            signal_name='UpdateProgress',
+                            dbus_interface='org.marcoz.feedingit',
+                            path='/org/marcoz/feedingit/update')
+    bus.add_signal_receiver(handler_function=controller.update_started,
+                            bus_name=None,
+                            signal_name='UpdateStarted',
+                            dbus_interface='org.marcoz.feedingit',
+                            path='/org/marcoz/feedingit/update')
+    bus.add_signal_receiver(handler_function=controller.update_finished,
+                            bus_name=None,
+                            signal_name='UpdateFinished',
+                            dbus_interface='org.marcoz.feedingit',
+                            path='/org/marcoz/feedingit/update')
  
     global root
     rc = view.rootContext()