From a56282991f68cd585027042a5d4b030391014bb9 Mon Sep 17 00:00:00 2001 From: Sam Parkinson Date: Wed, 6 May 2015 21:43:30 +1000 Subject: [PATCH] Add ability to launch a bundle This commit adds the `launch_bundle` function in `sugar3.activity. activity` which accesses the same function in the shell is over dbus. This is means the shell process launches the bundle. Activities should not launch child processes as per the Rainbow security model [1]. [1] http://wiki.laptop.org/go/Rainbow --- src/sugar3/activity/activity.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/sugar3/activity/activity.py b/src/sugar3/activity/activity.py index d56c6203..33cf2512 100644 --- a/src/sugar3/activity/activity.py +++ b/src/sugar3/activity/activity.py @@ -1159,3 +1159,10 @@ def show_object_in_journal(object_id): obj = bus.get_object(J_DBUS_SERVICE, J_DBUS_PATH) journal = dbus.Interface(obj, J_DBUS_INTERFACE) journal.ShowObject(object_id) + + +def launch_bundle(bundle_id='', object_id=''): + bus = dbus.SessionBus() + obj = bus.get_object(J_DBUS_SERVICE, J_DBUS_PATH) + bundle_launcher = dbus.Interface(obj, J_DBUS_INTERFACE) + return bundle_launcher.LaunchBundle(bundle_id, object_id)