[Sugar-devel] [PATCH sugar] Find activities in the xdg system dirs
Daniel Narvaez
dwnarvaez at gmail.com
Fri Dec 7 08:15:17 EST 2012
From: Daniel Narvaez <dwnarvaez at gmail.com>
Instead of hardcoding our prefix.
---
src/jarabe/config.py.in | 1 -
src/jarabe/model/bundleregistry.py | 9 +++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/jarabe/config.py.in b/src/jarabe/config.py.in
index bfcc2e5..f2a66a2 100644
--- a/src/jarabe/config.py.in
+++ b/src/jarabe/config.py.in
@@ -19,6 +19,5 @@
data_path = '@prefix@/share/sugar/data'
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 e441122..8a1fa37 100644
--- a/src/jarabe/model/bundleregistry.py
+++ b/src/jarabe/model/bundleregistry.py
@@ -20,6 +20,7 @@ import logging
from gi.repository import GConf
from gi.repository import GObject
+from gi.repository import GLib
from gi.repository import Gio
import simplejson
@@ -60,8 +61,12 @@ class BundleRegistry(GObject.GObject):
# hold a reference to the monitors so they don't get disposed
self._gio_monitors = []
- user_path = env.get_user_activities_path()
- for activity_dir in [user_path, config.activities_path]:
+ dirs = [env.get_user_activities_path()]
+
+ for data_dir in GLib.get_system_data_dirs():
+ dirs.append(os.path.join(data_dir, "sugar", "activities"))
+
+ for activity_dir in dirs:
self._scan_directory(activity_dir)
directory = Gio.File.new_for_path(activity_dir)
monitor = directory.monitor_directory( \
--
1.7.10.4
More information about the Sugar-devel
mailing list