Description: Monkey-patch the shutdown helper to use ConsoleKit and UPower instead of HAL. This is fixed properly in upstream git head, but has not been released yet. Index: xfce4-session/xfce4-session/xfsm-shutdown-helper.c =================================================================== --- xfce4-session.orig/xfce4-session/xfsm-shutdown-helper.c 2010-07-02 11:32:46.255448372 +0200 +++ xfce4-session/xfce4-session/xfsm-shutdown-helper.c 2010-07-02 11:56:00.832968838 +0200 @@ -70,8 +70,8 @@ XfsmShutdownCommand command; gchar * name; } command_name_map[] = { - { XFSM_SHUTDOWN_HALT, "Shutdown" }, - { XFSM_SHUTDOWN_REBOOT, "Reboot" }, + { XFSM_SHUTDOWN_HALT, "Stop" }, + { XFSM_SHUTDOWN_REBOOT, "Restart" }, { XFSM_SHUTDOWN_SUSPEND, "Suspend" }, { XFSM_SHUTDOWN_HIBERNATE, "Hibernate" }, }; @@ -118,38 +118,20 @@ * use the org.freedesktop.Hal.Device.SystemPowerManagement * interface without shutting down/rebooting now. */ - message = dbus_message_new_method_call ("org.freedesktop.Hal", - "/org/freedesktop/Hal/devices/computer", - "org.freedesktop.Hal.Device.SystemPowerManagement", - "ThisMethodMustNotExistInHal"); + message = dbus_message_new_method_call ("org.freedesktop.ConsoleKit", + "/org/freedesktop/ConsoleKit/Manager", + "org.freedesktop.ConsoleKit.Manager", + "CanRestart"); result = dbus_connection_send_with_reply_and_block (connection, message, 2000, &derror); dbus_message_unref (message); /* translate error results appropriately */ - if (result != NULL && dbus_set_error_from_message (&derror, result)) + if (result != NULL) { /* release and reset the result */ dbus_message_unref (result); + g_warning (G_STRLOC ": ConsoleKit.CanRestart succeeded"); result = NULL; - } - else if (G_UNLIKELY (result != NULL)) - { - /* we received a valid message return?! HAL must be on crack! */ - dbus_message_unref (result); - if (error) - { - g_set_error (error, DBUS_GERROR, DBUS_GERROR_FAILED, - _("Unexpected error from HAL")); - } - return FALSE; - } - - /* if we receive org.freedesktop.DBus.Error.UnknownMethod, then - * we are allowed to shutdown/reboot the computer via HAL. - */ - if (strcmp (derror.name, "org.freedesktop.DBus.Error.UnknownMethod") == 0) - { - dbus_error_free (&derror); return TRUE; } @@ -216,14 +198,16 @@ } /* send the appropriate message to HAL, telling it to shutdown or reboot the system */ - message = dbus_message_new_method_call ("org.freedesktop.Hal", - "/org/freedesktop/Hal/devices/computer", - "org.freedesktop.Hal.Device.SystemPowerManagement", - methodname); - - /* suspend requires additional arguements */ - if (command == XFSM_SHUTDOWN_SUSPEND) - dbus_message_append_args (message, DBUS_TYPE_INT32, &wakeup, DBUS_TYPE_INVALID); + if (command == XFSM_SHUTDOWN_HALT || command == XFSM_SHUTDOWN_REBOOT) + message = dbus_message_new_method_call ("org.freedesktop.ConsoleKit", + "/org/freedesktop/ConsoleKit/Manager", + "org.freedesktop.ConsoleKit.Manager", + methodname); + else + message = dbus_message_new_method_call ("org.freedesktop.UPower", + "/org/freedesktop/UPower", + "org.freedesktop.UPower", + methodname); result = dbus_connection_send_with_reply_and_block (connection, message, -1, &derror); dbus_message_unref (message);