Cache activity id

This commit is contained in:
Dan Williams 2006-08-16 23:05:53 -04:00
parent 95c06280ca
commit 6d7782654c

View File

@ -28,6 +28,8 @@ class Activity(gobject.GObject):
self._activity.connect_to_signal('BuddyLeft', self._buddy_left_cb) self._activity.connect_to_signal('BuddyLeft', self._buddy_left_cb)
self._activity.connect_to_signal('ServiceAppeared', self._service_appeared_cb) self._activity.connect_to_signal('ServiceAppeared', self._service_appeared_cb)
self._activity.connect_to_signal('ServiceDisappeared', self._service_disappeared_cb) self._activity.connect_to_signal('ServiceDisappeared', self._service_disappeared_cb)
self._id = None
def object_path(self): def object_path(self):
return self._object_path return self._object_path
@ -61,7 +63,10 @@ class Activity(gobject.GObject):
gobject.idle_add(self._emit_service_disappeared_signal, object_path) gobject.idle_add(self._emit_service_disappeared_signal, object_path)
def get_id(self): def get_id(self):
return self._activity.getId() # Cache activity ID, which should never change anyway
if not self._id:
self._id = self._activity.getId()
return self._id
def get_icon(self): def get_icon(self):
return self._buddy.getIcon() return self._buddy.getIcon()