[gnome-settings-daemon] power: Don't warn if session isn't available yet
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: Don't warn if session isn't available yet
- Date: Tue, 22 Jan 2013 22:24:07 +0000 (UTC)
commit 1e0b2d70f0ebf3a607ae51d2cfb293ac4c447076
Author: Bastien Nocera <hadess hadess net>
Date: Tue Jan 22 23:22:18 2013 +0100
power: Don't warn if session isn't available yet
This:
power-plugin-WARNING **: session inhibition not available, gnome-session is not available
is a transient error, and we should be checking on the inhibition
status soon after, so don't warn when checking for session inhibition
fails on startup.
https://bugzilla.gnome.org/show_bug.cgi?id=685569
plugins/power/gsd-power-manager.c | 32 ++++++++++++++++++++------------
1 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 565f8e0..8566f8e 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -2549,17 +2549,18 @@ idle_is_session_idle (GsdPowerManager *manager)
}
static gboolean
-idle_is_session_inhibited (GsdPowerManager *manager, guint mask)
+idle_is_session_inhibited (GsdPowerManager *manager,
+ guint mask,
+ gboolean *is_inhibited)
{
- gboolean ret;
GVariant *retval = NULL;
GError *error = NULL;
+ *is_inhibited = FALSE;
+
/* not yet connected to gnome-session */
- if (manager->priv->session == NULL) {
- g_warning ("session inhibition not available, gnome-session is not available");
+ if (manager->priv->session == NULL)
return FALSE;
- }
retval = g_dbus_proxy_call_sync (manager->priv->session,
"IsInhibited",
@@ -2572,13 +2573,13 @@ idle_is_session_inhibited (GsdPowerManager *manager, guint mask)
/* abort as the DBUS method failed */
g_warning ("IsInhibited failed: %s", error->message);
g_error_free (error);
- return FALSE;
+ return TRUE;
}
- g_variant_get (retval, "(b)", &ret);
+ g_variant_get (retval, "(b)", is_inhibited);
g_variant_unref (retval);
- return ret;
+ return TRUE;
}
static void
@@ -2600,9 +2601,14 @@ idle_configure (GsdPowerManager *manager)
guint timeout_dim;
gboolean on_battery;
+ if (!idle_is_session_inhibited (manager,
+ GSM_INHIBITOR_FLAG_IDLE,
+ &is_idle_inhibited)) {
+ /* Session isn't available yet, postpone */
+ return;
+ }
+
/* are we inhibited from going idle */
- is_idle_inhibited = idle_is_session_inhibited (manager,
- GSM_INHIBITOR_FLAG_IDLE);
if (is_idle_inhibited) {
g_debug ("inhibited, so using normal state");
idle_set_mode (manager, GSD_POWER_IDLE_MODE_NORMAL);
@@ -2994,8 +3000,10 @@ idle_send_to_sleep (GsdPowerManager *manager)
gboolean is_idle;
/* check the session is not now inhibited */
- is_inhibited = idle_is_session_inhibited (manager,
- GSM_INHIBITOR_FLAG_SUSPEND);
+ idle_is_session_inhibited (manager,
+ GSM_INHIBITOR_FLAG_SUSPEND,
+ &is_inhibited);
+
if (is_inhibited) {
g_debug ("suspend inhibited");
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]