[Sugar-devel] [PATCH sugar v2] use ConsoleKit instead of HAL for shutdown/reboot

Simon Schampijer simon at schampijer.de
Mon Feb 14 14:28:09 EST 2011


Hi Sascha,

On 01/22/2011 07:34 AM, Sascha Silbe wrote:
> HAL is dead, ConsoleKit now handles shutdown / reboot.

As this might not be known already, it might be helpful to link here 
some secondary information:

http://freedesktop.org/wiki/Software/hal
http://lists.freedesktop.org/archives/hal/2008-May/011560.html

> Tested on XO-1.5 running Debian Squeeze with consolekit 0.4.1-4.
>
> Signed-off-by: Sascha Silbe<sascha-pgp at silbe.org>
> ---
> v1->v2: Rebased on mainline/master
>
>   src/jarabe/model/session.py |   10 +++++-----
>   1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/jarabe/model/session.py b/src/jarabe/model/session.py
> index c6409fb..9b277ff 100644
> --- a/src/jarabe/model/session.py
> +++ b/src/jarabe/model/session.py
> @@ -55,15 +55,15 @@ class SessionManager(session.SessionManager):
>           elif self._logout_mode != self.MODE_LOGOUT:
>               try:
>                   bus = dbus.SystemBus()
> -                proxy = bus.get_object('org.freedesktop.Hal',
> -                    '/org/freedesktop/Hal/devices/computer')
> +                proxy = bus.get_object('org.freedesktop.ConsoleKit',
> +                                       '/org/freedesktop/ConsoleKit/Manager')
>                   pm = dbus.Interface(proxy,
> -                    'org.freedesktop.Hal.Device.SystemPowerManagement')
> +                                    'org.freedesktop.ConsoleKit.Manager')
>
>                   if self._logout_mode == self.MODE_SHUTDOWN:
> -                    pm.Shutdown()
> +                    pm.Stop()
>                   elif self._logout_mode == self.MODE_REBOOT:
> -                    pm.Reboot()
> +                    pm.Restart()
>               except:
>                   logging.exception('Can not stop sugar')
>                   self.session.cancel_shutdown()

You might want to use CanRestart [1] and CanStop [2] to check if you can 
restart.

Regards,
    Simon

[1] 
http://www.freedesktop.org/software/ConsoleKit/doc/ConsoleKit.html#Manager.CanRestart

[2] 
http://www.freedesktop.org/software/ConsoleKit/doc/ConsoleKit.html#Manager.CanStop


More information about the Sugar-devel mailing list