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

Anurag Chowdhury anurag at seeta.in
Sun Oct 17 21:06:16 EDT 2010


We changed the cursor in home window to a busy cursor when the shutdown menu
is activated and used glib.idle_add( ) to call the shut funtion when pygtk is
idle to shutdown or logout the sugar session properly , hence letting the user
know  the validity of the shutdown process going on in the backend.
---
 src/jarabe/view/buddymenu.py |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

v1->v2 : Corrected the window of operation
v2->v3 : Added the busycursor in the desktop window
v3->v4 : Removed redundant function calls like glib.timeout_add() and gtk.main()

diff --git a/src/jarabe/view/buddymenu.py b/src/jarabe/view/buddymenu.py
index 0ba6cc1..78cdeb4 100644
--- a/src/jarabe/view/buddymenu.py
+++ b/src/jarabe/view/buddymenu.py
@@ -21,6 +21,8 @@ from gettext import gettext as _
 import gtk
 import gconf
 import dbus
+import glib
+import jarabe
 
 from sugar.graphics.palette import Palette
 from sugar.graphics.menuitem import MenuItem
@@ -98,16 +100,28 @@ class BuddyMenu(Palette):
         item.show()
 
     def __logout_activate_cb(self, menu_item):
-        session_manager = get_session_manager()
-        session_manager.logout()
+        def shut(self, menu_item):
+            session_manager = get_session_manager()
+            session_manager.logout()
+        window = jarabe.desktop.homewindow.get_instance()
+        window.get_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))          
+        glib.idle_add(shut,self,menu_item)
 
     def __reboot_activate_cb(self, menu_item):
-        session_manager = get_session_manager()
-        session_manager.reboot()
+        def shut(self, menu_item):
+            session_manager = get_session_manager()
+            session_manager.reboot()
+        window = jarabe.desktop.homewindow.get_instance()
+        window.get_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))          
+        glib.idle_add(shut,self,menu_item)
 
     def __shutdown_activate_cb(self, menu_item):
-        session_manager = get_session_manager()
-        session_manager.shutdown()
+        def shut(self, menu_item):
+            session_manager = get_session_manager()
+            session_manager.reboot()
+        window = jarabe.desktop.homewindow.get_instance()
+        window.get_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))          
+        glib.idle_add(shut,self,menu_item)
 
     def __controlpanel_activate_cb(self, menu_item):
         panel = ControlPanel()
-- 
1.7.2.3



More information about the Dextrose mailing list