Complete move to external bundle registry.
This commit is contained in:
@@ -296,11 +296,8 @@ class Bundle:
|
||||
raise ZipExtractException
|
||||
|
||||
self._init_with_path(bundle_path)
|
||||
|
||||
bus = dbus.SessionBus()
|
||||
proxy_obj = bus.get_object(_DBUS_SHELL_SERVICE, _DBUS_SHELL_PATH)
|
||||
dbus_service = dbus.Interface(proxy_obj, _DBUS_ACTIVITY_REGISTRY_IFACE)
|
||||
if not dbus_service.AddBundle(bundle_path):
|
||||
|
||||
if not activity.get_registry().add_bundle(bundle_path):
|
||||
raise RegistrationException
|
||||
|
||||
def deinstall(self):
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
import logging
|
||||
|
||||
import dbus
|
||||
import gobject
|
||||
|
||||
_ACTIVITY_REGISTRY_SERVICE_NAME = 'org.laptop.ActivityRegistry'
|
||||
_ACTIVITY_REGISTRY_IFACE = 'org.laptop.ActivityRegistry'
|
||||
@@ -28,17 +29,25 @@ def _activity_info_from_dict(info_dict):
|
||||
if not info_dict:
|
||||
return None
|
||||
return ActivityInfo(info_dict['name'], info_dict['icon'],
|
||||
info_dict['service_name'], info_dict['path'])
|
||||
info_dict['service_name'], info_dict['path'],
|
||||
info_dict['show_launcher'])
|
||||
|
||||
class ActivityInfo(object):
|
||||
def __init__(self, name, icon, service_name, path):
|
||||
def __init__(self, name, icon, service_name, path, show_launcher):
|
||||
self.name = name
|
||||
self.icon = icon
|
||||
self.service_name = service_name
|
||||
self.path = path
|
||||
self.show_launcher = show_launcher
|
||||
|
||||
class ActivityRegistry(object):
|
||||
class ActivityRegistry(gobject.GObject):
|
||||
__gsignals__ = {
|
||||
'activity-added': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
||||
([gobject.TYPE_PYOBJECT]))
|
||||
}
|
||||
def __init__(self):
|
||||
gobject.GObject.__init__(self)
|
||||
|
||||
bus = dbus.SessionBus()
|
||||
bus_object = bus.get_object(_ACTIVITY_REGISTRY_SERVICE_NAME,
|
||||
_ACTIVITY_REGISTRY_PATH)
|
||||
@@ -57,6 +66,10 @@ class ActivityRegistry(object):
|
||||
|
||||
return result
|
||||
|
||||
def get_activities(self):
|
||||
info_list = self._registry.GetActivities()
|
||||
return self._convert_info_list(info_list)
|
||||
|
||||
def get_activity(self, service_name):
|
||||
if self._service_name_to_activity_info.has_key(service_name):
|
||||
return self._service_name_to_activity_info[service_name]
|
||||
@@ -81,10 +94,14 @@ class ActivityRegistry(object):
|
||||
self._mime_type_to_activities[mime_type] = activities
|
||||
return activities
|
||||
|
||||
def _activity_added_cb(self, bundle):
|
||||
def add_bundle(self, bundle_path):
|
||||
return self._registry.AddBundle(bundle_path)
|
||||
|
||||
def _activity_added_cb(self, info_dict):
|
||||
logging.debug('ActivityRegistry._activity_added_cb: flushing caches')
|
||||
self._service_name_to_activity_info.clear()
|
||||
self._mime_type_to_activities.clear()
|
||||
self.emit('activity-added', _activity_info_from_dict(info_dict))
|
||||
|
||||
_registry = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user