[Sugar-devel] [sugar PATCH v2] sl#3326: Do not allow two telepathy-coonection objects to be instantiated, for a single Telepathy-Gabble-Account.

Ajay Garg ajay at activitycentral.com
Sat Jul 28 06:08:20 EDT 2012


Thanks to Jerry Vonau, for inspiring and guiding me to solve this :-)

Thanks to Daniel Drake, for the review of version-1 patch.

===================================================================================


Changes of version-2 over version-1 :
=====================================

Version-1 attached callback signals to only one of the two telepathy-connection-objects,
instantiated per telepathy-gabble-account. However, two telepathy-connection-objects 
were instantiated nevertheless. So, we needed to ensure that only one telepathy-connection-object
per telepathy-gabble-account be created (Thanks Daniel again).



Note that ::

a)
In the method "def __account_property_changed_cb(self, properties)", the properties were
investigated in each hit of this function. Unfortunately, in each call, 
 
                 properties['ConnectionStatus'] = 1
                               or
                 properties['ConnectionStatus'] = 2

which correspond to "Connecting" and "Disconnected" states, respectively.



At no time, was the value

                 properties['ConnectionStatus'] = 0

which would have corresponded to "Connected" state.


Please see ::  http://telepathy.freedesktop.org/spec/Connection.html#Enum:Connection_Status





b)
For every hit of the function "def __account_property_changed_cb(self, properties)", the value of

                properties['Connection'] 

was either "/", or one other connection-string, WHICH REMAINED CONSTANT IN EVERY CALL (i.e. whenever
the value was not "/").





c)
So, simply ensuring that there would be just one telepathy-connection-object per telepathy-connection-path
(the OTHER value besides "/" in step b)), we would be done.





 src/jarabe/model/neighborhood.py |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
index 39f648e..430023c 100644
--- a/src/jarabe/model/neighborhood.py
+++ b/src/jarabe/model/neighborhood.py
@@ -249,7 +249,6 @@ class _Account(gobject.GObject):
             return
         if properties['Connection'] == '/':
             self._check_registration_error()
-            self._connection = None
         elif self._connection is None:
             self._prepare_connection(properties['Connection'])
 
-- 
1.7.4.4



More information about the Sugar-devel mailing list