diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-08-08 23:08:19 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-08-08 23:08:19 (GMT) |
commit | c6d59fd7b44e65d33cb0a607c1321f1a62405aa2 (patch) | |
tree | cd4530dda13a53d66807e527a09c025a46db96b4 /sugar | |
parent | f1821704e708e85aeb8dc1132ff96ba6ea235395 (diff) |
Improve the activity api
Diffstat (limited to 'sugar')
-rw-r--r-- | sugar/activity/Activity.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/sugar/activity/Activity.py b/sugar/activity/Activity.py index cfb2794..ce036e9 100644 --- a/sugar/activity/Activity.py +++ b/sugar/activity/Activity.py @@ -52,12 +52,16 @@ class ActivityFactory(dbus.service.Object): def create_with_service(self, service_path): pservice = PresenceService() service = pservice.get(service_path) - activity = self._class(service) + + activity = self._class() + activity.set_default_type(self._default_type) + activity.join(service) @dbus.service.method("com.redhat.Sugar.ActivityFactory") def create(self): - activity = self._class(None) + activity = self._class() activity.set_default_type(self._default_type) + def create(activity_name, service = None): """Create a new activity from his name.""" @@ -121,13 +125,8 @@ class Activity(gtk.Window): def __init__(self, service = None): gtk.Window.__init__(self) - if service: - self._activity_id = service.get_activity_id() - self._shared = True - else: - self._activity_id = sugar.util.unique_id() - self._shared = False - + self._shared = False + self._activity_id = None self._default_type = None self._pservice = PresenceService() @@ -161,10 +160,17 @@ class Activity(gtk.Window): def get_id(self): """Get the unique activity identifier.""" + if self._activity_id == None: + self._activity_id = sugar.util.unique_id() return self._activity_id + def join(self, activity_ps): + """Join an activity shared on the network""" + self._shared = True + self._activity_id = activity_ps.get_id() + def share(self): - """Called to request the activity to share itself on the network.""" + """Share the activity on the network.""" properties = { 'title' : self.get_title() } self._service = self._pservice.share_activity(self, self._default_type, |