deskbar-applet r2634 - in trunk: . deskbar/core deskbar/handlers



Author: sebp
Date: Tue Apr  7 16:56:02 2009
New Revision: 2634
URL: http://svn.gnome.org/viewvc/deskbar-applet?rev=2634&view=rev

Log:
Fixed bug #577649: deskbar-applet crashes because of GnomeURLopener in deskbar.core.Web on x86_64

Modified:
   trunk/ChangeLog
   trunk/deskbar/core/Web.py
   trunk/deskbar/handlers/twitter.py

Modified: trunk/deskbar/core/Web.py
==============================================================================
--- trunk/deskbar/core/Web.py	(original)
+++ trunk/deskbar/core/Web.py	Tue Apr  7 16:56:02 2009
@@ -208,7 +208,7 @@
         Exception.__init__ (self)
 
 
-class GnomeURLopener (urllib.FancyURLopener, gobject.GObject):
+class GnomeURLopener (urllib.FancyURLopener):
     """
     A subclass of C{urllib.URLopener} able to intercept user/password requests
     and pass them through an L{Account}, displaying a L{AccountDialog} if
@@ -219,10 +219,6 @@
                      a new fresh GnomeURLopener each time you need one
     """
     
-    __gsignals__ = {
-        "done" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [gobject.TYPE_PYOBJECT]),
-    }
-    
     def __init__ (self, account, extra_widget_factory=None):
         """
         @param account: The L{Account} object to request credentials from
@@ -235,7 +231,7 @@
         """
         proxies = get_proxy()
         urllib.FancyURLopener.__init__ (self, proxies)
-        gobject.GObject.__init__ (self)
+        
         self._account = account
         self._thread = None
         self._authentication_retries = 0
@@ -311,7 +307,7 @@
                         # The factory returned a non-None non-widget object
                         LOGGER.error ("%s returned a non-gtk.Widget instance: %s" % (self._extra_widget_factory, type(widget)))
     
-    def open_async (self, url, payload=None):
+    def open_async (self, url, payload=None, callback=None):
         """
         Open a URL asynchronously. When the request has been completed the
         C{"done"} signal of this class is emitted.
@@ -334,9 +330,9 @@
             raise ConcurrentRequestsException()
     
         if payload != None :
-            async_args = (url, payload)
+            async_args = ((url, payload), callback)
         else :
-            async_args = (url, )
+            async_args = ((url, ), callback)
         
         self._thread = threading.Thread (target=self._do_open_async,
                                          args=async_args,
@@ -355,9 +351,10 @@
         self._thread = None
         
         info = None
+        open_args, callback = args
         
         try:
-            info = self.open (*args)
+            info = self.open (*open_args)
         except AuthenticationAborted:
             LOGGER.debug ("Detected authentication abort")
             self._success = True # The user should not be warned
@@ -366,6 +363,7 @@
             self._success = False            
             
         gtk.gdk.threads_enter()
-        self.emit ("done", info)
+        if callback != None and callable(callback):
+            callback(self, info)
         gtk.gdk.threads_leave()
 

Modified: trunk/deskbar/handlers/twitter.py
==============================================================================
--- trunk/deskbar/handlers/twitter.py	(original)
+++ trunk/deskbar/handlers/twitter.py	Tue Apr  7 16:56:02 2009
@@ -83,12 +83,10 @@
         self._update_url = update_url
         self._domain = domain
         
-        self._opener.connect ("done", self._on_opener_done)
-        
     def update (self, msg):
         try:
             post_payload = urllib.urlencode({"status" : msg, "source" : "deskbar"})
-            self._opener.open_async (self._update_url, post_payload)
+            self._opener.open_async (self._update_url, post_payload, self._on_opener_done)
         except ConcurrentRequestsException :
             LOGGER.warning ("Attempting to post while another post is already running. Ignoring")
             error = gtk.MessageDialog (None,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]