Only emit ::Sleeping() after we've checked AboutToSleep()

This commit is contained in:
Richard Hughes 2010-05-07 20:38:46 +01:00
parent 07a404840e
commit 43fd837e00

View file

@ -313,10 +313,6 @@ up_daemon_about_to_sleep (UpDaemon *daemon, DBusGMethodInvocation *context)
GError *error;
UpDaemonPrivate *priv = daemon->priv;
egg_debug ("emitting sleeping");
g_signal_emit (daemon, signals[SIGNAL_SLEEPING], 0);
g_timer_start (priv->about_to_sleep_timer);
/* already requested */
if (priv->about_to_sleep_id != 0) {
error = g_error_new (UP_DAEMON_ERROR,
@ -334,6 +330,10 @@ up_daemon_about_to_sleep (UpDaemon *daemon, DBusGMethodInvocation *context)
if (!up_polkit_check_auth (priv->polkit, subject, "org.freedesktop.upower.suspend", context))
goto out;
egg_debug ("emitting sleeping");
g_signal_emit (daemon, signals[SIGNAL_SLEEPING], 0);
g_timer_start (priv->about_to_sleep_timer);
dbus_g_method_return (context, NULL);
out:
if (subject != NULL)