Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/activity
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2007-08-27 19:51:55 (GMT)
committer John (J5) Palmieri <johnp@redhat.com>2007-08-27 19:51:55 (GMT)
commitf5f95f4d7b84f5fe09499c6c4d75d1a06e1bbcb6 (patch)
tree9f8bf94d05c550d0a2ef4d533e8be814e6fe668d /sugar/activity
parentc06d63948794cce11e5b59e98f2ec2122a433972 (diff)
parent7fcc23b4c8c36b28f2e17904c1a64244fdd553b6 (diff)
Merge branch 'master' of git+ssh://j5@dev.laptop.org/git/sugar
Diffstat (limited to 'sugar/activity')
-rw-r--r--sugar/activity/activity.py25
-rw-r--r--sugar/activity/activityfactory.py29
2 files changed, 42 insertions, 12 deletions
diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py
index ccc8b90..6655b24 100644
--- a/sugar/activity/activity.py
+++ b/sugar/activity/activity.py
@@ -75,9 +75,9 @@ class ActivityToolbar(gtk.Toolbar):
self.share = ToolComboBox(label_text='Share with:')
self.share.combo.connect('changed', self._share_changed_cb)
self.share.combo.append_item(None, _('Private'),
- 'theme:zoom-home-mini')
+ 'zoom-home-mini')
self.share.combo.append_item(None, _('My Neighborhood'),
- 'theme:zoom-neighborhood-mini')
+ 'zoom-neighborhood-mini')
self.insert(self.share, -1)
self.share.show()
@@ -469,13 +469,22 @@ class Activity(Window, gtk.Container):
self._shared_activity = activity
self.emit('shared')
- def share(self):
- """Request that the activity be shared on the network."""
+ def share(self, private=False):
+ """Request that the activity be shared on the network.
+
+ private -- bool: True to share by invitation only,
+ False to advertise as shared to everyone.
+ """
+ # FIXME: Make private=True to turn on the by-invitation-only scope
if self._shared_activity and self._shared_activity.props.joined:
- raise RuntimeError("Activity %s already shared." % self._activity_id)
- logging.debug('Requesting share of activity %s.' % self._activity_id)
- self._share_id = self._pservice.connect("activity-shared", self._internal_share_cb)
- self._pservice.share_activity(self)
+ raise RuntimeError("Activity %s already shared." %
+ self._activity_id)
+ verb = private and 'private' or 'public'
+ logging.debug('Requesting %s share of activity %s.' %
+ (verb, self._activity_id))
+ self._share_id = self._pservice.connect("activity-shared",
+ self._internal_share_cb)
+ self._pservice.share_activity(self, private=private)
def _realize_cb(self, window):
wm.set_bundle_id(window.window, self.get_service_name())
diff --git a/sugar/activity/activityfactory.py b/sugar/activity/activityfactory.py
index 404e5f4..d7d6d92 100644
--- a/sugar/activity/activityfactory.py
+++ b/sugar/activity/activityfactory.py
@@ -26,12 +26,18 @@ from sugar.presence import presenceservice
from sugar.activity.activityhandle import ActivityHandle
from sugar import util
+import os
+
_SHELL_SERVICE = "org.laptop.Shell"
_SHELL_PATH = "/org/laptop/Shell"
_SHELL_IFACE = "org.laptop.Shell"
_ACTIVITY_FACTORY_INTERFACE = "org.laptop.ActivityFactory"
+_RAINBOW_SERVICE_NAME = "org.laptop.security.Rainbow"
+_RAINBOW_ACTIVITY_FACTORY_PATH = "/"
+_RAINBOW_ACTIVITY_FACTORY_INTERFACE = "org.laptop.security.Rainbow"
+
def create_activity_id():
"""Generate a new, unique ID for this activity"""
pservice = presenceservice.get_instance()
@@ -84,6 +90,9 @@ class ActivityCreationHandler(gobject.GObject):
particular type of activity is created during the activity
registration process in shell bundle registry which creates
service definition files for each registered bundle type.
+
+ If the file '/etc/olpc-security' exists, then activity launching
+ will be delegated to the prototype 'Rainbow' security service.
"""
gobject.GObject.__init__(self)
self._service_name = service_name
@@ -112,10 +121,22 @@ class ActivityCreationHandler(gobject.GObject):
reply_handler=self._no_reply_handler,
error_handler=self._notify_launch_error_handler)
- self._factory.create(self._activity_handle.get_dict(),
- timeout=120 * 1000,
- reply_handler=self._no_reply_handler,
- error_handler=self._create_error_handler)
+ if not os.path.exists('/etc/olpc-security'):
+ self._factory.create(self._activity_handle.get_dict(),
+ timeout=120 * 1000,
+ reply_handler=self._no_reply_handler,
+ error_handler=self._create_error_handler)
+ else:
+ system_bus = dbus.SystemBus()
+ factory = system_bus.get_object(_RAINBOW_SERVICE_NAME,
+ _RAINBOW_ACTIVITY_FACTORY_PATH)
+ factory.CreateActivity(
+ self._service_name,
+ self._activity_handle.get_dict(),
+ timeout=120 * 1000,
+ reply_handler=self._create_reply_handler,
+ error_handler=self._create_error_handler,
+ dbus_interface=_RAINBOW_ACTIVITY_FACTORY_INTERFACE)
def get_activity_id(self):
"""Retrieve the unique identity for this activity"""