Fix sharing publicly
This commit is contained in:
parent
d52860a764
commit
d2261e4051
@ -484,7 +484,7 @@ class Activity(Window, gtk.Container):
|
|||||||
(verb, self._activity_id))
|
(verb, self._activity_id))
|
||||||
self._share_id = self._pservice.connect("activity-shared",
|
self._share_id = self._pservice.connect("activity-shared",
|
||||||
self._internal_share_cb)
|
self._internal_share_cb)
|
||||||
self._pservice.share_activity(self, private)
|
self._pservice.share_activity(self, private=private)
|
||||||
|
|
||||||
def _realize_cb(self, window):
|
def _realize_cb(self, window):
|
||||||
wm.set_bundle_id(window.window, self.get_service_name())
|
wm.set_bundle_id(window.window, self.get_service_name())
|
||||||
|
@ -371,12 +371,8 @@ class PresenceService(gobject.GObject):
|
|||||||
_logger.debug("Error sharing activity %s: %s" % (activity.get_id(), err))
|
_logger.debug("Error sharing activity %s: %s" % (activity.get_id(), err))
|
||||||
self.emit("activity-shared", False, None, err)
|
self.emit("activity-shared", False, None, err)
|
||||||
|
|
||||||
def share_activity(self, activity, private=True):
|
def share_activity(self, activity, properties={}, private=True):
|
||||||
"""Ask presence service to ask the activity to share itself publicly.
|
"""Ask presence service to ask the activity to share itself publicly.
|
||||||
|
|
||||||
activity -- sugar.activity.activity.Activity instance
|
|
||||||
private -- bool: True to share by invitation only,
|
|
||||||
False to advertise as shared to everyone.
|
|
||||||
|
|
||||||
Uses the AdvertiseActivity method on the service to ask for the
|
Uses the AdvertiseActivity method on the service to ask for the
|
||||||
sharing of the given activity. Arranges to emit activity-shared
|
sharing of the given activity. Arranges to emit activity-shared
|
||||||
@ -389,20 +385,33 @@ class PresenceService(gobject.GObject):
|
|||||||
returns None
|
returns None
|
||||||
"""
|
"""
|
||||||
actid = activity.get_id()
|
actid = activity.get_id()
|
||||||
|
_logger.debug('XXXX in share_activity')
|
||||||
|
|
||||||
# Ensure the activity is not already shared/joined
|
# Ensure the activity is not already shared/joined
|
||||||
for obj in self._objcache.values():
|
for obj in self._objcache.values():
|
||||||
if not isinstance(object, Activity):
|
if not isinstance(object, Activity):
|
||||||
continue
|
continue
|
||||||
if obj.props.id == actid or obj.props.joined:
|
if obj.props.id == actid or obj.props.joined:
|
||||||
raise RuntimeError("Activity %s is already shared." % actid)
|
raise RuntimeError("Activity %s is already shared." %
|
||||||
|
actid)
|
||||||
|
|
||||||
atype = activity.get_service_name()
|
atype = activity.get_service_name()
|
||||||
name = activity.props.title
|
name = activity.props.title
|
||||||
# FIXME: Test, then make this AdvertiseActivity:
|
if private:
|
||||||
self._ps.ShareActivity(actid, atype, name, private,
|
_logger.debug('XXXX private, so calling InviteActivity')
|
||||||
reply_handler=lambda *args: self._share_activity_cb(activity, *args),
|
self._ps.InviteActivity(actid, atype, name, properties,
|
||||||
error_handler=lambda *args: self._share_activity_error_cb(activity, *args))
|
reply_handler=lambda *args: \
|
||||||
|
self._share_activity_cb(activity, *args),
|
||||||
|
error_handler=lambda *args: \
|
||||||
|
self._share_activity_error_cb(activity, *args))
|
||||||
|
else:
|
||||||
|
# FIXME: Test, then make this AdvertiseActivity:
|
||||||
|
_logger.debug('XXXX not private, so calling ShareActivity')
|
||||||
|
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))
|
||||||
|
|
||||||
def get_preferred_connection(self):
|
def get_preferred_connection(self):
|
||||||
"""Gets the preferred telepathy connection object that an activity
|
"""Gets the preferred telepathy connection object that an activity
|
||||||
|
Loading…
Reference in New Issue
Block a user