[Dextrose] [PATCH][Dx2][sugar] XS registration GUI enchancemnts

Martin Abente martin.abente.lahaye at gmail.com
Fri Apr 29 20:31:14 EDT 2011


Avoid blocking palette drawing and use
the new message notification system.

---
 src/jarabe/desktop/favoritesview.py |   29 +++++++++++++----------------
 1 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/jarabe/desktop/favoritesview.py b/src/jarabe/desktop/favoritesview.py
index bab8cc9..697e06d 100644
--- a/src/jarabe/desktop/favoritesview.py
+++ b/src/jarabe/desktop/favoritesview.py
@@ -51,6 +51,8 @@ from jarabe.desktop.schoolserver import RegisterError
 from jarabe.desktop.myicon import MyIcon
 from jarabe.desktop import favoriteslayout
 
+from jarabe.frame import get_view
+
 _logger = logging.getLogger('FavoritesView')
 
 _ICON_DND_TARGET = ('activity-icon', gtk.TARGET_SAME_WIDGET, 0)
@@ -319,27 +321,22 @@ class FavoritesView(hippo.Canvas):
         self._alert = None
 
     def __register_activate_cb(self, icon):
-        alert = Alert()
+        gobject.idle_add(self.__async_registration_cb)
+
+    def __async_registration_cb(self):
         try:
             schoolserver.register_laptop()
         except RegisterError, e:
-            alert.props.title = _('Registration Failed')
-            alert.props.msg = _('%s') % e
+            summary = _('Registration Failed')
+            body = _('%s') % e
         else:
-            alert.props.title = _('Registration Successful')
-            alert.props.msg = _('You are now registered ' \
-                                'with your school server.')
-            self._my_icon.change_register_menu()
-            get_journal()._volumes_toolbar.setup_xs_button()
-
-        ok_icon = Icon(icon_name='dialog-ok')
-        alert.add_button(gtk.RESPONSE_OK, _('Ok'), ok_icon)
-
-        self.add_alert(alert)
-        alert.connect('response', self.__register_alert_response_cb)
+            summary = _('Registration Successful')
+            body = _('You are now registered ' \
+                    'with your school server.')
 
-    def __register_alert_response_cb(self, alert, response_id):
-        self.remove_alert()
+        frame = get_view()
+        frame.add_message(body=body, summary=summary,
+                        icon_name='school-server')
 
     def set_resume_mode(self, resume_mode):
         self._resume_mode = resume_mode
-- 
1.7.4.4



More information about the Dextrose mailing list