Ticket #1176: sugar-1176.patch

File sugar-1176.patch, 1.5 KB (added by alsroot, 15 years ago)
  • src/jarabe/model/bundleregistry.py

    From a8ab3708c1ac7199a7dab6daab470af8eb3e3e30 Mon Sep 17 00:00:00 2001
    From: Aleksey Lim <alsroot@member.fsf.org>
    Date: Thu, 13 Aug 2009 20:42:22 +0000
    Subject: Upgrade activities that were installed from bundles #1176
    
    ---
     src/jarabe/model/bundleregistry.py |   11 ++++++++++-
     1 files changed, 10 insertions(+), 1 deletions(-)
    
    diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py
    index 351459b..a3dc3ea 100644
    a b class BundleRegistry(gobject.GObject): 
    307307                          'favorites': self._favorite_bundles}
    308308        open(path, 'w').write(cjson.encode(favorites_data))
    309309
     310    def is_pre_installed(self, bundle_id):
     311        installed = self.get_bundle(bundle_id)
     312        if installed is not None and \
     313                not installed.get_path().startswith(
     314                        env.get_user_activities_path()):
     315            return True
     316        return False
     317
    310318    def is_installed(self, bundle):
    311319        # TODO treat ContentBundle in special way
    312320        # needs rethinking while fixing ContentBundle support
    class BundleRegistry(gobject.GObject): 
    324332    def install(self, bundle):
    325333        activities_path = env.get_user_activities_path()
    326334
    327         if self.get_bundle(bundle.get_bundle_id()):
     335        if self.is_pre_installed(bundle.get_bundle_id()) or \
     336                self.is_installed(bundle):
    328337            raise AlreadyInstalledException
    329338
    330339        for installed_bundle in self._bundles: