Handle invitations inside Activity.
This commit is contained in:
parent
6ff3486f42
commit
fdb9c57e65
@ -64,16 +64,13 @@ class ActivityHost:
|
|||||||
def get_model(self):
|
def get_model(self):
|
||||||
return self._model
|
return self._model
|
||||||
|
|
||||||
def invite(self, buddy):
|
def invite(self, buddy_model):
|
||||||
pservice = presenceservice.get_instance()
|
service = self._model.get_service()
|
||||||
activity = pservice.get_activity(self.get_id())
|
if service:
|
||||||
if activity is None:
|
buddy = buddy_model.get_buddy()
|
||||||
logging.error('Invite failed, %s is unknown.' % self.get_id())
|
service.Invite(buddy.props.key)
|
||||||
activity.invite(buddy.get_buddy(), '', self._invite_response_cb)
|
else:
|
||||||
|
logging.error('Invite failed, activity service not ')
|
||||||
def _invite_response_cb(self, error):
|
|
||||||
if error:
|
|
||||||
logging.error('Invite failed: %s' % error)
|
|
||||||
|
|
||||||
def present(self):
|
def present(self):
|
||||||
# wnck.Window.activate() expects a timestamp, but we don't
|
# wnck.Window.activate() expects a timestamp, but we don't
|
||||||
|
@ -543,6 +543,20 @@ class Activity(Window, gtk.Container):
|
|||||||
# FIXME: some way to distinguish between share scopes
|
# FIXME: some way to distinguish between share scopes
|
||||||
self._jobject.metadata['share-scope'] = SCOPE_NEIGHBORHOOD
|
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):
|
def share(self, private=False):
|
||||||
"""Request that the activity be shared on the network.
|
"""Request that the activity be shared on the network.
|
||||||
|
|
||||||
|
@ -59,3 +59,8 @@ class ActivityService(dbus.service.Object):
|
|||||||
def SetActive(self, active):
|
def SetActive(self, active):
|
||||||
logging.debug('ActivityService.set_active: %s.' % active)
|
logging.debug('ActivityService.set_active: %s.' % active)
|
||||||
self._activity.props.active = active
|
self._activity.props.active = active
|
||||||
|
|
||||||
|
@dbus.service.method(_ACTIVITY_INTERFACE)
|
||||||
|
def Invite(self, buddy_key):
|
||||||
|
self._activity.invite(buddy_key)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user