[Sugar-devel] [PATCH sugar] Don't hide Register menu item upon successful registration

Sascha Silbe sascha-pgp at silbe.org
Fri Jan 21 10:20:06 EST 2011


From: Jorge Saldivar <jorgesaldivar at gmail.com>

Rename the Register menu item in the XO palette to "Register again" instead
of hiding it.

Use case: Reregistering XOs after XS reinstallation due to HD crash.

[changed description; rebased on mainline; style fixes]
Signed-off-by: Sascha Silbe <sascha-pgp at silbe.org>
Reviewed-by: Sascha Silbe <sascha-pgp at silbe.org>
---
 src/jarabe/desktop/favoritesview.py |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/jarabe/desktop/favoritesview.py b/src/jarabe/desktop/favoritesview.py
index ac058de..b4a4e75 100644
--- a/src/jarabe/desktop/favoritesview.py
+++ b/src/jarabe/desktop/favoritesview.py
@@ -330,7 +330,7 @@ class FavoritesView(hippo.Canvas):
             alert.props.title = _('Registration Successful')
             alert.props.msg = _('You are now registered ' \
                                 'with your school server.')
-            self._my_icon.remove_register_menu()
+            self._my_icon.set_registered()
 
         ok_icon = Icon(icon_name='dialog-ok')
         alert.add_button(gtk.RESPONSE_OK, _('Ok'), ok_icon)
@@ -622,12 +622,16 @@ class OwnerIcon(BuddyIcon):
 
         client = gconf.client_get_default()
         backup_url = client.get_string('/desktop/sugar/backup_url')
+
         if not backup_url:
             self._register_menu = MenuItem(_('Register'), 'media-record')
-            self._register_menu.connect('activate',
-                                        self.__register_activate_cb)
-            palette.menu.append(self._register_menu)
-            self._register_menu.show()
+        else:
+            self._register_menu = MenuItem(_('Register again'),
+                                           'media-record')
+
+        self._register_menu.connect('activate', self.__register_activate_cb)
+        palette.menu.append(self._register_menu)
+        self._register_menu.show()
 
         return palette
 
@@ -637,8 +641,12 @@ class OwnerIcon(BuddyIcon):
     def __register_activate_cb(self, menuitem):
         self.emit('register-activate')
 
-    def remove_register_menu(self):
+    def set_registered(self):
         self.palette.menu.remove(self._register_menu)
+        self._register_menu = MenuItem(_('Register again'), 'media-record')
+        self._register_menu.connect('activate', self.__register_activate_cb)
+        self.palette.menu.append(self._register_menu)
+        self._register_menu.show()
 
 
 class FavoritesSetting(object):
-- 
1.7.2.3



More information about the Sugar-devel mailing list