diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2012-10-03 11:30:18 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2012-10-03 11:30:18 -0500 |
commit | 2b046e762cb8166c9b11af187835126094ff118d (patch) | |
tree | cd6fa6a396d2e634436cadb0b9cddbb9d2f5cc5e | |
parent | b226f3fd6efdb883507ba798a33e5974331d1e85 (diff) | |
download | ayatana-indicator-power-2b046e762cb8166c9b11af187835126094ff118d.tar.gz ayatana-indicator-power-2b046e762cb8166c9b11af187835126094ff118d.tar.bz2 ayatana-indicator-power-2b046e762cb8166c9b11af187835126094ff118d.zip |
when discharging the battery, prefer the percent-charged icons over the full,good,low icons because the former show a more accurate view of the charge.
-rw-r--r-- | src/device.c | 3 | ||||
-rw-r--r-- | tests/test-device.cc | 22 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/device.c b/src/device.c index 078c7a4..898e18f 100644 --- a/src/device.c +++ b/src/device.c @@ -390,8 +390,9 @@ indicator_power_device_get_icon_names (const IndicatorPowerDevice * device) suffix_str = get_device_icon_suffix (percentage); index_str = get_device_icon_index (percentage); - g_ptr_array_add (names, g_strdup_printf ("battery-%s-symbolic", suffix_str)); + g_ptr_array_add (names, g_strdup_printf ("%s-%s", kind_str, index_str)); g_ptr_array_add (names, g_strdup_printf ("gpm-%s-%s", kind_str, index_str)); + g_ptr_array_add (names, g_strdup_printf ("battery-%s-symbolic", suffix_str)); g_ptr_array_add (names, g_strdup_printf ("battery-%s", suffix_str)); break; diff --git a/tests/test-device.cc b/tests/test-device.cc index 728010d..eb087dc 100644 --- a/tests/test-device.cc +++ b/tests/test-device.cc @@ -310,8 +310,9 @@ TEST_F(DeviceTest, IconNames) INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_DISCHARGING, INDICATOR_POWER_DEVICE_PERCENTAGE, 95.0, NULL); - check_icon_names (device, "battery-full-symbolic;" + check_icon_names (device, "battery-100;" "gpm-battery-100;" + "battery-full-symbolic;" "battery-full"); // discharging battery, 85% @@ -319,8 +320,9 @@ TEST_F(DeviceTest, IconNames) INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_DISCHARGING, INDICATOR_POWER_DEVICE_PERCENTAGE, 85.0, NULL); - check_icon_names (device, "battery-full-symbolic;" + check_icon_names (device, "battery-080;" "gpm-battery-080;" + "battery-full-symbolic;" "battery-full"); // discharging battery, 50% -- 1 hour left @@ -329,8 +331,9 @@ TEST_F(DeviceTest, IconNames) INDICATOR_POWER_DEVICE_PERCENTAGE, 50.0, INDICATOR_POWER_DEVICE_TIME, (guint64)(60*60), NULL); - check_icon_names (device, "battery-good-symbolic;" + check_icon_names (device, "battery-060;" "gpm-battery-060;" + "battery-good-symbolic;" "battery-good"); // discharging battery, 25% -- 1 hour left @@ -339,8 +342,9 @@ TEST_F(DeviceTest, IconNames) INDICATOR_POWER_DEVICE_PERCENTAGE, 25.0, INDICATOR_POWER_DEVICE_TIME, (guint64)(60*60), NULL); - check_icon_names (device, "battery-good-symbolic;" + check_icon_names (device, "battery-040;" "gpm-battery-040;" + "battery-good-symbolic;" "battery-good"); // discharging battery, 25% -- 15 minutes left @@ -349,8 +353,9 @@ TEST_F(DeviceTest, IconNames) INDICATOR_POWER_DEVICE_PERCENTAGE, 25.0, INDICATOR_POWER_DEVICE_TIME, (guint64)(60*15), NULL); - check_icon_names (device, "battery-low-symbolic;" + check_icon_names (device, "battery-020;" "gpm-battery-020;" + "battery-low-symbolic;" "battery-low"); // discharging battery, 5% -- 1 hour left @@ -359,8 +364,9 @@ TEST_F(DeviceTest, IconNames) INDICATOR_POWER_DEVICE_PERCENTAGE, 5.0, INDICATOR_POWER_DEVICE_TIME, (guint64)(60*60), NULL); - check_icon_names (device, "battery-good-symbolic;" + check_icon_names (device, "battery-040;" "gpm-battery-040;" + "battery-good-symbolic;" "battery-good"); // discharging battery, 5% -- 15 minutes left @@ -369,9 +375,11 @@ TEST_F(DeviceTest, IconNames) INDICATOR_POWER_DEVICE_PERCENTAGE, 5.0, INDICATOR_POWER_DEVICE_TIME, (guint64)(60*15), NULL); - check_icon_names (device, "battery-caution-symbolic;" + check_icon_names (device, "battery-000;" "gpm-battery-000;" + "battery-caution-symbolic;" "battery-caution"); + // state unknown g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY, INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_UNKNOWN, |