diff options
author | Javier Jardón <javier.jardon@codethink.co.uk> | 2011-09-08 14:43:46 +0100 |
---|---|---|
committer | Javier Jardón <javier.jardon@codethink.co.uk> | 2011-09-08 14:43:46 +0100 |
commit | 14adfe549aed71619ad4ff784e9fb39ecfb05d78 (patch) | |
tree | 93fdd9b67dc8ef5a15c2249bb9ad1b8ca443a235 | |
parent | 2fb46855d00f3e0215bf1160d29672728ebccd94 (diff) | |
download | ayatana-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)
-rw-r--r-- | src/indicator-power.c | 5 |
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; |