Merge lp:~charlesk/indicator-power/lp-1215520 into lp:indicator-power/13.10

Proposed by Charles Kerr
Status: Merged
Approved by: Ted Gould
Approved revision: 203
Merged at revision: 203
Proposed branch: lp:~charlesk/indicator-power/lp-1215520
Merge into: lp:indicator-power/13.10
Diff against target: 81 lines (+13/-20)
2 files modified
src/device.c (+1/-8)
tests/test-device.cc (+12/-12)
To merge this branch: bzr merge lp:~charlesk/indicator-power/lp-1215520
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Ted Gould (community) Approve
Review via email: mp+188608@code.launchpad.net

Commit message

Revert bug #824629 code -- use the correct charge % when deciding what icon to use.

Description of the change

As described in bug #824629, on the Desktop it's sometimes difficult to tell whether a battery is charging or discharging because the lightning bolt is a little hard to see when laid against the background of a charged battery. The (IMO ugly) workaround at the time was to always use a nearly-empty battery icon so that the pixels beneath the lightning bolt were blank, making it easier to see.

The drawback of this approach is that the icon no longer gives useful information about the battery charge. This occurs on both desktop and tablet, but is more visible on the tablet because it has clearer icons.

This MP reverts the 824629 code to use the correct charge % when deciding what icon to use.

To post a comment you must log in.
Ted Gould (ted) wrote :

Seems like a gain overall. Hopefully the icons will get fixed in the icon theme.

review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/device.c'
2--- src/device.c 2013-08-23 17:07:06 +0000
3+++ src/device.c 2013-10-01 14:13:24 +0000
4@@ -328,10 +328,7 @@
5
6 This function's logic differs from GSD's power plugin in some ways:
7
8- 1. All charging batteries use the same icon regardless of progress.
9- <https://bugs.launchpad.net/indicator-power/+bug/824629/comments/7>
10-
11- 2. For discharging batteries, we decide whether or not to use the 'caution'
12+ 1. For discharging batteries, we decide whether or not to use the 'caution'
13 icon based on whether or not we have <= 30 minutes remaining, rather than
14 looking at the battery's percentage left.
15 <https://bugs.launchpad.net/indicator-power/+bug/743823>
16@@ -389,10 +386,6 @@
17
18 case UP_DEVICE_STATE_CHARGING:
19 case UP_DEVICE_STATE_PENDING_CHARGE:
20- /* When charging, always use the same icon regardless of percentage.
21- <http://bugs.launchpad.net/indicator-power/+bug/824629> */
22- percentage = 0;
23-
24 suffix_str = get_device_icon_suffix (percentage);
25 index_str = get_device_icon_index (percentage);
26 g_ptr_array_add (names, g_strdup_printf ("%s-%s-charging-symbolic", kind_str, suffix_str));
27
28=== modified file 'tests/test-device.cc'
29--- tests/test-device.cc 2013-08-23 17:10:26 +0000
30+++ tests/test-device.cc 2013-10-01 14:13:24 +0000
31@@ -318,9 +318,9 @@
32 INDICATOR_POWER_DEVICE_PERCENTAGE, 95.0,
33 NULL);
34
35- g_string_append_printf (expected, "%s-caution-charging-symbolic;", kind_str);
36- g_string_append_printf (expected, "gpm-%s-000-charging;", kind_str);
37- g_string_append_printf (expected, "%s-caution-charging", kind_str);
38+ g_string_append_printf (expected, "%s-full-charging-symbolic;", kind_str);
39+ g_string_append_printf (expected, "gpm-%s-100-charging;", kind_str);
40+ g_string_append_printf (expected, "%s-full-charging", kind_str);
41 check_icon_names (device, expected->str);
42 g_string_truncate (expected, 0);
43
44@@ -329,9 +329,9 @@
45 INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING,
46 INDICATOR_POWER_DEVICE_PERCENTAGE, 85.0,
47 NULL);
48- g_string_append_printf (expected, "%s-caution-charging-symbolic;", kind_str);
49- g_string_append_printf (expected, "gpm-%s-000-charging;", kind_str);
50- g_string_append_printf (expected, "%s-caution-charging", kind_str);
51+ g_string_append_printf (expected, "%s-full-charging-symbolic;", kind_str);
52+ g_string_append_printf (expected, "gpm-%s-080-charging;", kind_str);
53+ g_string_append_printf (expected, "%s-full-charging", kind_str);
54 check_icon_names (device, expected->str);
55 g_string_truncate (expected, 0);
56
57@@ -340,9 +340,9 @@
58 INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING,
59 INDICATOR_POWER_DEVICE_PERCENTAGE, 50.0,
60 NULL);
61- g_string_append_printf (expected, "%s-caution-charging-symbolic;", kind_str);
62- g_string_append_printf (expected, "gpm-%s-000-charging;", kind_str);
63- g_string_append_printf (expected, "%s-caution-charging", kind_str);
64+ g_string_append_printf (expected, "%s-good-charging-symbolic;", kind_str);
65+ g_string_append_printf (expected, "gpm-%s-060-charging;", kind_str);
66+ g_string_append_printf (expected, "%s-good-charging", kind_str);
67 check_icon_names (device, expected->str);
68 g_string_truncate (expected, 0);
69
70@@ -351,9 +351,9 @@
71 INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING,
72 INDICATOR_POWER_DEVICE_PERCENTAGE, 25.0,
73 NULL);
74- g_string_append_printf (expected, "%s-caution-charging-symbolic;", kind_str);
75- g_string_append_printf (expected, "gpm-%s-000-charging;", kind_str);
76- g_string_append_printf (expected, "%s-caution-charging", kind_str);
77+ g_string_append_printf (expected, "%s-low-charging-symbolic;", kind_str);
78+ g_string_append_printf (expected, "gpm-%s-020-charging;", kind_str);
79+ g_string_append_printf (expected, "%s-low-charging", kind_str);
80 check_icon_names (device, expected->str);
81 g_string_truncate (expected, 0);
82

Subscribers

People subscribed via source and target branches