[gnome-power-manager] Do the lid policy action on active-change. Fixes rh#497262
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-power-manager] Do the lid policy action on active-change. Fixes rh#497262
- Date: Thu, 23 Apr 2009 04:59:31 -0400 (EDT)
commit 2afc1080ed12aba7cee0d6bf75b5a25363449c1d
Author: Richard Hughes <richard hughsie com>
Date: Thu Apr 23 09:58:30 2009 +0100
Do the lid policy action on active-change. Fixes rh#497262
---
src/gpm-manager.c | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 62d2b61..e2639f5 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -1590,8 +1590,32 @@ dpms_mode_changed_cb (GpmDpms *dpms, GpmDpmsMode mode, GpmManager *manager)
static void
gpm_manager_console_kit_active_changed_cb (EggConsoleKit *console, gboolean active, GpmManager *manager)
{
+ gboolean on_ac;
+ gboolean ret;
+
egg_debug ("console now %s", active ? "active" : "inactive");
- /* FIXME: do we need to do policy actions when we switch? */
+
+ /* gone inactive */
+ if (!active)
+ return;
+
+ /* get lid state */
+ ret = gpm_button_is_lid_closed (manager->priv->button);
+ if (!ret)
+ return;
+
+ /* get ac state */
+ on_ac = gpm_ac_adapter_is_present (manager->priv->ac_adapter);
+ if (on_ac) {
+ egg_debug ("Performing AC policy as become active when lid down");
+ manager_policy_do (manager, GPM_CONF_BUTTON_LID_AC,
+ _("The lid has been found closed on ac power."));
+ return;
+ }
+
+ egg_debug ("Performing battery policy as become active when lid down");
+ manager_policy_do (manager, GPM_CONF_BUTTON_LID_BATT,
+ _("The lid has been found closed on battery power."));
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]