GNOME Bugzilla – Bug 580423
Remove deprecated libgnomeui dependency
Last modified: 2009-05-03 00:56:56 UTC
http://live.gnome.org/LibgnomeMustDie This library will be removed for GNOME 3. $:andre\> grep -r gnome.ui . ./src/orca/orca_console_prefs.py: import gnome.ui ./src/orca/orca_console_prefs.py: client = gnome.ui.master_client() ./src/orca/orca_console_prefs.py: client.request_save(gnome.ui.SAVE_GLOBAL, ./src/orca/orca_console_prefs.py: gnome.ui.INTERACT_ANY,
The code in question uses gnome.ui to popup a logout screen for the desktop: def logoutUser(): """Automatically log the user out of the GNOME desktop.""" import gnome import gnome.ui gnome.init(platform.package, platform.version) client = gnome.ui.master_client() client.request_save(gnome.ui.SAVE_GLOBAL, # Save style True, # Shutdown gnome.ui.INTERACT_ANY, # Allow user interaction False, # Fast True) # All apps save state In looking at http://live.gnome.org/LibgnomeMustDie, I'm not sure what I'd need to do to pop up the dialog. Do you have any suggestions?
After digging, it looks like the proposal is to replace GnomeClient with EggSMClient: http://live.gnome.org/SessionManagement/EggSMClient http://git.gnome.org/cgit/libegg/tree/libegg/smclient/README says the following: - gnome_client_request_save - Shutdown saves are now done via egg_sm_client_end_session. There is no way to request a non-shutdown save, either for yourself, or for the whole session. (Requesting a local SaveYourself for yourself won't actually have any effect under most session managers, and requesting it for the whole session is something that only a program directly associated with the session manager ought to do, so there doesn't seem to be a need for a public API for this.) Now to find Python bindings for this....
Willie: no need to use EggSMClient. There's a dbus method to log out. See org.gnome.SessionManager.xml in the gnome-session code for the API.
Or you can just directly call org.gnome.SessionManager.Logout on the session bus.
Woo hoo. Thanks for the tip. This command works well from the command line: dbus-send --session --dest=org.gnome.SessionManager --type=method_call /org/gnome/SessionManager org.gnome.SessionManager.Logout uint32:0 Now to make the Python equivalent. Coming up.
This seems to work. The cast to UInt32 seems necessary: import dbus bus = dbus.SessionBus() sessionManager = bus.get_object('org.gnome.SessionManager', '/org/gnome/SessionManager') sessionManager.Logout(dbus.types.UInt32(0))
Created attachment 133803 [details] [review] Patch to do D-Bus equivalent of the gnome.ui calls This patch replaces the gnome.ui calls with the equivalent D-Bus calls. The end result is the same, which is to pop up a dialog asking the user if they want to log out. I would like, however, for the logout to automatically happen if possible. The reason for this is that the typical use case where this dialog is presented is when the user is configuring Orca for the very first time and accessibility has not yet been enabled for the desktop. As a result, the logout dialog is not yet accessible. As a result, we need to tell the user to press "Return" a couple times in order to logout. Vuntz/Matthias - would a parameter value of '1' be the better thing to use (from the *.xml - "<doc:definition>No confirmation inferface should be shown.</doc:definition>")? A parameter of '2' for the forceful logout seems a bit too forceful.
Yes, you probably want to use 1.
Created attachment 133835 [details] [review] Revised patch to use '1' as the Logout parameter and which also pylints to a 10.0 This patch works nicely. Thanks for the confirmation about the parameter value of '1', Vincent!
Committed to master and gnome-2-26 branches for GNOME 2.27.1 and GNOME 2.26.2. Closing as FIXED.