diff options
author | Morgan Collett <morgan.collett@gmail.com> | 2007-08-22 14:54:12 (GMT) |
---|---|---|
committer | Morgan Collett <morgan.collett@gmail.com> | 2007-08-22 14:54:12 (GMT) |
commit | 52f2bea3ed542e65f22664b5c837280fdab6960d (patch) | |
tree | 505490315ac5996924743633fec98b362630ffd3 /sugar/activity/activity.py | |
parent | d09b8d3ea43bb877c39e0f2e169cf3d885521ff2 (diff) |
Use new PresenceService API for sharing by invitation only
Diffstat (limited to 'sugar/activity/activity.py')
-rw-r--r-- | sugar/activity/activity.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py index 553b1a1..f63174a 100644 --- a/sugar/activity/activity.py +++ b/sugar/activity/activity.py @@ -448,13 +448,22 @@ class Activity(Window, gtk.Container): self._shared_activity = activity self.emit('shared') - def share(self): - """Request that the activity be shared on the network.""" + def share(self, private=False): + """Request that the activity be shared on the network. + + private -- bool: True to share by invitation only, + False to advertise as shared to everyone. + """ + # FIXME: Make private=True to turn on the by-invitation-only scope if self._shared_activity and self._shared_activity.props.joined: - raise RuntimeError("Activity %s already shared." % self._activity_id) - logging.debug('Requesting share of activity %s.' % self._activity_id) - self._share_id = self._pservice.connect("activity-shared", self._internal_share_cb) - self._pservice.share_activity(self) + raise RuntimeError("Activity %s already shared." % + self._activity_id) + verb = private and 'private' or 'public' + logging.debug('Requesting %s share of activity %s.' % + (verb, self._activity_id)) + self._share_id = self._pservice.connect("activity-shared", + self._internal_share_cb) + self._pservice.share_activity(self, private) def _realize_cb(self, window): wm.set_bundle_id(window.window, self.get_service_name()) |