KSMServer: canShutdown method

Alex Merry kde at randomguy3.me.uk
Fri Aug 8 23:36:26 BST 2008

The attached patch adds a canShutDown() method to KSMServer's D-Bus interface, 
and a canShutDown() method to KWorkSpace that takes the same arguments as 

The reason for this is that in Kickoff, we have three "leave" buttons: Logout, 
Shutdown and Reboot.  If the "Offer Shutdown Options" session management 
option is false (either because the system administrator has disabled it in a 
global configuration or because the user has disabled it in the Session 
Manager settings module), these buttons will only let the user log out.  If 
"Confirm Logout" is also disabled, the buttons will do nothing.

The solution is to hide them when "Offer Shutdown Options" is disabled.  
Rather than querying ksmserverrc in another place, I've added a canShutdown() 
method to the D-Bus interface.  This performs the same check as logout() in 
the D-Bus interface - that "Offer Shutdown Options" is enabled and the login 
manager will let us shut down.

The corresponding KWorkSpace method is modelled on requestShutDown() so that 
users can simply call canShutDown() with the same arguments they intend to 
call requestShutDown() with - if we're not in a KDE session, we can't force a 
shutdown either.

Any comments or objections?


Proud KDE hacker: http://www.kde.org
Get KDE 4.1 - out now!
Arch Linux: perfect for geeks like me - http://www.archlinux.org
OpenSUSE: just works - http://www.opensuse.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ksmserver-canshutdown.diff
Type: text/x-patch
Size: 3767 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080808/becf8473/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080808/becf8473/attachment.sig>

More information about the kde-core-devel mailing list