[Xfce4-commits] <xfce4-power-manager:master> Avoid two hibernate because of low power in one row.
Ali Abdallah
noreply at xfce.org
Tue Feb 15 10:04:05 CET 2011
Updating branch refs/heads/master
to 614083b9cbe37c26a69049803394305fe00b8969 (commit)
from 0f99e9e7b82c2439438cec01ff0dbf0e45b21b83 (commit)
commit 614083b9cbe37c26a69049803394305fe00b8969
Author: Ali Abdallah <aliov at xfce.org>
Date: Mon Feb 14 14:31:08 2011 +0100
Avoid two hibernate because of low power in one row.
src/xfpm-power.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/xfpm-power.c b/src/xfpm-power.c
index b0bf5c9..2a37601 100644
--- a/src/xfpm-power.c
+++ b/src/xfpm-power.c
@@ -79,7 +79,8 @@ struct XfpmPowerPrivate
XfpmXfconf *conf;
GtkStatusIcon *adapter_icon;
- XfpmBatterState overall_state;
+ XfpmBatteryCharge overall_state;
+ gboolean critical_action_done;
gboolean inhibited;
@@ -802,7 +803,15 @@ xfpm_power_system_on_critical_power (XfpmPower *power, XfpmBattery *battery)
}
else
{
- xfpm_power_process_critical_action (power, critical_action);
+ if (power->priv->critical_action_done == FALSE)
+ {
+ power->priv->critical_action_done = TRUE;
+ xfpm_power_process_critical_action (power, critical_action);
+ }
+ else
+ {
+ xfpm_power_show_critical_action (power, battery);
+ }
}
}
@@ -821,7 +830,10 @@ xfpm_power_battery_charge_changed_cb (XfpmBattery *battery, XfpmPower *power)
if (current_charge == power->priv->overall_state)
return;
- power->priv->overall_state = current_state;
+ if (current_charge >= XFPM_BATTERY_CHARGE_LOW)
+ power->priv->critical_action_done = FALSE;
+
+ power->priv->overall_state = current_charge;
if ( current_charge == XFPM_BATTERY_CHARGE_CRITICAL && power->priv->on_battery)
{
@@ -1229,6 +1241,7 @@ xfpm_power_init (XfpmPower *power)
power->priv->dialog = NULL;
power->priv->adapter_icon = NULL;
power->priv->overall_state = XFPM_BATTERY_CHARGE_OK;
+ power->priv->critical_action_done = FALSE;
power->priv->inhibit = xfpm_inhibit_new ();
power->priv->notify = xfpm_notify_new ();
More information about the Xfce4-commits
mailing list