Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-02-21 16:53:44 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-02-21 16:53:44 (GMT)
commit7db372cc1cdc2d2c19af83c9566b14fa406a73a2 (patch)
tree8cce2afe9dd3f4a0447dddb3eed3b9ccacc92d92 /shell
parentf5b13b716e86f18d0d9c624b9381d9d721b4c892 (diff)
Make bundle registry a singleton. Get the object path from the registry.
Diffstat (limited to 'shell')
-rw-r--r--shell/model/MeshModel.py5
-rw-r--r--shell/model/ShellModel.py15
-rw-r--r--shell/model/homemodel.py6
-rw-r--r--shell/view/frame/ActivitiesBox.py3
4 files changed, 10 insertions, 19 deletions
diff --git a/shell/model/MeshModel.py b/shell/model/MeshModel.py
index a261156..6c9f883 100644
--- a/shell/model/MeshModel.py
+++ b/shell/model/MeshModel.py
@@ -18,6 +18,7 @@ import gobject
from sugar.graphics.iconcolor import IconColor
from sugar.presence import PresenceService
+from sugar.activity import bundleregistry
from model.BuddyModel import BuddyModel
class ActivityModel:
@@ -53,12 +54,12 @@ class MeshModel(gobject.GObject):
gobject.TYPE_NONE, ([gobject.TYPE_PYOBJECT]))
}
- def __init__(self, bundle_registry):
+ def __init__(self):
gobject.GObject.__init__(self)
self._activities = {}
self._buddies = {}
- self._bundle_registry = bundle_registry
+ self._bundle_registry = bundleregistry.get_registry()
self._pservice = PresenceService.get_instance()
self._pservice.connect("service-appeared",
diff --git a/shell/model/ShellModel.py b/shell/model/ShellModel.py
index abfff21..4c0df12 100644
--- a/shell/model/ShellModel.py
+++ b/shell/model/ShellModel.py
@@ -44,8 +44,6 @@ class ShellModel(gobject.GObject):
self._current_activity = None
self._state = self.STATE_RUNNING
- self._bundle_registry = BundleRegistry()
-
PresenceService.start()
self._pservice = PresenceService.get_instance()
@@ -53,16 +51,10 @@ class ShellModel(gobject.GObject):
self._owner.announce()
self._friends = Friends()
- self._mesh = MeshModel(self._bundle_registry)
- self._home = HomeModel(self._bundle_registry)
+ self._mesh = MeshModel()
+ self._home = HomeModel()
self._devices = DevicesModel()
- for path in env.get_data_dirs():
- bundles_path = os.path.join(path, 'activities')
- self._bundle_registry.add_search_path(bundles_path)
-
- self._bundle_registry.add_search_path(env.get_user_activities_dir())
-
def do_set_property(self, pspec, value):
if pspec.name == 'state':
self._state = value
@@ -71,9 +63,6 @@ class ShellModel(gobject.GObject):
if pspec.name == 'state':
return self._state
- def get_bundle_registry(self):
- return self._bundle_registry
-
def get_mesh(self):
return self._mesh
diff --git a/shell/model/homemodel.py b/shell/model/homemodel.py
index bc45a0a..ff04dfc 100644
--- a/shell/model/homemodel.py
+++ b/shell/model/homemodel.py
@@ -21,7 +21,7 @@ import wnck
import dbus
from model.homeactivity import HomeActivity
-from sugar.activity import Activity
+from sugar.activity import bundleregistry
_ACTIVITY_SERVICE_NAME = "org.laptop.Activity"
_ACTIVITY_SERVICE_PATH = "/org/laptop/Activity"
@@ -43,11 +43,11 @@ class HomeModel(gobject.GObject):
([gobject.TYPE_PYOBJECT]))
}
- def __init__(self, bundle_registry):
+ def __init__(self):
gobject.GObject.__init__(self)
self._activities = {}
- self._bundle_registry = bundle_registry
+ self._bundle_registry = bundleregistry.get_registry()
self._current_activity = None
screen = wnck.screen_get_default()
diff --git a/shell/view/frame/ActivitiesBox.py b/shell/view/frame/ActivitiesBox.py
index 196309d..ea64b7f 100644
--- a/shell/view/frame/ActivitiesBox.py
+++ b/shell/view/frame/ActivitiesBox.py
@@ -21,6 +21,7 @@ from sugar.graphics import units
from sugar.graphics.iconcolor import IconColor
from sugar.graphics.iconbutton import IconButton
from sugar.presence import PresenceService
+from sugar.activity import bundleregistry
from sugar import profile
class ActivityButton(IconButton):
@@ -63,7 +64,7 @@ class ActivitiesBox(hippo.CanvasBox):
self._invite_to_item = {}
self._invites = self._shell_model.get_invites()
- bundle_registry = self._shell_model.get_bundle_registry()
+ bundle_registry = bundleregistry.get_registry()
for bundle in bundle_registry:
if bundle.get_show_launcher():
self.add_activity(bundle)