From fc6ded013f0fb7b31429e6652def505fd1678199 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 09 Oct 2007 10:22:20 +0000 Subject: Remove activity services creation. --- diff --git a/services/shell/bundleregistry.py b/services/shell/bundleregistry.py index 54d5297..bf8a4f1 100644 --- a/services/shell/bundleregistry.py +++ b/services/shell/bundleregistry.py @@ -44,38 +44,6 @@ def _load_mime_defaults(): return defaults -class _ServiceManager(object): - """Internal class responsible for creating dbus service files - - DBUS services are defined in files which bind a service name - to the name of an executable which provides the service name. - - In Sugar, the service files are automatically generated from - the activity registry (by this class). When an activity's - dbus launch service is requested, dbus will launch the - specified executable in order to allow it to provide the - requested activity-launching service. - - In the case of activities which provide a "class", instead of - an "exec" attribute in their activity.info, the - sugar-activity-factory script is used with an appropriate - argument to service that bundle. - """ - SERVICE_DIRECTORY = '~/.local/share/dbus-1/services' - def __init__(self): - service_dir = os.path.expanduser(self.SERVICE_DIRECTORY) - if not os.path.isdir(service_dir): - os.makedirs(service_dir) - - self._path = service_dir - - def add(self, bundle): - util.write_service(bundle.get_service_name(), - bundle.get_command(), self._path) - - def remove(self, bundle): - util.delete_service(bundle.get_service_name(), self._path) - class BundleRegistry(gobject.GObject): """Service that tracks the available activity bundles""" @@ -91,7 +59,6 @@ class BundleRegistry(gobject.GObject): self._bundles = [] self._search_path = [] - self._service_manager = _ServiceManager() self._mime_defaults = _load_mime_defaults() def get_bundle(self, service_name): @@ -134,7 +101,6 @@ class BundleRegistry(gobject.GObject): return False self._bundles.append(bundle) - self._service_manager.add(bundle) self.emit('bundle-added', bundle) return True @@ -142,7 +108,6 @@ class BundleRegistry(gobject.GObject): for bundle in self._bundles: if bundle.get_path() == bundle_path: self._bundles.remove(bundle) - self._service_manager.remove(bundle) self.emit('bundle-removed', bundle) return True return False diff --git a/sugar/util.py b/sugar/util.py index 2780427..8a3fb4a 100644 --- a/sugar/util.py +++ b/sugar/util.py @@ -73,53 +73,6 @@ def validate_activity_id(actid): return False return True -class _ServiceParser(ConfigParser): - def optionxform(self, option): - return option - -def write_service(name, bin, path): - """Write a D-BUS service definition file - - These are written by the bundleregistry when - a new activity is registered. They bind a - D-BUS bus-name with an executable which is - to provide the named service. - - name -- D-BUS service name, must be a valid - filename/D-BUS name - bin -- executable providing named service - path -- directory into which to write the - name.service file - - The service files themselves are written using - the _ServiceParser class, which is a subclass - of the standard ConfigParser class. - """ - service_cp = _ServiceParser() - section = 'D-BUS Service' - service_cp.add_section(section) - service_cp.set(section, 'Name', name) - service_cp.set(section, 'Exec', bin) - - dest_filename = os.path.join(path, name + '.service') - fileobject = open(dest_filename, 'w') - service_cp.write(fileobject) - fileobject.close() - -def delete_service(name, path): - """Delete a D-BUS service definition file - - Deletes a D-BUS service file previously - created by write_service(). - - name -- D-BUS service name, must be a valid - filename/D-BUS name - path -- directory containing the name.service - file - """ - - os.remove(os.path.join(path, name + '.service')) - def set_proc_title(title): """Sets the process title so ps and top show more descriptive names. This does not modify argv[0] -- cgit v0.9.1