Listen to local activity lifecycle signals

This commit is contained in:
Dan Williams 2006-06-16 17:01:25 -04:00
parent eb47a36701
commit a6c33403ff

View File

@ -70,9 +70,15 @@ class ActivitiesView(gtk.TreeView):
browser_shell.open_browser_with_id(address, activity_id) browser_shell.open_browser_with_id(address, activity_id)
class StartPage(gtk.HBox): class StartPage(gtk.HBox):
def __init__(self): def __init__(self, ac_signal_object):
gtk.HBox.__init__(self) gtk.HBox.__init__(self)
self._ac_signal_object = ac_signal_object
self._ac_signal_object.connect("local-activity-started",
self._on_local_activity_started_cb)
self._ac_signal_object.connect("local-activity-ended",
self._on_local_activity_ended_cb)
self._pservice = PresenceService.get_instance() self._pservice = PresenceService.get_instance()
self._pservice.connect("activity-announced", self._on_activity_announced_cb) self._pservice.connect("activity-announced", self._on_activity_announced_cb)
self._pservice.start() self._pservice.start()
@ -114,6 +120,13 @@ class StartPage(gtk.HBox):
self.pack_start(sw) self.pack_start(sw)
sw.show() sw.show()
def _on_local_activity_started_cb(self, helper, activity_container, activity_id):
self._pservice.track_activity(activity_id)
print "new local activity %s" % activity_id
def _on_local_activity_ended_cb(self, helper, activity_container, activity_id):
self._pservice.untrack_activity(activity_id)
def _on_activity_announced_cb(self, pservice, service, buddy): def _on_activity_announced_cb(self, pservice, service, buddy):
self._activities.get_model().add_activity(buddy, service) self._activities.get_model().add_activity(buddy, service)