diff options
Diffstat (limited to 'sugar')
-rw-r--r-- | sugar/activity/activityfactory.py | 13 | ||||
-rw-r--r-- | sugar/activity/bundle.py | 9 |
2 files changed, 14 insertions, 8 deletions
diff --git a/sugar/activity/activityfactory.py b/sugar/activity/activityfactory.py index a78c474..f9c3d6f 100644 --- a/sugar/activity/activityfactory.py +++ b/sugar/activity/activityfactory.py @@ -23,7 +23,6 @@ import gobject import gtk from sugar.presence import presenceservice -from sugar.activity import bundleregistry from sugar.activity.activityhandle import ActivityHandle from sugar import util @@ -75,9 +74,7 @@ class ActivityCreationHandler(gobject.GObject): def __init__(self, service_name, activity_handle): """Initialise the handler - service_name -- used to retrieve the activity bundle - from the global BundleRegistry. This is what - determines what activity will be run. + service_name -- the service name of the bundle factory activity_handle -- stores the values which are to be passed to the service to uniquely identify the activity to be created and the sharing @@ -100,16 +97,16 @@ class ActivityCreationHandler(gobject.GObject): self._service_name = service_name self._activity_handle = activity_handle - registry = bundleregistry.get_registry() - bundle = registry.get_bundle(service_name) - bus = dbus.SessionBus() - proxy_obj = bus.get_object(service_name, bundle.get_object_path(), follow_name_owner_changes=True) + object_path = '/' + service_name.replace('.', '/') + proxy_obj = bus.get_object(service_name, object_path, + follow_name_owner_changes=True) factory = dbus.Interface(proxy_obj, _ACTIVITY_FACTORY_INTERFACE) factory.create(self._activity_handle.get_dict(), reply_handler=self._reply_handler, error_handler=self._error_handler) + def get_activity_id(self): """Retrieve the unique identity for this activity""" return self._activity_handle.activity_id diff --git a/sugar/activity/bundle.py b/sugar/activity/bundle.py index d3c490f..1ef30dd 100644 --- a/sugar/activity/bundle.py +++ b/sugar/activity/bundle.py @@ -42,6 +42,7 @@ class Bundle: self._name = None self._icon = None self._service_name = None + self._mime_types = None self._show_launcher = True self._valid = True self._path = path @@ -91,6 +92,10 @@ class Bundle: self._valid = False logging.error('%s must specify exec or class' % self._path) + if cp.has_option(section, 'mime_types'): + mime_list = cp.get(section, 'show_launcher') + self._mime_types = mime_list.strip(';') + if cp.has_option(section, 'show_launcher'): if cp.get(section, 'show_launcher') == 'no': self._show_launcher = False @@ -166,6 +171,10 @@ class Bundle: """Get the main Activity class""" return self._class + def get_mime_types(self): + """Get the MIME types supported by the activity""" + return self._mime_types + def get_show_launcher(self): """Get whether there should be a visible launcher for the activity""" return self._show_launcher |