diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-01-27 11:54:56 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-01-27 11:54:56 (GMT) |
commit | 9d13a9836d10e8ef5d2dda4dff6a7931ca2af728 (patch) | |
tree | b05c8b37576e56201ebb6fb7b030e3c018da35f5 /shell | |
parent | 37c6c1e9fa9b42d7a65f2234eac61307352887c2 (diff) |
Added new tool sugar-install-bundle.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/model/ShellModel.py | 3 | ||||
-rw-r--r-- | shell/shellservice.py | 19 | ||||
-rwxr-xr-x | shell/sugar-shell | 2 | ||||
-rw-r--r-- | shell/view/frame/ActivitiesBox.py | 8 |
4 files changed, 29 insertions, 3 deletions
diff --git a/shell/model/ShellModel.py b/shell/model/ShellModel.py index b1c21bc..11254d9 100644 --- a/shell/model/ShellModel.py +++ b/shell/model/ShellModel.py @@ -55,8 +55,7 @@ class ShellModel(gobject.GObject): self._mesh = MeshModel(self._bundle_registry) self._home = HomeModel(self._bundle_registry) - path = os.path.expanduser('~/Activities') - self._bundle_registry.add_search_path(path) + self._bundle_registry.add_search_path(env.get_user_activities_dir()) for path in env.get_data_dirs(): bundles_path = os.path.join(path, 'activities') diff --git a/shell/shellservice.py b/shell/shellservice.py new file mode 100644 index 0000000..dcbfc0e --- /dev/null +++ b/shell/shellservice.py @@ -0,0 +1,19 @@ +import dbus + +_DBUS_SERVICE = "org.laptop.Shell" +_DBUS_INTERFACE = "org.laptop.Shell" +_DBUS_PATH = "/org/laptop/Shell" + +class ShellService(dbus.service.Object): + + def __init__(self, shellModel): + self._shellModel = shellModel + + bus = dbus.SessionBus() + bus_name = dbus.service.BusName(_DBUS_SERVICE, bus=bus) + dbus.service.Object.__init__(self, bus_name, _DBUS_PATH) + + @dbus.service.method(_DBUS_INTERFACE, in_signature="s", out_signature="b") + def add_bundle(self, bundle_path): + registry = self._shellModel.get_bundle_registry() + return registry.add_bundle(bundle_path) diff --git a/shell/sugar-shell b/shell/sugar-shell index 4eaccf5..08a3a6d 100755 --- a/shell/sugar-shell +++ b/shell/sugar-shell @@ -37,6 +37,7 @@ sys.path.insert(0, os.path.join(env.get_data_dir(), 'shell')) from view.FirstTimeDialog import FirstTimeDialog from view.Shell import Shell from model.ShellModel import ShellModel +from shellservice import ShellService name = profile.get_nick_name() if not name or not len(name): @@ -54,6 +55,7 @@ f.write(os.environ["DBUS_SESSION_BUS_ADDRESS"]) f.close() model = ShellModel() +service = ShellService(model) shell = Shell(model) # Start the NetworkManager applet diff --git a/shell/view/frame/ActivitiesBox.py b/shell/view/frame/ActivitiesBox.py index 2ca0cfd..c265b6c 100644 --- a/shell/view/frame/ActivitiesBox.py +++ b/shell/view/frame/ActivitiesBox.py @@ -69,10 +69,13 @@ class ActivitiesBox(hippo.CanvasBox): self._invite_to_item = {} self._invites = self._shell_model.get_invites() - for bundle in self._shell_model.get_bundle_registry(): + bundle_registry = self._shell_model.get_bundle_registry() + for bundle in bundle_registry: if bundle.get_show_launcher(): self.add_activity(bundle) + bundle_registry.connect('bundle-added', self._bundle_added_cb) + for invite in self._invites: self.add_invite(invite) self._invites.connect('invite-added', self._invite_added_cb) @@ -92,6 +95,9 @@ class ActivitiesBox(hippo.CanvasBox): def _invite_removed_cb(self, invites, invite): self.remove_invite(invite) + def _bundle_added_cb(self, bundle_registry, bundle): + self.add_activity(bundle) + def add_activity(self, activity): item = ActivityItem(activity) item.connect('activated', self._activity_clicked_cb) |