1 | From d7bdfa18a37602fc076d018cf497e3b5a9af9a8c Mon Sep 17 00:00:00 2001 |
---|
2 | From: Martin Abente <mabente@paraguayeduca.org> |
---|
3 | Date: Tue, 6 Jul 2010 15:39:48 -0400 |
---|
4 | Subject: [PATCH] Delete profile data only when erased |
---|
5 | Organization: Paraguay Educa |
---|
6 | |
---|
7 | Profile data should be deleted _only_ when the |
---|
8 | user explicitly erases the activity from the |
---|
9 | activities list. |
---|
10 | |
---|
11 | More information at http://bugs.sugarlabs.org/ticket/2074 |
---|
12 | |
---|
13 | Signed-off-by: Martin Abente <mabente@paraguayeduca.org> |
---|
14 | --- |
---|
15 | src/jarabe/desktop/activitieslist.py | 14 +++++++++++--- |
---|
16 | src/jarabe/model/bundleregistry.py | 4 ++-- |
---|
17 | 2 files changed, 13 insertions(+), 5 deletions(-) |
---|
18 | |
---|
19 | diff --git a/src/jarabe/desktop/activitieslist.py b/src/jarabe/desktop/activitieslist.py |
---|
20 | index e14d0f7..8833cce 100644 |
---|
21 | --- a/src/jarabe/desktop/activitieslist.py |
---|
22 | +++ b/src/jarabe/desktop/activitieslist.py |
---|
23 | @@ -360,18 +360,26 @@ class ActivitiesList(gtk.VBox): |
---|
24 | erase_icon = Icon(icon_name='dialog-ok') |
---|
25 | alert.add_button(gtk.RESPONSE_OK, _('Erase'), erase_icon) |
---|
26 | |
---|
27 | + delete_profile_check = gtk.CheckButton(_('Erase all associated data')) |
---|
28 | + delete_profile_check.set_active(True) |
---|
29 | + delete_profile_check.show() |
---|
30 | + |
---|
31 | + alert._hbox.add(delete_profile_check) |
---|
32 | + alert._hbox.reorder_child(delete_profile_check, 1) |
---|
33 | + |
---|
34 | alert.connect('response', self.__erase_confirmation_dialog_response_cb, |
---|
35 | - bundle_id) |
---|
36 | + bundle_id, delete_profile_check) |
---|
37 | |
---|
38 | self.add_alert(alert) |
---|
39 | |
---|
40 | def __erase_confirmation_dialog_response_cb(self, alert, response_id, |
---|
41 | - bundle_id): |
---|
42 | + bundle_id, check): |
---|
43 | self.remove_alert() |
---|
44 | if response_id == gtk.RESPONSE_OK: |
---|
45 | registry = bundleregistry.get_registry() |
---|
46 | bundle = registry.get_bundle(bundle_id) |
---|
47 | - registry.uninstall(bundle) |
---|
48 | + |
---|
49 | + registry.uninstall(bundle, delete_profile=check.get_active()) |
---|
50 | |
---|
51 | class ActivityListPalette(ActivityPalette): |
---|
52 | __gtype_name__ = 'SugarActivityListPalette' |
---|
53 | diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py |
---|
54 | index 858655f..b96de86 100644 |
---|
55 | --- a/src/jarabe/model/bundleregistry.py |
---|
56 | +++ b/src/jarabe/model/bundleregistry.py |
---|
57 | @@ -386,7 +386,7 @@ class BundleRegistry(gobject.GObject): |
---|
58 | elif not self.add_bundle(install_path): |
---|
59 | raise RegistrationException |
---|
60 | |
---|
61 | - def uninstall(self, bundle, force=False): |
---|
62 | + def uninstall(self, bundle, force=False, delete_profile=False): |
---|
63 | # TODO treat ContentBundle in special way |
---|
64 | # needs rethinking while fixing ContentBundle support |
---|
65 | if isinstance(bundle, ContentBundle) or \ |
---|
66 | @@ -409,7 +409,7 @@ class BundleRegistry(gobject.GObject): |
---|
67 | |
---|
68 | install_path = act.get_path() |
---|
69 | |
---|
70 | - bundle.uninstall(install_path, force) |
---|
71 | + bundle.uninstall(install_path, force, delete_profile) |
---|
72 | |
---|
73 | if not self.remove_bundle(install_path): |
---|
74 | raise RegistrationException |
---|
75 | -- |
---|
76 | 1.6.0.4 |
---|
77 | |
---|