diff options
-rw-r--r-- | bin/sugar-launch | 17 | ||||
-rw-r--r-- | src/jarabe/service/gui.py | 10 |
2 files changed, 20 insertions, 7 deletions
diff --git a/bin/sugar-launch b/bin/sugar-launch index 7765ff1..68fe613 100644 --- a/bin/sugar-launch +++ b/bin/sugar-launch @@ -18,10 +18,11 @@ import os import sys +import dbus from optparse import OptionParser from sugar.activity import activityfactory -from sugar.activity.registry import get_registry +from sugar.bundle.activitybundle import ActivityBundle usage = "usage: %prog [options] activity" parser = OptionParser(usage) @@ -30,15 +31,17 @@ parser.add_option("-d", "--debug", action="store_true", dest="debug", (options, args) = parser.parse_args() if len(args) == 0: - print 'You need to specify the activity name or part of it.' + print 'You need to specify the activity bundle_id.' sys.exit(1) -registry = get_registry() -activities = registry.find_activity(args[0]) -if len(activities) == 0: - print 'Activity not found.' +bus = dbus.SessionBus() +proxy = bus.get_object('org.laptop.Shell', '/org/laptop/Shell') +path = dbus.Interface(proxy, 'org.laptop.Shell').GetBundlePath(args[0]) +if not path: + print 'Cannot find %s bundle.' % args[0] + sys.exit(1) -activity = activities[0] +activity = ActivityBundle(path) cmd_args = activityfactory.get_command(activity) def _which(exec_file): diff --git a/src/jarabe/service/gui.py b/src/jarabe/service/gui.py index 9bd4716..a2439ce 100644 --- a/src/jarabe/service/gui.py +++ b/src/jarabe/service/gui.py @@ -22,6 +22,7 @@ import gtk from jarabe.model import shell from jarabe.model import owner +from jarabe.model import bundleregistry _DBUS_SERVICE = "org.laptop.Shell" _DBUS_SHELL_IFACE = "org.laptop.Shell" @@ -68,6 +69,15 @@ class UIService(dbus.service.Object): self._cur_activity_changed_cb) @dbus.service.method(_DBUS_SHELL_IFACE, + in_signature="s", out_signature="s") + def GetBundlePath(self, bundle_id): + bundle = bundleregistry.get_registry().get_bundle(bundle_id) + if bundle: + return bundle.get_path() + else: + return '' + + @dbus.service.method(_DBUS_SHELL_IFACE, in_signature="s", out_signature="b") def ActivateActivity(self, activity_id): activity = self._shell_model.get_activity_by_id(activity_id) |