* dead to races and multithreaded gtk widget access; we move code from the
authorAlexander Sack <asac@ubuntu.com>
Fri, 10 Jul 2009 00:40:29 +0000 (02:40 +0200)
committerAlexander Sack <asac@ubuntu.com>
Fri, 10 Jul 2009 00:40:29 +0000 (02:40 +0200)
  data retrieval thread to idle handler(s); we change function signature of update_view_contents idle handler and
  add new idle handler status_bar_update_finished
  - update gwibber/client.py

gwibber/client.py

index 3f61309..6032cb3 100644 (file)
@@ -1116,8 +1116,16 @@ class GwibberClient(gtk.Window):
           self.indicator_items[msg.gId] = indicator
           indicator.show()
 
-  def update_view_contents(self, view):
+  def update_view_contents(self, view, indicate, tab):
     view.load_messages()
+    if indicate and hasattr(view, "add_indicator") and view.add_indicator:
+      self.manage_indicator_items(view.message_store, tab_num=self.tabs.page_num(tab))
+    if tab.show_notifications: self.show_notification_bubbles(view.message_store)
+
+  def status_bar_update_finished(self, next_update):
+    self.statusbar.pop(0)
+    self.statusbar.push(0, _("Last update: %s") % time.strftime("%X"))
+    self.last_update = next_update
 
   def update(self, tabs = None):
     self.throbber.set_from_animation(
@@ -1138,17 +1146,10 @@ class GwibberClient(gtk.Window):
               and m.time <= mx.DateTime.gmt()]
             self.flag_duplicates(view.message_store)
             gtk.gdk.threads_enter()
-            gobject.idle_add(self.update_view_contents, view)
-            
-            if indicate and hasattr(view, "add_indicator") and view.add_indicator:
-              self.manage_indicator_items(view.message_store, tab_num=self.tabs.page_num(tab))
-
+            gobject.idle_add(self.update_view_contents, view, indicate, tab)
             gtk.gdk.threads_leave()
-            if tab.show_notifications: self.show_notification_bubbles(view.message_store)
 
-        self.statusbar.pop(0)
-        self.statusbar.push(0, _("Last update: %s") % time.strftime("%X"))
-        self.last_update = next_update
+        gobject.idle_add(self.status_bar_update_finished, next_update)
 
       finally: gobject.idle_add(self.throbber.clear)