[Dextrose] [PATCH sugar] Shutdown(and Logout) menuitems should activate

Aleksey Lim alsroot at activitycentral.org
Tue Feb 15 07:02:41 EST 2011


From: Anurag Chowdhury <anurag at seeta.in>

Show a busy cursor when shutdown, logout, or reboot options are
selected.  Defer the selected action to an idle task so that the cursor
change is flushed to the display.

Co-Authored-By:James Cameron <quozl at laptop.org>
Co-Authored-By:Aleksey Lim <alsroot at member.fsf.org>
---
 src/jarabe/view/buddymenu.py |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/jarabe/view/buddymenu.py b/src/jarabe/view/buddymenu.py
index 5592eee..6580283 100644
--- a/src/jarabe/view/buddymenu.py
+++ b/src/jarabe/view/buddymenu.py
@@ -19,6 +19,7 @@ from gettext import gettext as _
 
 import gtk
 import gconf
+import gobject
 
 from sugar.graphics.palette import Palette
 from sugar.graphics.menuitem import MenuItem
@@ -103,17 +104,20 @@ class BuddyMenu(Palette):
         self.menu.append(item)
         item.show()
 
+    def _quit(self, action):
+        from jarabe.desktop import homewindow
+        journal = homewindow.get_instance()
+        journal.get_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
+        gobject.idle_add(action)
+
     def __logout_activate_cb(self, menu_item):
-        session_manager = get_session_manager()
-        session_manager.logout()
+        self._quit(get_session_manager().logout)
 
     def __reboot_activate_cb(self, menu_item):
-        session_manager = get_session_manager()
-        session_manager.reboot()
+        self._quit(get_session_manager().reboot)
 
     def __shutdown_activate_cb(self, menu_item):
-        session_manager = get_session_manager()
-        session_manager.shutdown()
+        self._quit(get_session_manager().shutdown)
 
     def __controlpanel_activate_cb(self, menu_item):
         panel = ControlPanel()
-- 
1.7.3.4



More information about the Dextrose mailing list