Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-10-09 11:15:06 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-10-09 11:15:06 (GMT)
commit6073a396b36c7d3da15ee361b601e94b010c6e92 (patch)
treee862e652c460ab193c558535f86316c687ff140c /sugar
parent57961d17bcb41d6606ea3c5293473b49da705d3c (diff)
Rename activity service_name to bundle_id
Diffstat (limited to 'sugar')
-rw-r--r--sugar/activity/activity.py6
-rw-r--r--sugar/activity/activityfactory.py4
-rw-r--r--sugar/activity/bundlebuilder.py8
-rw-r--r--sugar/activity/registry.py6
-rw-r--r--sugar/bundle/activitybundle.py23
-rw-r--r--sugar/datastore/datastore.py4
-rw-r--r--sugar/presence/presenceservice.py2
7 files changed, 29 insertions, 24 deletions
diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py
index ca71110..a7ae905 100644
--- a/sugar/activity/activity.py
+++ b/sugar/activity/activity.py
@@ -299,7 +299,7 @@ class Activity(Window, gtk.Container):
self._jobject.metadata['title'] = _('%s Activity') % get_bundle_name()
self.set_title(self._jobject.metadata['title'])
self._jobject.metadata['title_set_by_user'] = '0'
- self._jobject.metadata['activity'] = self.get_service_name()
+ self._jobject.metadata['activity'] = self.get_bundle_id()
self._jobject.metadata['activity_id'] = self.get_id()
self._jobject.metadata['keep'] = '0'
self._jobject.metadata['preview'] = ''
@@ -362,7 +362,7 @@ class Activity(Window, gtk.Container):
def get_id(self):
return self._activity_id
- def get_service_name(self):
+ def get_bundle_id(self):
return _sugarext.get_prgname()
def set_canvas(self, canvas):
@@ -594,7 +594,7 @@ class Activity(Window, gtk.Container):
self._pservice.share_activity(self, private=private)
def _realize_cb(self, window):
- wm.set_bundle_id(window.window, self.get_service_name())
+ wm.set_bundle_id(window.window, self.get_bundle_id())
wm.set_activity_id(window.window, self._activity_id)
def _delete_event_cb(self, window, event):
diff --git a/sugar/activity/activityfactory.py b/sugar/activity/activityfactory.py
index 6554755..d5936e9 100644
--- a/sugar/activity/activityfactory.py
+++ b/sugar/activity/activityfactory.py
@@ -158,6 +158,7 @@ class ActivityCreationHandler(gobject.GObject):
env['PATH'] = bin_path + ':' + env['PATH']
command = activity.command
+ command += ' -b %s' % activity.bundle_id
if self._handle.activity_id is not None:
command += ' -a %s' % self._handle.activity_id
if self._handle.object_id is not None:
@@ -165,7 +166,8 @@ class ActivityCreationHandler(gobject.GObject):
if self._handle.uri is not None:
command += ' -u %s' % self._handle.uri
- process = subprocess.Popen(command, env=env, shell=True)
+ process = subprocess.Popen(command, env=env, shell=True,
+ cwd=activity.path)
else:
system_bus = dbus.SystemBus()
factory = system_bus.get_object(_RAINBOW_SERVICE_NAME,
diff --git a/sugar/activity/bundlebuilder.py b/sugar/activity/bundlebuilder.py
index a1f6c4b..c2e3278 100644
--- a/sugar/activity/bundlebuilder.py
+++ b/sugar/activity/bundlebuilder.py
@@ -107,9 +107,9 @@ def _delete_backups(arg, dirname, names):
if name.endswith('~') or name.endswith('pyc'):
os.remove(os.path.join(dirname, name))
-def _get_service_name():
+def _get_bundle_id():
bundle = ActivityBundle(_get_source_path())
- return bundle.get_service_name()
+ return bundle.get_bundle_id()
def cmd_help():
print 'Usage: \n\
@@ -162,7 +162,7 @@ def _get_l10n_list(manifest):
l10n_list = []
for lang in _get_po_list(manifest).keys():
- filename = _get_service_name() + '.mo'
+ filename = _get_bundle_id() + '.mo'
l10n_list.append(os.path.join('locale', lang, 'LC_MESSAGES', filename))
l10n_list.append(os.path.join('locale', lang, 'activity.linfo'))
@@ -256,7 +256,7 @@ def cmd_genl10n(bundle_name, manifest):
if not os.path.isdir(mo_path):
os.makedirs(mo_path)
- mo_file = os.path.join(mo_path, "%s.mo" % _get_service_name())
+ mo_file = os.path.join(mo_path, "%s.mo" % _get_bundle_id())
args = ["msgfmt", "--output-file=%s" % mo_file, file_name]
retcode = subprocess.call(args)
if retcode:
diff --git a/sugar/activity/registry.py b/sugar/activity/registry.py
index b873821..a279aa9 100644
--- a/sugar/activity/registry.py
+++ b/sugar/activity/registry.py
@@ -29,15 +29,15 @@ 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['bundle_id'], info_dict['path'],
info_dict['show_launcher'], info_dict['command'])
class ActivityInfo(object):
- def __init__(self, name, icon, service_name,
+ def __init__(self, name, icon, bundle_id,
path, show_launcher, command):
self.name = name
self.icon = icon
- self.service_name = service_name
+ self.bundle_id = bundle_id
self.path = path
self.command = command
self.show_launcher = show_launcher
diff --git a/sugar/bundle/activitybundle.py b/sugar/bundle/activitybundle.py
index 3e21389..8ba61fe 100644
--- a/sugar/bundle/activitybundle.py
+++ b/sugar/bundle/activitybundle.py
@@ -46,7 +46,7 @@ class ActivityBundle(Bundle):
self._name = None
self._icon = None
- self._service_name = None
+ self._bundle_id = None
self._mime_types = None
self._show_launcher = True
self._activity_version = 0
@@ -66,11 +66,14 @@ class ActivityBundle(Bundle):
section = 'Activity'
- if cp.has_option(section, 'service_name'):
- self._service_name = cp.get(section, 'service_name')
+ if cp.has_option(section, 'bundle_id'):
+ self._bundle_id = cp.get(section, 'bundle_id')
+ # FIXME deprecated
+ elif cp.has_option(section, 'service_name'):
+ self._bundle_id = cp.get(section, 'service_name')
else:
raise MalformedBundleException(
- 'Activity bundle %s does not specify a service name' %
+ 'Activity bundle %s does not specify a bundle id' %
self._path)
if cp.has_option(section, 'name'):
@@ -155,9 +158,9 @@ class ActivityBundle(Bundle):
"""Get the activity user visible name."""
return self._name
- def get_service_name(self):
- """Get the activity service name"""
- return self._service_name
+ def get_bundle_id(self):
+ """Get the activity bundle id"""
+ return self._bundle_id
# FIXME: this should return the icon data, not a filename, so that
# we don't need to create a temp file in the zip case
@@ -196,7 +199,7 @@ class ActivityBundle(Bundle):
return self._show_launcher
def is_installed(self):
- if activity.get_registry().get_activity(self._service_name):
+ if activity.get_registry().get_activity(self._bundle_id):
return True
else:
return False
@@ -218,7 +221,7 @@ class ActivityBundle(Bundle):
mime_pkg_dir = os.path.join(mime_dir, 'packages')
if not os.path.isdir(mime_pkg_dir):
os.makedirs(mime_pkg_dir)
- installed_mime_path = os.path.join(mime_pkg_dir, '%s.xml' % self._service_name)
+ installed_mime_path = os.path.join(mime_pkg_dir, '%s.xml' % self._bundle_id)
os.symlink(mime_path, installed_mime_path)
os.spawnlp(os.P_WAIT, 'update-mime-database',
'update-mime-database', mime_dir)
@@ -259,7 +262,7 @@ class ActivityBundle(Bundle):
xdg_data_home = os.getenv('XDG_DATA_HOME', os.path.expanduser('~/.local/share'))
mime_dir = os.path.join(xdg_data_home, 'mime')
- installed_mime_path = os.path.join(mime_dir, 'packages', '%s.xml' % self._service_name)
+ installed_mime_path = os.path.join(mime_dir, 'packages', '%s.xml' % self._bundle_id)
if os.path.exists(installed_mime_path):
os.remove(installed_mime_path)
os.spawnlp(os.P_WAIT, 'update-mime-database',
diff --git a/sugar/datastore/datastore.py b/sugar/datastore/datastore.py
index 7c1b57b..c82ab39 100644
--- a/sugar/datastore/datastore.py
+++ b/sugar/datastore/datastore.py
@@ -129,7 +129,7 @@ class DSObject(object):
if mime_type:
activities_info = activity.get_registry().get_activities_for_type(mime_type)
for activity_info in activities_info:
- if activity_info.service_name != self.metadata['activity']:
+ if activity_info.bundle_id != self.metadata['activity']:
activities.append(activity_info)
return activities
@@ -155,7 +155,7 @@ class DSObject(object):
if not bundle.is_installed():
bundle.install()
- activityfactory.create(bundle.get_service_name())
+ activityfactory.create(bundle.get_bundle_id())
else:
if not self.get_activities() and service_name is None:
logging.warning('No activity can open this object.')
diff --git a/sugar/presence/presenceservice.py b/sugar/presence/presenceservice.py
index b46b2fa..e652f42 100644
--- a/sugar/presence/presenceservice.py
+++ b/sugar/presence/presenceservice.py
@@ -467,7 +467,7 @@ class PresenceService(gobject.GObject):
raise RuntimeError("Activity %s is already shared." %
actid)
- atype = activity.get_service_name()
+ atype = activity.get_bundle_id()
name = activity.props.title
self._ps.ShareActivity(actid, atype, name, properties,
reply_handler=lambda op: \