From 14adfe549aed71619ad4ff784e9fb39ecfb05d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Thu, 8 Sep 2011 14:43:46 +0100 Subject: 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) --- src/indicator-power.c | 5 +++++ 1 file changed, 5 insertions(+) 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; -- cgit v1.2.3