diff options
Diffstat (limited to 'sugar')
-rw-r--r-- | sugar/activity/activity.py | 14 | ||||
-rw-r--r-- | sugar/activity/activityservice.py | 5 |
2 files changed, 19 insertions, 0 deletions
diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py index 9e14088..af15e4e 100644 --- a/sugar/activity/activity.py +++ b/sugar/activity/activity.py @@ -543,6 +543,20 @@ class Activity(Window, gtk.Container): # FIXME: some way to distinguish between share scopes self._jobject.metadata['share-scope'] = SCOPE_NEIGHBORHOOD + def _invite_response_cb(self, error): + if error: + logging.error('Invite failed: %s' % error) + + def invite(self, buddy_key): + if self._shared_activity is None: + return + + buddy = self._pservice.get_buddy(buddy_key) + if buddy: + self._shared_activity.invite(buddy, '', self._invite_response_cb) + else: + logging.error('Cannot invite %s, no such buddy.' % buddy_key) + def share(self, private=False): """Request that the activity be shared on the network. diff --git a/sugar/activity/activityservice.py b/sugar/activity/activityservice.py index f2b3394..b2f7e15 100644 --- a/sugar/activity/activityservice.py +++ b/sugar/activity/activityservice.py @@ -59,3 +59,8 @@ class ActivityService(dbus.service.Object): def SetActive(self, active): logging.debug('ActivityService.set_active: %s.' % active) self._activity.props.active = active + + @dbus.service.method(_ACTIVITY_INTERFACE) + def Invite(self, buddy_key): + self._activity.invite(buddy_key) + |