[gnome-power-manager] Don't complete critical action if power is resumed



commit d99e086a0db624a7e9c7c06643902cb3cfabfb01
Author: David Sommerseth <davids redhat com>
Date:   Fri Jun 17 16:31:14 2011 +0100

    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.
    
    Signed-off-by: Richard Hughes <richard hughsie com>

 src/gpm-manager.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 9bb0591..d0218b3 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -1185,7 +1185,12 @@ manager_critical_action_do (GpmManager *manager)
 	if (manager->priv->critical_alert_timeout_id)
 		gpm_manager_play_loop_stop (manager);
 
+	/* if power is restored before we reach here, abort */
+	if (!manager->priv->on_battery)
+		goto out;
+
 	gpm_manager_perform_policy (manager, GSD_SETTINGS_ACTION_CRITICAL_BATT, "Battery is critically low.");
+out:
 	return FALSE;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]