bigboard r7407 - in trunk/bigboard: core stocks/self



Author: marco
Date: Thu Jun 26 11:49:43 2008
New Revision: 7407
URL: http://svn.gnome.org/viewvc/bigboard?rev=7407&view=rev

Log:
Split Login/Shutdown menu items and use the new gnome-session dbus service to display the dialogs.

Modified:
   trunk/bigboard/core/panel.py
   trunk/bigboard/stocks/self/SelfStock.py

Modified: trunk/bigboard/core/panel.py
==============================================================================
--- trunk/bigboard/core/panel.py	(original)
+++ trunk/bigboard/core/panel.py	Thu Jun 26 11:49:43 2008
@@ -422,16 +422,6 @@
         _logger.debug("Got Reboot, executing %s", args)
         subprocess.Popen(args)
 
-    @dbus.service.method(BUS_IFACE_PANEL)
-    def Logout(self):
-        master = gnome.ui.master_client()
-        master.request_save(gnome.ui.SAVE_GLOBAL,
-                            True,
-                            gnome.ui.INTERACT_ANY,
-                            False,
-                            True)
-
-
     def __create_scratch_window(self):
         w = hippo.CanvasWindow(gtk.WINDOW_TOPLEVEL)
         w.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(65535,65535,65535))

Modified: trunk/bigboard/stocks/self/SelfStock.py
==============================================================================
--- trunk/bigboard/stocks/self/SelfStock.py	(original)
+++ trunk/bigboard/stocks/self/SelfStock.py	Thu Jun 26 11:49:43 2008
@@ -92,6 +92,7 @@
     __gsignals__ = {
         "account" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, []),                    
         "logout" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, []),
+        "shutdown" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, []),
         "sidebar-controls" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, []),
     }
     def __init__(self, stock, myself, fus=None, logger=None):
@@ -157,7 +158,7 @@
             self.__fus_users_box = CanvasVBox()
             self.__fus_box.append(self.__fus_users_box)
             
-            link = IconLink(text='Log in as Another User...', img_scale_width=22, img_scale_height=22, xalign=hippo.ALIGNMENT_START)
+            link = IconLink(text='Log in as Another User...', xalign=hippo.ALIGNMENT_START)
             link.link.connect("activated", self.__do_fus_login_other_user)
             link.img.set_property('image-name', '/usr/share/icons/gnome/22x22/apps/system-users.png')
             self.__fus_box.append(link)
@@ -167,9 +168,14 @@
         self.__logout_controls_box = CanvasVBox()
         vbox.append(self.__logout_controls_box)
 
-        link = IconLink(text='Logout or Shutdown...', img_scale_width=22, img_scale_height=22, xalign=hippo.ALIGNMENT_START)
+        link = IconLink(text='Logout...', img_scale_width=22, img_scale_height=22, xalign=hippo.ALIGNMENT_START)
         link.link.connect("activated", self.__on_logout)
-        link.img.set_property('image-name', '/usr/share/icons/gnome/22x22/apps/gnome-shutdown.png')
+        link.img.set_property('image-name', 'gnome-logout')
+        self.__logout_controls_box.append(link)
+
+        link = IconLink(text='Shutdown...', img_scale_width=22, img_scale_height=22, xalign=hippo.ALIGNMENT_START)
+        link.link.connect("activated", self.__on_shutdown)
+        link.img.set_property('image-name', 'gnome-shutdown')
         self.__logout_controls_box.append(link)
 
         self.update_self(myself)
@@ -203,6 +209,10 @@
         self.emit('logout')
         self.emit('close', True)
 
+    def __on_shutdown(self, l):
+        self.emit('shutdown')
+        self.emit('close', True)
+
     def __on_dbus_error(self, err):
         self._logger.exception("D-BUS error: %s", err)
 
@@ -357,10 +367,18 @@
         (src_x, src_y) = widget_src.get_context().translate_to_screen(widget_src)
         slideout.slideout_from(box_x + self._box.get_allocation()[0] + 4, src_y)
         slideout.set_size_request(200, -1)
+
+    def __get_session_manager(self):
+        bus = dbus.SessionBus()
+        return bus.get_object('org.gnome.SessionManager', '/org/gnome/SessionManager')
          
     def __do_logout(self):
         self._panel.action_taken()
-        self._panel.Logout()
+        self.__get_session_manager().Logout(0)
+
+    def __do_shutdown(self):
+        self._panel.action_taken()
+        self.__get_session_manager().Shutdown()
 
     def __do_sidebar_controls(self):
         # Don't call this here; this ensures that we keep the sidebar visible while
@@ -394,6 +412,7 @@
         self.__slideout.connect('account', lambda s: self.__do_account())        
         self.__slideout.connect('sidebar-controls', lambda s: self.__do_sidebar_controls())
         self.__slideout.connect('logout', lambda s: self.__do_logout())
+        self.__slideout.connect('shutdown', lambda s: self.__do_shutdown())
         self.__slideout.connect('close', lambda s, a: self.__on_activate())
         self.__do_slideout(self.__slideout)
         



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]