From d0cd8e27bdd3ef6745f2ec1ff02cc191ffbd2af8 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Mon, 06 Oct 2008 14:31:52 +0000 Subject: Fix sugar-ui-check. Load activities from system path. --- diff --git a/bin/.gitignore b/bin/.gitignore index b86c1c9..9e78b64 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -1,2 +1 @@ -sugar sugar-shell-service diff --git a/bin/sugar-shell-service.in b/bin/sugar-shell-service.in deleted file mode 100644 index 49c2764..0000000 --- a/bin/sugar-shell-service.in +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python -# Copyright (C) 2008, Red Hat, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -import sys -from os import environ - -if not environ.has_key('SUGAR_ACTIVITIES'): - environ['SUGAR_ACTIVITIES'] = '@prefix@/share/sugar/activities:' \ - '@prefix@/lib64/sugar/activities:' \ - '@prefix@/lib/sugar/activities' - -sys.path.insert(0, '@prefix@/share/sugar/service') - -from main import main - -main() - - diff --git a/bin/sugar-ui-check b/bin/sugar-ui-check index d9230e4..482c952 100644 --- a/bin/sugar-ui-check +++ b/bin/sugar-ui-check @@ -21,6 +21,7 @@ import sys import subprocess import time +import dbus import gobject import gtk import wnck @@ -28,6 +29,7 @@ import wnck from sugar import wm from jarabe.model.shell import get_sugar_window_type +from sugar.bundle.activitybundle import ActivityBundle from jarabe import config checks_queue = [] @@ -98,7 +100,15 @@ class ActivityCheck(Check): def launch_activity(self): from sugar.activity import activityfactory - activityfactory.create(self.name) + bus = dbus.SessionBus() + proxy = bus.get_object('org.laptop.Shell', '/org/laptop/Shell') + iface = dbus.Interface(proxy, 'org.laptop.Shell') + path = iface.GetBundlePath(self.name) + + if path: + activityfactory.create(ActivityBundle(path)) + else: + logging.error('Cannot find activity %s.' % self.name) def _window_opened_cb(self, screen, window): if wm.get_bundle_id(window) == self.name and \ diff --git a/src/jarabe/config.py.in b/src/jarabe/config.py.in index 9ae2394..6c418e9 100644 --- a/src/jarabe/config.py.in +++ b/src/jarabe/config.py.in @@ -21,5 +21,6 @@ data_path = '@prefix@/share/sugar/data' shell_path = '@prefix@/share/sugar/shell' locale_path = '@prefix@/share/locale' ext_path = '@prefix@/share/sugar/extensions' +activities_path = "@prefix@/share/sugar/activities" version = '@SUCROSE_VERSION@' diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py index 5be1cf0..5599b81 100644 --- a/src/jarabe/model/bundleregistry.py +++ b/src/jarabe/model/bundleregistry.py @@ -46,7 +46,8 @@ class BundleRegistry(gobject.GObject): self._mime_defaults = self._load_mime_defaults() self._bundles = [] - for activity_dir in self._get_activity_directories(): + user_path = env.get_user_activities_path() + for activity_dir in [user_path, config.activities_path]: self._scan_directory(activity_dir) self._last_defaults_mtime = -1 @@ -60,15 +61,6 @@ class BundleRegistry(gobject.GObject): self._merge_default_favorites() - def _get_activity_directories(self): - directories = [] - if os.environ.has_key('SUGAR_ACTIVITIES'): - directories.extend(os.environ['SUGAR_ACTIVITIES'].split(':')) - - directories.append(env.get_user_activities_path()) - - return directories - def _load_mime_defaults(self): defaults = {} -- cgit v0.9.1