aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJavier Jardón <javier.jardon@codethink.co.uk>2011-09-08 14:43:46 +0100
committerJavier Jardón <javier.jardon@codethink.co.uk>2011-09-08 14:43:46 +0100
commit14adfe549aed71619ad4ff784e9fb39ecfb05d78 (patch)
tree93fdd9b67dc8ef5a15c2249bb9ad1b8ca443a235 /src
parent2fb46855d00f3e0215bf1160d29672728ebccd94 (diff)
downloadayatana-indicator-power-14adfe549aed71619ad4ff784e9fb39ecfb05d78.tar.gz
ayatana-indicator-power-14adfe549aed71619ad4ff784e9fb39ecfb05d78.tar.bz2
ayatana-indicator-power-14adfe549aed71619ad4ff784e9fb39ecfb05d78.zip
Handle the case with broken batteries
The remining time is not reported with is more than 100h. This generally means that our battery is broken (never reach a fully charged status)
Diffstat (limited to 'src')
-rw-r--r--src/indicator-power.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c
index 800ac5a..3908f14 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -533,6 +533,7 @@ get_primary_device (GVariant *devices)
for (i = 0; i < n_devices; i++)
{
+ time = 0;
device = g_variant_get_child_value (devices, i);
g_variant_get (device,
"(susdut)",
@@ -561,6 +562,10 @@ get_primary_device (GVariant *devices)
else if (state == UP_DEVICE_STATE_CHARGING)
{
charging = TRUE;
+ if (time == 0) /* Battery broken */
+ {
+ primary_device_charging = device;
+ }
if (time > max_charging_time)
{
max_charging_time = time;