Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2009-03-03 10:11:00 (GMT)
committer Tomeu Vizoso <tomeu@sugarlabs.org>2009-03-03 10:11:00 (GMT)
commit449dc5c43b1b034cb0a269a6ff13b3077e849bae (patch)
treef951e0d3d884e6ff9806d0221bc8ce148e8c2500 /src
parent34e20927c4210e517dcd7dfc3c2a703b06f12904 (diff)
Restore minimal .xol support #459
Diffstat (limited to 'src')
-rw-r--r--src/jarabe/model/bundleregistry.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py
index 57db287..d23d5cb 100644
--- a/src/jarabe/model/bundleregistry.py
+++ b/src/jarabe/model/bundleregistry.py
@@ -1,4 +1,5 @@
# Copyright (C) 2006-2007 Red Hat, Inc.
+# Copyright (C) 2009 Aleksey Lim
#
# 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
@@ -24,6 +25,7 @@ import gio
import cjson
from sugar.bundle.activitybundle import ActivityBundle
+from sugar.bundle.contentbundle import ContentBundle
from sugar.bundle.bundle import MalformedBundleException, \
AlreadyInstalledException, RegistrationException
from sugar import env
@@ -305,6 +307,11 @@ class BundleRegistry(gobject.GObject):
open(path, 'w').write(cjson.encode(favorites_data))
def is_installed(self, bundle):
+ # TODO treat ContentBundle in special way
+ # needs rethinking while fixing ContentBundle support
+ if isinstance(bundle, ContentBundle):
+ return bundle.is_installed()
+
for installed_bundle in self._bundles:
if bundle.get_bundle_id() == installed_bundle.get_bundle_id() and \
bundle.get_activity_version() == \
@@ -328,10 +335,23 @@ class BundleRegistry(gobject.GObject):
install_dir = env.get_user_activities_path()
install_path = bundle.install(install_dir)
- if not self.add_bundle(install_path):
+ # TODO treat ContentBundle in special way
+ # needs rethinking while fixing ContentBundle support
+ if isinstance(bundle, ContentBundle):
+ pass
+ elif not self.add_bundle(install_path):
raise RegistrationException
def uninstall(self, bundle, force=False):
+ # TODO treat ContentBundle in special way
+ # needs rethinking while fixing ContentBundle support
+ if isinstance(bundle, ContentBundle):
+ if bundle.is_installed():
+ bundle.uninstall()
+ else:
+ logging.warning('Not uninstalling, bundle is not installed')
+ return
+
act = self.get_bundle(bundle.get_bundle_id())
if not force and \
act.get_activity_version() != bundle.get_activity_version():