aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-08-22 16:15:36 +0000
committerCI bot <ps-jenkins@lists.canonical.com>2014-08-22 16:15:36 +0000
commit575a5a16fa514310d029cb3cb894f95a0836ef95 (patch)
treed8276c3e82e89fe48b08f11093feb651e45c2236
parentc7e1740203b41bb9cb12da0ea97477363224e3ee (diff)
parent9eee0b56872fdb9fcf5301525985821ea7bfb2af (diff)
downloadayatana-indicator-power-575a5a16fa514310d029cb3cb894f95a0836ef95.tar.gz
ayatana-indicator-power-575a5a16fa514310d029cb3cb894f95a0836ef95.tar.bz2
ayatana-indicator-power-575a5a16fa514310d029cb3cb894f95a0836ef95.zip
Choose the icon that's closest to the current battery charge percentage Fixes: 1186181
Approved by: Antti Kaijanmäki, PS Jenkins bot
-rw-r--r--debian/control2
-rw-r--r--src/device.c14
-rw-r--r--tests/test-device.cc16
3 files changed, 9 insertions, 23 deletions
diff --git a/debian/control b/debian/control
index 00c0864..ec440a8 100644
--- a/debian/control
+++ b/debian/control
@@ -17,7 +17,7 @@ Build-Depends: cmake,
python3-dbusmock,
dbus-test-runner,
libdbustest1-dev,
-Standards-Version: 3.9.2
+Standards-Version: 3.9.5
Homepage: https://launchpad.net/indicator-power
# If you aren't a member of ~indicator-applet-developers but need to upload
# packaging changes, just go ahead. ~indicator-applet-developers will notice
diff --git a/src/device.c b/src/device.c
index f37aa7d..eff76d1 100644
--- a/src/device.c
+++ b/src/device.c
@@ -353,13 +353,6 @@ device_kind_to_string (UpDeviceKind kind)
indicator_power_device_get_icon_names:
@device: #IndicatorPowerDevice from which to generate the icon names
- This function's logic differs from GSD's power plugin in some ways:
-
- 1. For discharging batteries, we decide whether or not to use the 'caution'
- icon based on whether or not we have <= 30 minutes remaining, rather than
- looking at the battery's percentage left.
- <https://bugs.launchpad.net/indicator-power/+bug/743823>
-
See also indicator_power_device_get_gicon().
Return value: (array zero-terminated=1) (transfer full):
@@ -423,13 +416,6 @@ indicator_power_device_get_icon_names (const IndicatorPowerDevice * device)
case UP_DEVICE_STATE_PENDING_CHARGE:
case UP_DEVICE_STATE_DISCHARGING:
case UP_DEVICE_STATE_PENDING_DISCHARGE:
- /* Don't show the caution/red icons unless we have <=30 min left.
- <https://bugs.launchpad.net/indicator-power/+bug/743823>
- Themes use the caution color when the percentage is 0% or 20%,
- so if we have >30 min left, use 30% as the icon's percentage floor */
- if (indicator_power_device_get_time (device) > (30*60))
- percentage = MAX(percentage, 30);
-
suffix_str = get_device_icon_suffix (percentage);
index_str = get_device_icon_index (percentage);
g_ptr_array_add (names, g_strdup_printf ("%s-%s", kind_str, index_str));
diff --git a/tests/test-device.cc b/tests/test-device.cc
index 81e8a22..85ba237 100644
--- a/tests/test-device.cc
+++ b/tests/test-device.cc
@@ -422,10 +422,10 @@ TEST_F(DeviceTest, IconNames)
INDICATOR_POWER_DEVICE_PERCENTAGE, 25.0,
INDICATOR_POWER_DEVICE_TIME, (guint64)(60*60),
NULL);
- g_string_append_printf (expected, "%s-040;", kind_str);
- g_string_append_printf (expected, "gpm-%s-040;", kind_str);
- g_string_append_printf (expected, "%s-good-symbolic;", kind_str);
- g_string_append_printf (expected, "%s-good", kind_str);
+ g_string_append_printf (expected, "%s-020;", kind_str);
+ g_string_append_printf (expected, "gpm-%s-020;", kind_str);
+ g_string_append_printf (expected, "%s-low-symbolic;", kind_str);
+ g_string_append_printf (expected, "%s-low", kind_str);
check_icon_names (device, expected->str);
g_string_truncate (expected, 0);
@@ -448,10 +448,10 @@ TEST_F(DeviceTest, IconNames)
INDICATOR_POWER_DEVICE_PERCENTAGE, 5.0,
INDICATOR_POWER_DEVICE_TIME, (guint64)(60*60),
NULL);
- g_string_append_printf (expected, "%s-040;", kind_str);
- g_string_append_printf (expected, "gpm-%s-040;", kind_str);
- g_string_append_printf (expected, "%s-good-symbolic;", kind_str);
- g_string_append_printf (expected, "%s-good", kind_str);
+ g_string_append_printf (expected, "%s-000;", kind_str);
+ g_string_append_printf (expected, "gpm-%s-000;", kind_str);
+ g_string_append_printf (expected, "%s-caution-symbolic;", kind_str);
+ g_string_append_printf (expected, "%s-caution", kind_str);
check_icon_names (device, expected->str);
g_string_truncate (expected, 0);