Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/presence/presenceservice.py
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-04-13 20:27:58 (GMT)
committer Dan Williams <dcbw@redhat.com>2007-04-13 20:27:58 (GMT)
commit3abe79353afc83999f3850bd61bf3e7053559243 (patch)
treedea6f50633c924283d60e02a8c860962e1a91fda /sugar/presence/presenceservice.py
parent17adb7b58beaecec626a830b14da780ef2cbee1a (diff)
Asynchronize activity sharing on the client side
Diffstat (limited to 'sugar/presence/presenceservice.py')
-rw-r--r--sugar/presence/presenceservice.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/sugar/presence/presenceservice.py b/sugar/presence/presenceservice.py
index 604439b..9b7bd3c 100644
--- a/sugar/presence/presenceservice.py
+++ b/sugar/presence/presenceservice.py
@@ -16,6 +16,7 @@
# Boston, MA 02111-1307, USA.
import dbus, dbus.glib, gobject
+import logging
import buddy, activity
@@ -59,7 +60,10 @@ class PresenceService(gobject.GObject):
'activity-appeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
([gobject.TYPE_PYOBJECT])),
'activity-disappeared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
- ([gobject.TYPE_PYOBJECT]))
+ ([gobject.TYPE_PYOBJECT])),
+ 'activity-shared': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
+ ([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT,
+ gobject.TYPE_PYOBJECT]))
}
_PS_BUDDY_OP = DBUS_PATH + "/Buddies/"
@@ -178,12 +182,20 @@ class PresenceService(gobject.GObject):
return None
return self._new_object(owner_op)
+ def _share_activity_cb(self, activity, op):
+ self.emit("activity-shared", True, self._new_object(op), None)
+
+ def _share_activity_error_cb(self, activity, err):
+ logging.debug("Error sharing activity %s: %s" % (activity.get_id(), err))
+ self.emit("activity-shared", False, None, err)
+
def share_activity(self, activity, properties={}):
actid = activity.get_id()
atype = activity.get_service_name()
name = activity.props.title
- serv_op = self._ps.ShareActivity(actid, atype, name, properties)
- return self._new_object(serv_op)
+ self._ps.ShareActivity(actid, atype, name, properties,
+ reply_handler=lambda *args: self._share_activity_cb(activity, *args),
+ error_handler=lambda *args: self._share_activity_error_cb(activity, *args))
class _MockPresenceService(gobject.GObject):