diff options
author | Marco Pesenti Gritti <mpg@redhat.com> | 2007-02-21 23:57:49 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <mpg@redhat.com> | 2007-02-21 23:57:49 (GMT) |
commit | 0b6b6cd6acfedd3bfc326623ad0ccff21c5c4d5e (patch) | |
tree | cf895acdce9d1aa3ff11f875c361719a00d39ea4 /sugar/activity/activity.py | |
parent | 0d7bdeb20a6a807852a92aa5e854d1f5bfa9d82f (diff) |
Cleanup the Activity API, code needs more love.
Diffstat (limited to 'sugar/activity/activity.py')
-rw-r--r-- | sugar/activity/activity.py | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py index befcc31..3b7d9ce 100644 --- a/sugar/activity/activity.py +++ b/sugar/activity/activity.py @@ -26,16 +26,19 @@ from sugar import env class Activity(gtk.Window): """Base Activity class that all other Activities derive from.""" - def __init__(self, activity_handle): + def __init__(self, handle): gtk.Window.__init__(self) self.connect('destroy', self._destroy_cb) self._shared = False - self._activity_id = None - self._service = None + self._activity_id = handle.activity_id self._pservice = PresenceService.get_instance() + service = handle.get_presence_service() + if service: + self._join(service) + self.realize() group = gtk.Window() @@ -44,14 +47,6 @@ class Activity(gtk.Window): self._bus = ActivityService(self) - def start(self, activity_id): - """Start the activity.""" - if self._activity_id != None: - logging.warning('The activity has been already started.') - return - - self._activity_id = activity_id - self.present() def get_type(self): @@ -70,13 +65,8 @@ class Activity(gtk.Window): """Get the unique activity identifier.""" return self._activity_id - def join(self, activity_ps): - """Join an activity shared on the network.""" - if self._activity_id != None: - logging.warning('The activity has been already started.') - return - self._activity_id = activity_ps.get_id() - + def _join(self, service): + self._service = service self._shared = True # Publish the default service, it's a copy of @@ -103,10 +93,6 @@ class Activity(gtk.Window): self._service = self._pservice.share_activity(self, default_type) self._shared = True - def execute(self, command, args): - """Execute the given command with args""" - return False - def _destroy_cb(self, window): if self._bus: del self._bus |