From 68fced3c06a55e17ef884768d275e436a85a23c5 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 1 Jul 2009 12:50:18 +0200 Subject: [PATCH] suppress lid change event on startup 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. http://bugs.freedesktop.org/show_bug.cgi?id=22574 https://launchpad.net/bugs/385135 --- src/dkp-daemon.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/src/dkp-daemon.c b/src/dkp-daemon.c index 3efe2ae..4db68e5 100644 --- a/src/dkp-daemon.c +++ b/src/dkp-daemon.c @@ -102,6 +102,7 @@ gboolean 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 @@ dkp_daemon_set_lid_is_closed (DkpDaemon *daemon, gboolean lid_is_closed) } /* 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: -- 1.6.3.3