Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-12-18 13:24:28 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-12-18 13:24:28 (GMT)
commit6b09475b998cd15d0bf89831137968d48fc16f4e (patch)
tree34a10eae6fc076d30099638a5f2989c2065a8815 /sugar
parentad31376488836550a85e4d695fed9774981b3671 (diff)
Add a start method to the activity. It's parallel/alternative to join.
Diffstat (limited to 'sugar')
-rw-r--r--sugar/activity/Activity.py37
1 files changed, 22 insertions, 15 deletions
diff --git a/sugar/activity/Activity.py b/sugar/activity/Activity.py
index 1c77c7b..a9ce024 100644
--- a/sugar/activity/Activity.py
+++ b/sugar/activity/Activity.py
@@ -23,7 +23,7 @@ import dbus.service
import gtk
import gobject
-from sugar.presence.PresenceService import PresenceService
+from sugar.presence import PresenceService
from sugar import activity
from sugar import env
import sugar.util
@@ -44,22 +44,32 @@ class ActivityDbusService(dbus.service.Object):
The dbus service is separate from the actual Activity object so that we can
tightly control what stuff passes through the dbus python bindings."""
- def start(self, pservice, activity):
+ def __init__(self, activity):
+ xid = activity.window.xid
+ bus = dbus.SessionBus()
+ bus_name = dbus.service.BusName(get_service_name(xid), bus=bus)
+ dbus.service.Object.__init__(self, bus_name, get_object_path(xid))
+
self._activity = activity
- self._pservice = pservice
+ self._pservice = PresenceService.get_instance()
@dbus.service.method(ACTIVITY_INTERFACE)
- def share(self):
- """Called by the shell to request the activity to share itself on the network."""
- self._activity.share()
+ def start(self):
+ """Start the activity."""
+ self._activity.start()
@dbus.service.method(ACTIVITY_INTERFACE)
def join(self, activity_ps_path):
- """Join the activity specified by its presence service path"""
+ """Join the activity specified by its presence service path."""
activity_ps = self._pservice.get(activity_ps_path)
return self._activity.join(activity_ps)
@dbus.service.method(ACTIVITY_INTERFACE)
+ def share(self):
+ """Called by the shell to request the activity to share itself on the network."""
+ self._activity.share()
+
+ @dbus.service.method(ACTIVITY_INTERFACE)
def get_id(self):
"""Get the activity identifier"""
return self._activity.get_id()
@@ -90,7 +100,7 @@ class Activity(gtk.Window):
self._shared = False
self._activity_id = None
self._service = None
- self._pservice = PresenceService()
+ self._pservice = PresenceService.get_instance()
self.present()
@@ -98,12 +108,11 @@ class Activity(gtk.Window):
group.realize()
self.window.set_group(group.window)
- bus = dbus.SessionBus()
- xid = self.window.xid
+ self._bus = ActivityDbusService(self)
- bus_name = dbus.service.BusName(get_service_name(xid), bus=bus)
- self._bus = ActivityDbusService(bus_name, get_object_path(xid))
- self._bus.start(self._pservice, self)
+ def start(self):
+ """Start the activity."""
+ self._activity_id = sugar.util.unique_id()
def get_type(self):
"""Gets the activity type."""
@@ -119,8 +128,6 @@ 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):