From 3fe1d262f1947ca126a85bdc165a14ee6f26cc4a Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 1 Oct 2013 09:05:32 -0500 Subject: use the correct battery icon when charging/discharging --- src/device.c | 9 +-------- tests/test-device.cc | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/device.c b/src/device.c index 9dc4647..508a734 100644 --- a/src/device.c +++ b/src/device.c @@ -328,10 +328,7 @@ device_kind_to_string (UpDeviceKind kind) This function's logic differs from GSD's power plugin in some ways: - 1. All charging batteries use the same icon regardless of progress. - - - 2. For discharging batteries, we decide whether or not to use the 'caution' + 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. @@ -389,10 +386,6 @@ indicator_power_device_get_icon_names (const IndicatorPowerDevice * device) case UP_DEVICE_STATE_CHARGING: case UP_DEVICE_STATE_PENDING_CHARGE: - /* When charging, always use the same icon regardless of percentage. - */ - percentage = 0; - suffix_str = get_device_icon_suffix (percentage); index_str = get_device_icon_index (percentage); g_ptr_array_add (names, g_strdup_printf ("%s-%s-charging-symbolic", kind_str, suffix_str)); diff --git a/tests/test-device.cc b/tests/test-device.cc index 0ccd8d1..2762d4a 100644 --- a/tests/test-device.cc +++ b/tests/test-device.cc @@ -318,9 +318,9 @@ TEST_F(DeviceTest, IconNames) INDICATOR_POWER_DEVICE_PERCENTAGE, 95.0, NULL); - g_string_append_printf (expected, "%s-caution-charging-symbolic;", kind_str); - g_string_append_printf (expected, "gpm-%s-000-charging;", kind_str); - g_string_append_printf (expected, "%s-caution-charging", kind_str); + g_string_append_printf (expected, "%s-full-charging-symbolic;", kind_str); + g_string_append_printf (expected, "gpm-%s-100-charging;", kind_str); + g_string_append_printf (expected, "%s-full-charging", kind_str); check_icon_names (device, expected->str); g_string_truncate (expected, 0); @@ -329,9 +329,9 @@ TEST_F(DeviceTest, IconNames) INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING, INDICATOR_POWER_DEVICE_PERCENTAGE, 85.0, NULL); - g_string_append_printf (expected, "%s-caution-charging-symbolic;", kind_str); - g_string_append_printf (expected, "gpm-%s-000-charging;", kind_str); - g_string_append_printf (expected, "%s-caution-charging", kind_str); + g_string_append_printf (expected, "%s-full-charging-symbolic;", kind_str); + g_string_append_printf (expected, "gpm-%s-080-charging;", kind_str); + g_string_append_printf (expected, "%s-full-charging", kind_str); check_icon_names (device, expected->str); g_string_truncate (expected, 0); @@ -340,9 +340,9 @@ TEST_F(DeviceTest, IconNames) INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING, INDICATOR_POWER_DEVICE_PERCENTAGE, 50.0, NULL); - g_string_append_printf (expected, "%s-caution-charging-symbolic;", kind_str); - g_string_append_printf (expected, "gpm-%s-000-charging;", kind_str); - g_string_append_printf (expected, "%s-caution-charging", kind_str); + g_string_append_printf (expected, "%s-good-charging-symbolic;", kind_str); + g_string_append_printf (expected, "gpm-%s-060-charging;", kind_str); + g_string_append_printf (expected, "%s-good-charging", kind_str); check_icon_names (device, expected->str); g_string_truncate (expected, 0); @@ -351,9 +351,9 @@ TEST_F(DeviceTest, IconNames) INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING, INDICATOR_POWER_DEVICE_PERCENTAGE, 25.0, NULL); - g_string_append_printf (expected, "%s-caution-charging-symbolic;", kind_str); - g_string_append_printf (expected, "gpm-%s-000-charging;", kind_str); - g_string_append_printf (expected, "%s-caution-charging", kind_str); + g_string_append_printf (expected, "%s-low-charging-symbolic;", kind_str); + g_string_append_printf (expected, "gpm-%s-020-charging;", kind_str); + g_string_append_printf (expected, "%s-low-charging", kind_str); check_icon_names (device, expected->str); g_string_truncate (expected, 0); -- cgit v1.2.3