aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-08-23 17:56:56 +0000
committerTarmac <Unknown>2013-08-23 17:56:56 +0000
commit2e46eb4850c827e76aa4e75f9e7c80f0406b02db (patch)
treea45cb71731ba27ff4d92715f87249babd15c8170
parente079d4b70552a9cc5a44d6c8df2153cbcec1de78 (diff)
parent90f4785b783466015127e1d37627ee81de182f2f (diff)
downloadayatana-indicator-power-2e46eb4850c827e76aa4e75f9e7c80f0406b02db.tar.gz
ayatana-indicator-power-2e46eb4850c827e76aa4e75f9e7c80f0406b02db.tar.bz2
ayatana-indicator-power-2e46eb4850c827e76aa4e75f9e7c80f0406b02db.zip
Don't show the time remaining for a discharging battery if it exceeds 24 hours because it's probably an erroneous time estimate. Fixes: https://bugs.launchpad.net/bugs/1216030.
Approved by Ted Gould, PS Jenkins bot.
-rw-r--r--src/device.c4
-rw-r--r--tests/test-device.cc6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/device.c b/src/device.c
index 26b4c04..9dc4647 100644
--- a/src/device.c
+++ b/src/device.c
@@ -631,7 +631,7 @@ indicator_power_device_get_text (const IndicatorPowerDevice * device,
g_string_printf (verbose_time, _("%s to charge"), readable_timestr);
g_string_printf (accessible_time, _("%s to charge"), accessible_timestr);
}
- else if ((state == UP_DEVICE_STATE_DISCHARGING) && (time <= (60*60*12)))
+ else if ((state == UP_DEVICE_STATE_DISCHARGING) && (time <= (60*60*24)))
{
g_string_assign (terse_time, readable_timestr);
g_string_printf (verbose_time, _("%s left"), readable_timestr);
@@ -639,7 +639,7 @@ indicator_power_device_get_text (const IndicatorPowerDevice * device,
}
else
{
- /* if there's more than 12 hours remaining, we don't show it */
+ /* if there's more than 24 hours remaining, we don't show it */
}
g_free (readable_timestr);
diff --git a/tests/test-device.cc b/tests/test-device.cc
index 130ef16..0ccd8d1 100644
--- a/tests/test-device.cc
+++ b/tests/test-device.cc
@@ -523,12 +523,12 @@ TEST_F(DeviceTest, Labels)
"(50%)",
"Battery (1 hour 1 minute left, 50%)");
- // discharging, > 12 hours left
- // we don't show the clock time when > 12 hours dischargin
+ // discharging, > 24 hours left
+ // we don't show the clock time when > 24 hours discharging
g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY,
INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_DISCHARGING,
INDICATOR_POWER_DEVICE_PERCENTAGE, 50.0,
- INDICATOR_POWER_DEVICE_TIME, guint64(60*60*13),
+ INDICATOR_POWER_DEVICE_TIME, guint64(60*60*25),
NULL);
check_label (device, "Battery");
check_header (device, "(50%)",