Hi, I've been annoyed for quite some time that GNOME Power Manager is suspending/hibernating (depending on config) my laptop when power is resumed while showing the critical action warning. This has haunted me from Fedora 11 and up to Fedora 14. I've attached a patch which solves this immediate issue. I'm not sure if it is the correct way to solve it, but it does the job pretty well. The patch is based on the last available master branch (commit 3441adb2ab21a79). If this makes sense, please include it. If it should be improved, please let me know how I can help out. kind regards, David Sommerseth
From a9fc2ba0b3f8eab7f6ed0ee6ee3b2bc788f54619 Mon Sep 17 00:00:00 2001 From: David Sommerseth <davids redhat com> Date: Sat, 28 May 2011 01:06:38 +0200 Subject: [PATCH] Don't complete critical action if power is resumed When the critical warning is displayed, the critical action will be perfomed even if power is restored. This patch adds an extra check to see if power has been restored during those 20 seconds the warning is displayed. If the power is restored in time, abort the critical action. This resolves the issue described in GNOME Bug #594739 Signed-off-by: David Sommerseth <davids redhat com> --- src/gpm-manager.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/gpm-manager.c b/src/gpm-manager.c index 9bb0591..54d05a9 100644 --- a/src/gpm-manager.c +++ b/src/gpm-manager.c @@ -1181,6 +1181,15 @@ gpm_manager_client_changed_cb (UpClient *client, GpmManager *manager) static gboolean manager_critical_action_do (GpmManager *manager) { + /* If power is restored before we reach here, abort */ + if( !manager->priv->on_battery ) { + /* Show an abort notification */ + gpm_manager_notify (manager, &manager->priv->notification_warning_low, + "Power resumed", "Aborting the previous critical power action", + GPM_MANAGER_NOTIFY_TIMEOUT_SHORT, + NULL, NOTIFY_URGENCY_NORMAL); + return FALSE; + } /* stop playing the alert as it's too late to do anything now */ if (manager->priv->critical_alert_timeout_id) gpm_manager_play_loop_stop (manager); -- 1.7.4.4
Attachment:
signature.asc
Description: OpenPGP digital signature