Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/model/MeshModel.py12
-rw-r--r--sugar/activity/bundleregistry.py7
2 files changed, 14 insertions, 5 deletions
diff --git a/shell/model/MeshModel.py b/shell/model/MeshModel.py
index 5ab36e9..a261156 100644
--- a/shell/model/MeshModel.py
+++ b/shell/model/MeshModel.py
@@ -24,12 +24,13 @@ class ActivityModel:
def __init__(self, activity, bundle, service):
self._service = service
self._activity = activity
+ self._bundle = bundle
def get_id(self):
return self._activity.get_id()
def get_icon_name(self):
- return bundle.get_icon()
+ return self._bundle.get_icon()
def get_color(self):
return IconColor(self._activity.get_color())
@@ -121,12 +122,14 @@ class MeshModel(gobject.GObject):
self._check_service(service)
def _check_service(self, service):
- if self._bundle_registry.get_bundle(service.get_type()) != None:
+ service_type = service.get_type()
+ bundle = self._bundle_registry.find_by_default_type(service_type)
+ if bundle != None:
activity_id = service.get_activity_id()
if not self.has_activity(activity_id):
activity = self._pservice.get_activity(activity_id)
if activity != None:
- self.add_activity(activity, service)
+ self.add_activity(bundle, activity, service)
def has_activity(self, activity_id):
return self._activities.has_key(activity_id)
@@ -137,8 +140,7 @@ class MeshModel(gobject.GObject):
else:
return None
- def add_activity(self, activity, service):
- bundle = self._bundle_registry.get_bundle(service.get_type())
+ def add_activity(self, bundle, activity, service):
model = ActivityModel(activity, bundle, service)
self._activities[model.get_id()] = model
self.emit('activity-added', model)
diff --git a/sugar/activity/bundleregistry.py b/sugar/activity/bundleregistry.py
index aa7d70a..8b7c44a 100644
--- a/sugar/activity/bundleregistry.py
+++ b/sugar/activity/bundleregistry.py
@@ -33,6 +33,13 @@ class BundleRegistry:
else:
return None
+ def find_by_default_type(self, default_type):
+ """Find a bundle by the network service default type"""
+ for bundle in self._bundles.values():
+ if bundle.get_default_type() == default_type:
+ return bundle
+ return None
+
def add_search_path(self, path):
"""Add a directory to the bundles search path"""
self._search_path.append(path)