bigboard r7239 - trunk/bigboard



Author: otaylor
Date: Sun Jan 27 20:56:56 2008
New Revision: 7239
URL: http://svn.gnome.org/viewvc/bigboard?rev=7239&view=rev

Log:
Fix up the handling of authed-vs-unauthed in AbstractMugshotStock so that such stocks
 appear when we connect and authenticate to mugshot.org as intended (not sure that 
 this behavior is really right ... think of the preferences dialog before you
 log in.)


Modified:
   trunk/bigboard/stock.py

Modified: trunk/bigboard/stock.py
==============================================================================
--- trunk/bigboard/stock.py	(original)
+++ trunk/bigboard/stock.py	Sun Jan 27 20:56:56 2008
@@ -122,10 +122,11 @@
         super(AbstractMugshotStock, self).__init__(*args, **kwargs)
 
         self._model = DataModel(globals.server_name)
+        self._visible = self._model.self_resource != None
 
         # There is a minor danger of calling on_ready twice if we start up and then get a
         # ready notification before going idle; this could be protected with a flag variable
-        self._model.add_ready_handler(self._on_ready)
+        self._model.add_ready_handler(self.__invoke_on_ready)
         if self._model.ready:
             call_idle(self.__invoke_on_ready)
 
@@ -158,20 +159,17 @@
          
     @log_except(_logger)
     def __invoke_on_ready(self):
+        was_visible = self._visible
+
         if self._model.ready:
             self._on_ready()
+            
+        self._visible = self._model.self_resource != None
+        if self._visible != was_visible:
+            self.__sync_content()        
+            self.emit("visible", self._visible)
 
     def _on_ready(self):
         """Should be overridden by subclasses to handle the state where we
         have connected to the data model (or tried to connected an failed."""
         pass
-        
-    @log_except(_logger)
-    def __handle_mugshot_connection_status(self, auth, xmpp, contacts):
-        if auth != self._auth:
-            _logger.debug("emitting visibility: %s", auth)
-            self.emit("visible", auth)
-        self._auth = auth
-        self.__sync_content()        
-        self.__have_contacts = contacts
-        self.__check_ready()



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