summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2010-03-17 13:23:15 (GMT)
committerMartin Pitt <martin.pitt@ubuntu.com>2010-03-22 11:55:49 (GMT)
commitc7728fddf901635794edd7db299c7247f4c27ab3 (patch)
tree9c245f26b6ae94fe7d8cb6ed6c251a53357e9a69
parent05ae83fbd41fd823569f8a7bbc1163e9d154c0f0 (diff)
downloadgnome-power-manager-c7728fddf901635794edd7db299c7247f4c27ab3.zip
gnome-power-manager-c7728fddf901635794edd7db299c7247f4c27ab3.tar.xz
Fix wrong suspends with docked laptops
Commit 2afc10 introduced execution of lid/suspend policy when g-p-m got back the active ConsoleKit session. However, this * does not fix the original problem in https://bugzilla.redhat.com/show_bug.cgi?id=497262, since "does not suspend while no g-p-m is running" is not at all related to ConsoleKit sessions, and * causes wrong suspends on user switching with docked laptops where the lid is always closed. Remove the entire gpm_manager_console_kit_active_changed_cb() and thus effectively revert 2afc10. We generally handle events only if we have the active CK session, which is checked in the particular event handlers themselves. The mere fact of switching CK sessions is not related to suspend/lid/etc. policies and should not be handled at all in g-p-m. https://bugzilla.gnome.org/show_bug.cgi?id=613130 https://launchpad.net/bugs/515465
-rw-r--r--src/gpm-manager.c42
1 files changed, 1 insertions, 41 deletions
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 1dcc6ef..8e4a18e 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -1841,44 +1841,6 @@ gpm_manager_control_resume_cb (GpmControl *control, GpmControlAction action, Gpm
}
/**
- * gpm_manager_console_kit_active_changed_cb:
- **/
-static void
-gpm_manager_console_kit_active_changed_cb (EggConsoleKit *console, gboolean active, GpmManager *manager)
-{
- gboolean ret;
-
- egg_debug ("console now %s", active ? "active" : "inactive");
-
- /* gone inactive */
- if (!active)
- return;
-
- /* get lid state */
- ret = gpm_button_is_lid_closed (manager->priv->button);
- if (!ret)
- return;
-
- /* lid state might not be accurate if just resumed. Don't do anything if
- * we've just resumed as we might end up re-suspending the machine due
- * to pm-utils and uswsusp changing the tty */
- if (manager->priv->just_resumed)
- return;
-
- /* get ac state */
- if (!manager->priv->on_battery) {
- egg_debug ("Performing AC policy as become active when lid down");
- gpm_manager_perform_policy (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");
- gpm_manager_perform_policy (manager, GPM_CONF_BUTTON_LID_BATT,
- "The lid has been found closed on battery power.");
-}
-
-/**
* gpm_manager_init:
* @manager: This class instance
**/
@@ -1905,10 +1867,8 @@ gpm_manager_init (GpmManager *manager)
/* init to not just_resumed */
manager->priv->just_resumed = FALSE;
- /* don't apply policy when not active */
+ /* don't apply policy when not active, so listen to ConsoleKit */
manager->priv->console = egg_console_kit_new ();
- g_signal_connect (manager->priv->console, "active-changed",
- G_CALLBACK (gpm_manager_console_kit_active_changed_cb), manager);
/* this is a singleton, so we keep a master copy open here */
manager->priv->prefs_server = gpm_prefs_server_new ();