diff options
author | Simon Schampijer <simon@schampijer.de> | 2007-10-16 13:52:05 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@schampijer.de> | 2007-10-16 13:52:05 (GMT) |
commit | 664e8a636d158493d19aebb46be3f926662502da (patch) | |
tree | ada3665cd66077ebf933251807cc8d0c4871ed54 /lib | |
parent | 91f55488eba8f1376dd1719e3103d31465bb5371 (diff) | |
parent | de538ca0a84505f2d401ccfcc18c27e5ef074ecb (diff) |
Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sugar/activity/activity.py | 6 | ||||
-rw-r--r-- | lib/sugar/datastore/datastore.py | 20 |
2 files changed, 17 insertions, 9 deletions
diff --git a/lib/sugar/activity/activity.py b/lib/sugar/activity/activity.py index 4bb214f..8fceb6b 100644 --- a/lib/sugar/activity/activity.py +++ b/lib/sugar/activity/activity.py @@ -362,7 +362,7 @@ class Activity(Window, gtk.Container): return self._activity_id def get_bundle_id(self): - return _sugarbaseext.get_prgname() + return os.environ['SUGAR_BUNDLE_ID'] def set_canvas(self, canvas): Window.set_canvas(self, canvas) @@ -607,7 +607,7 @@ class Activity(Window, gtk.Container): def __realize_cb(self, window): wm.set_bundle_id(window.window, self.get_bundle_id()) - wm.set_activity_id(window.window, self._activity_id) + wm.set_activity_id(window.window, str(self._activity_id)) def __delete_event_cb(self, widget, event): self.close() @@ -624,7 +624,7 @@ class Activity(Window, gtk.Container): def get_bundle_name(): """Return the bundle name for the current process' bundle """ - return _sugarbaseext.get_application_name() + return os.environ['SUGAR_BUNDLE_NAME'] def get_bundle_path(): """Return the bundle path for the current process' bundle diff --git a/lib/sugar/datastore/datastore.py b/lib/sugar/datastore/datastore.py index a865c30..6f1e146 100644 --- a/lib/sugar/datastore/datastore.py +++ b/lib/sugar/datastore/datastore.py @@ -117,20 +117,28 @@ class DSObject(object): file_path = property(get_file_path, set_file_path) + def _get_activities_for_mime(self, mime_type): + registry = activity.get_registry() + result = registry.get_activities_for_type(mime_type) + if not result: + for parent_mime in mime.get_mime_parents(mime_type): + result.extend(registry.get_activities_for_type(parent_type)) + def get_activities(self): activities = [] - if self.metadata['activity']: - activity_info = activity.get_registry().get_activity(self.metadata['activity']) + bundle_id = self.metadata['activity'] + if bundle_id: + activity_info = activity.get_registry().get_activity(bundle_id) if activity_info: activities.append(activity_info) mime_type = self.metadata['mime_type'] if mime_type: - activities_info = activity.get_registry().get_activities_for_type(mime_type) - for activity_info in activities_info: - if activity_info.bundle_id != self.metadata['activity']: - activities.append(activity_info) + activities_info = self._get_activities_for_mime(mime_type) + for info in activities_info: + if activity_info.bundle_id != bundle_id: + activities.append(info) return activities |