[Sugar-devel] [Sugar PATCH] sl#3169, sl#4226: Process the 'PropertiesChanged' signal-callback, only if the buddy has been added into the sugar-model.

Ajay Garg ajay at activitycentral.com
Fri Dec 7 07:57:31 EST 2012


There will be cases when we receive the "Properties" changed signal from telepathy for a particular "online" buddy; we then call the "__buddy_info_updated_cb" to process the signal, trying to update the properties.

However, if the buddy hasn't already been added to th sugar-model (via "AliasesChanged" signal ==> "__aliases_changed_cb" callback ==> "buddy-updated" signal ==> "__buddy_updated_cb" callback), there is no point processing the properties. At this point, it is ok letting go off the seemingly "missed" 'PropertiesChanged' signal, as the properties are added to the model, when the buddy is added to the model.

Next time onwards (after the buddy has been added into the model), any further 'PropertiesChanged' signal will be suitably processed.

 src/jarabe/model/neighborhood.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
index a12ad2b..8ca576a 100644
--- a/src/jarabe/model/neighborhood.py
+++ b/src/jarabe/model/neighborhood.py
@@ -427,7 +427,8 @@ class _Account(GObject.GObject):
 
     def __buddy_info_updated_cb(self, handle, properties):
         logging.debug('_Account.__buddy_info_updated_cb %r', handle)
-        self.emit('buddy-updated', self._buddy_handles[handle], properties)
+        if handle in self._buddy_handles:
+            self.emit('buddy-updated', self._buddy_handles[handle], properties)
 
     def __current_activity_changed_cb(self, contact_handle, activity_id,
                                       room_handle):
-- 
1.7.11.7



More information about the Sugar-devel mailing list