Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2007-11-05 17:11:38 (GMT)
committer Simon McVittie <simon.mcvittie@collabora.co.uk>2007-11-05 17:11:38 (GMT)
commitdad964b01b58fcc3c2b2ea9652641a188be14557 (patch)
tree89c1364bf19dad7d001fe393760c6141a5361936
parentfbc0e38bedef7a6837a8bec773140737134c93af (diff)
Revert "#4585 Watch activity unique names on D-Bus for disappearances"
This reverts commit 0d8c69c14bc4b18751f32e9c89c13ea8357b4666.
-rw-r--r--src/presenceservice.py47
1 files changed, 12 insertions, 35 deletions
diff --git a/src/presenceservice.py b/src/presenceservice.py
index 1af4996..218c974 100644
--- a/src/presenceservice.py
+++ b/src/presenceservice.py
@@ -84,9 +84,6 @@ class PresenceService(ExportedGObject):
signal_name="Disconnected",
dbus_interface="org.freedesktop.DBus")
- # Watch Activity D-Bus unique names
- self._activity_name_watches = {}
-
# Create the Owner object
self._owner = self._create_owner()
key = self._owner.props.key
@@ -482,11 +479,6 @@ class PresenceService(ExportedGObject):
activity.connect("validity-changed",
self._activity_validity_changed_cb)
activity.connect("disappeared", self._activity_disappeared_cb)
- self._activity_name_watches[activity.props.id] =\
- self._session_bus.watch_name_owner(
- caller_dbus_name,
- lambda dbus_name: self._watch_activity_name_cb(
- activity, dbus_name))
self._activities_by_id[activity_id] = activity
self._activities_by_handle[tp][room] = activity
return activity
@@ -495,10 +487,15 @@ class PresenceService(ExportedGObject):
_logger.debug("activity %s disappeared" % activity.props.id)
self.ActivityDisappeared(activity.object_path())
- self._activities_by_id.pop(activity.props.id, None)
+ try:
+ del self._activities_by_id[activity.props.id]
+ except KeyError:
+ pass
tp, room = activity.room_details
- self._activities_by_handle[tp].pop(room, None)
- self._activity_name_watches.pop(activity.props.id, None)
+ try:
+ del self._activities_by_handle[tp][room]
+ except KeyError:
+ pass
def _buddy_activities_changed(self, tp, contact_handle, activities):
activities = dict(activities)
@@ -732,14 +729,13 @@ class PresenceService(ExportedGObject):
return self._owner.object_path()
@dbus.service.method(PRESENCE_INTERFACE, in_signature="sssa{sv}",
- out_signature="o", async_callbacks=('async_cb', 'async_err_cb'),
- sender_keyword='sender')
+ out_signature="o", async_callbacks=('async_cb', 'async_err_cb'))
def ShareActivity(self, actid, atype, name, properties, async_cb,
- async_err_cb, sender=None):
+ async_err_cb):
_logger.debug('ShareActivity(actid=%r, atype=%r, name=%r, '
'properties=%r)', actid, atype, name, properties)
self._share_activity(actid, atype, name, properties, True,
- async_cb, async_err_cb, sender)
+ async_cb, async_err_cb)
def _get_preferred_plugin(self):
for tp in self._plugins:
@@ -761,7 +757,7 @@ class PresenceService(ExportedGObject):
tp.cleanup()
def _share_activity(self, actid, atype, name, properties, private,
- async_cb, async_err_cb, caller_dbus_name=None):
+ async_cb, async_err_cb):
"""Create the shared Activity.
actid -- XXX
@@ -772,8 +768,6 @@ class PresenceService(ExportedGObject):
False for publicly advertised sharing
async_cb -- function: Callback for success
async_err_cb -- function: Callback for failure
- caller_dbus_name -- string: activity's unique name on the D-Bus
- session bus
"""
objid = self._get_next_object_id()
# XXX: is the preferred Telepathy plugin always the right way to
@@ -787,11 +781,6 @@ class PresenceService(ExportedGObject):
activity.connect("validity-changed",
self._activity_validity_changed_cb)
activity.connect("disappeared", self._activity_disappeared_cb)
- self._activity_name_watches[activity.props.id] =\
- self._session_bus.watch_name_owner(
- caller_dbus_name,
- lambda dbus_name: self._watch_activity_name_cb(
- activity, dbus_name))
self._activities_by_id[actid] = activity
def activity_shared():
@@ -825,18 +814,6 @@ class PresenceService(ExportedGObject):
else:
activity.set_properties(props)
- def _watch_activity_name_cb(self, activity, dbus_name):
- """Check if the activity's D-Bus unique name disappears.
-
- If it does, the activity disappeared without Leave()ing.
- """
- if not dbus_name:
- _logger.warning(
- "Activity %s's D-Bus name disappeared, this probably "
- 'means it terminated without calling Leave().',
- activity.props.name)
- self._activity_disappeared_cb(activity)
-
def main(test_num=0, randomize=False):
loop = gobject.MainLoop()