# Description: Suppress lid change event on startup. Otherwise, gnome-power-manager picks up a "lid is closed" change event when dk-p gets D-BUS activated, and thus immediately suspends the machine on startup. # Upstream: https://bugs.freedesktop.org/show_bug.cgi?id=22574 # Ubuntu: https://launchpad.net/bugs/385135 Index: devicekit-power/src/dkp-daemon.c =================================================================== --- devicekit-power.orig/src/dkp-daemon.c 2009-07-01 11:15:56.000000000 +0200 +++ devicekit-power/src/dkp-daemon.c 2009-07-01 11:20:25.000000000 +0200 @@ -102,6 +102,7 @@ dkp_daemon_set_lid_is_closed (DkpDaemon *daemon, gboolean lid_is_closed) { gboolean ret = FALSE; + static gboolean initialized = FALSE; g_return_val_if_fail (DKP_IS_DAEMON (daemon), FALSE); @@ -112,7 +113,16 @@ } /* save */ - g_signal_emit (daemon, signals[CHANGED_SIGNAL], 0); + if (!initialized) { + /* Do not emit an event on startup. Otherwise, e. g. + * gnome-power-manager would pick up a "lid is closed" change + * event when dk-p gets D-BUS activated, and thus would + * immediately suspend the machine on startup. FD#22574 */ + egg_debug ("not emitting lid change event for daemon startup"); + initialized = TRUE; + } else { + g_signal_emit (daemon, signals[CHANGED_SIGNAL], 0); + } daemon->priv->lid_is_closed = lid_is_closed; ret = TRUE; out: