Merge lp:~charlesk/indicator-power/lp-1186181-icon-should-match-battery-percentage into lp:indicator-power/14.10

Proposed by Charles Kerr
Status: Merged
Approved by: Antti Kaijanmäki
Approved revision: 253
Merged at revision: 256
Proposed branch: lp:~charlesk/indicator-power/lp-1186181-icon-should-match-battery-percentage
Merge into: lp:indicator-power/14.10
Diff against target: 77 lines (+9/-23)
3 files modified
debian/control (+1/-1)
src/device.c (+0/-14)
tests/test-device.cc (+8/-8)
To merge this branch: bzr merge lp:~charlesk/indicator-power/lp-1186181-icon-should-match-battery-percentage
Reviewer Review Type Date Requested Status
Antti Kaijanmäki (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+228692@code.launchpad.net

Commit message

Choose the icon that's closest to the current battery charge percentage

Description of the change

Choose the icon that's closest to the current battery charge percentage.

This patch removes code that chose the "40% charge" icon if >30 minutes were left on the battery, no matter how low the actual % charge was. This can be confusing now that we actually show the numeric percentage as well.

https://bugs.launchpad.net/ubuntu-ux/+bug/1186181/comments/12 has background on why the code previously chose the 40% icon.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

LGTM.

review: Approve
254. By Charles Kerr

sync with trunk.

255. By Charles Kerr

in debian/control, bump standards version from 3.9.2 to 3.9.5 to make lintian happy

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-07-21 23:12:11 +0000
3+++ debian/control 2014-08-22 15:04:06 +0000
4@@ -17,7 +17,7 @@
5 python3-dbusmock,
6 dbus-test-runner,
7 libdbustest1-dev,
8-Standards-Version: 3.9.2
9+Standards-Version: 3.9.5
10 Homepage: https://launchpad.net/indicator-power
11 # If you aren't a member of ~indicator-applet-developers but need to upload
12 # packaging changes, just go ahead. ~indicator-applet-developers will notice
13
14=== modified file 'src/device.c'
15--- src/device.c 2014-07-14 04:33:16 +0000
16+++ src/device.c 2014-08-22 15:04:06 +0000
17@@ -353,13 +353,6 @@
18 indicator_power_device_get_icon_names:
19 @device: #IndicatorPowerDevice from which to generate the icon names
20
21- This function's logic differs from GSD's power plugin in some ways:
22-
23- 1. For discharging batteries, we decide whether or not to use the 'caution'
24- icon based on whether or not we have <= 30 minutes remaining, rather than
25- looking at the battery's percentage left.
26- <https://bugs.launchpad.net/indicator-power/+bug/743823>
27-
28 See also indicator_power_device_get_gicon().
29
30 Return value: (array zero-terminated=1) (transfer full):
31@@ -423,13 +416,6 @@
32 case UP_DEVICE_STATE_PENDING_CHARGE:
33 case UP_DEVICE_STATE_DISCHARGING:
34 case UP_DEVICE_STATE_PENDING_DISCHARGE:
35- /* Don't show the caution/red icons unless we have <=30 min left.
36- <https://bugs.launchpad.net/indicator-power/+bug/743823>
37- Themes use the caution color when the percentage is 0% or 20%,
38- so if we have >30 min left, use 30% as the icon's percentage floor */
39- if (indicator_power_device_get_time (device) > (30*60))
40- percentage = MAX(percentage, 30);
41-
42 suffix_str = get_device_icon_suffix (percentage);
43 index_str = get_device_icon_index (percentage);
44 g_ptr_array_add (names, g_strdup_printf ("%s-%s", kind_str, index_str));
45
46=== modified file 'tests/test-device.cc'
47--- tests/test-device.cc 2014-07-17 19:46:23 +0000
48+++ tests/test-device.cc 2014-08-22 15:04:06 +0000
49@@ -422,10 +422,10 @@
50 INDICATOR_POWER_DEVICE_PERCENTAGE, 25.0,
51 INDICATOR_POWER_DEVICE_TIME, (guint64)(60*60),
52 NULL);
53- g_string_append_printf (expected, "%s-040;", kind_str);
54- g_string_append_printf (expected, "gpm-%s-040;", kind_str);
55- g_string_append_printf (expected, "%s-good-symbolic;", kind_str);
56- g_string_append_printf (expected, "%s-good", kind_str);
57+ g_string_append_printf (expected, "%s-020;", kind_str);
58+ g_string_append_printf (expected, "gpm-%s-020;", kind_str);
59+ g_string_append_printf (expected, "%s-low-symbolic;", kind_str);
60+ g_string_append_printf (expected, "%s-low", kind_str);
61 check_icon_names (device, expected->str);
62 g_string_truncate (expected, 0);
63
64@@ -448,10 +448,10 @@
65 INDICATOR_POWER_DEVICE_PERCENTAGE, 5.0,
66 INDICATOR_POWER_DEVICE_TIME, (guint64)(60*60),
67 NULL);
68- g_string_append_printf (expected, "%s-040;", kind_str);
69- g_string_append_printf (expected, "gpm-%s-040;", kind_str);
70- g_string_append_printf (expected, "%s-good-symbolic;", kind_str);
71- g_string_append_printf (expected, "%s-good", kind_str);
72+ g_string_append_printf (expected, "%s-000;", kind_str);
73+ g_string_append_printf (expected, "gpm-%s-000;", kind_str);
74+ g_string_append_printf (expected, "%s-caution-symbolic;", kind_str);
75+ g_string_append_printf (expected, "%s-caution", kind_str);
76 check_icon_names (device, expected->str);
77 g_string_truncate (expected, 0);
78

Subscribers

People subscribed via source and target branches