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): |
307 | 307 | 'favorites': self._favorite_bundles} |
308 | 308 | open(path, 'w').write(cjson.encode(favorites_data)) |
309 | 309 | |
| 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 | |
310 | 318 | def is_installed(self, bundle): |
311 | 319 | # TODO treat ContentBundle in special way |
312 | 320 | # needs rethinking while fixing ContentBundle support |
… |
… |
class BundleRegistry(gobject.GObject): |
324 | 332 | def install(self, bundle): |
325 | 333 | activities_path = env.get_user_activities_path() |
326 | 334 | |
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): |
328 | 337 | raise AlreadyInstalledException |
329 | 338 | |
330 | 339 | for installed_bundle in self._bundles: |