Add activity to owner's list after sharing it

This commit is contained in:
Dan Williams 2007-04-13 16:59:16 -04:00
parent 99737f8273
commit 879ef9b0e0
2 changed files with 9 additions and 5 deletions

View File

@ -229,7 +229,7 @@ class Activity(DBusGObject):
# Not for us # Not for us
return return
(sigid, async_cb, async_err_cb) = userdata (sigid, owner, async_cb, async_err_cb) = userdata
self._tp.disconnect(sigid) self._tp.disconnect(sigid)
if exc: if exc:
@ -238,16 +238,17 @@ class Activity(DBusGObject):
else: else:
self._handle_share_join(tp, text_channel) self._handle_share_join(tp, text_channel)
self.send_properties() self.send_properties()
owner.add_activity(self)
async_cb(dbus.ObjectPath(self._object_path)) async_cb(dbus.ObjectPath(self._object_path))
logging.debug("Share of activity %s succeeded." % self._id) logging.debug("Share of activity %s succeeded." % self._id)
def _share(self, (async_cb, async_err_cb)): def _share(self, (async_cb, async_err_cb), owner):
logging.debug("Starting share of activity %s" % self._id) logging.debug("Starting share of activity %s" % self._id)
if self._joined: if self._joined:
async_err_cb(RuntimeError("Already shared activity %s" % self.props.id)) async_err_cb(RuntimeError("Already shared activity %s" % self.props.id))
return return
sigid = self._tp.connect('activity-shared', self._shared_cb) sigid = self._tp.connect('activity-shared', self._shared_cb)
self._tp.share_activity(self.props.id, (sigid, async_cb, async_err_cb)) self._tp.share_activity(self.props.id, (sigid, owner, async_cb, async_err_cb))
logging.debug("done with share attempt %s" % self._id) logging.debug("done with share attempt %s" % self._id)
def _joined_cb(self, tp, activity_id, text_channel, exc, userdata): def _joined_cb(self, tp, activity_id, text_channel, exc, userdata):

View File

@ -169,7 +169,10 @@ class PresenceService(dbus.service.Object):
del self._activities[activity.props.id] del self._activities[activity.props.id]
def _buddy_activities_changed(self, tp, contact_handle, activities): def _buddy_activities_changed(self, tp, contact_handle, activities):
logging.debug("------------activities changed-------------") acts = []
for act in activities:
acts.append(str(act))
logging.debug("Handle %s activities changed: %s" % (contact_handle, acts))
buddies = self._handles_buddies[tp] buddies = self._handles_buddies[tp]
buddy = buddies.get(contact_handle) buddy = buddies.get(contact_handle)
@ -306,7 +309,7 @@ class PresenceService(dbus.service.Object):
id=actid, type=atype, name=name, color=color, local=True) id=actid, type=atype, name=name, color=color, local=True)
activity.connect("validity-changed", self._activity_validity_changed_cb) activity.connect("validity-changed", self._activity_validity_changed_cb)
self._activities[actid] = activity self._activities[actid] = activity
activity._share(callbacks) activity._share(callbacks, self._owner)
# local activities are valid at creation by definition, but we can't # local activities are valid at creation by definition, but we can't
# connect to the activity's validity-changed signal until its already # connect to the activity's validity-changed signal until its already