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.
Revision history for this message
Ted Gould (ted) wrote :

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

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/device.c'
--- src/device.c 2013-08-23 17:07:06 +0000
+++ src/device.c 2013-10-01 14:13:24 +0000
@@ -328,10 +328,7 @@
328328
329 This function's logic differs from GSD's power plugin in some ways:329 This function's logic differs from GSD's power plugin in some ways:
330330
331 1. All charging batteries use the same icon regardless of progress.331 1. For discharging batteries, we decide whether or not to use the 'caution'
332 <https://bugs.launchpad.net/indicator-power/+bug/824629/comments/7>
333
334 2. For discharging batteries, we decide whether or not to use the 'caution'
335 icon based on whether or not we have <= 30 minutes remaining, rather than332 icon based on whether or not we have <= 30 minutes remaining, rather than
336 looking at the battery's percentage left.333 looking at the battery's percentage left.
337 <https://bugs.launchpad.net/indicator-power/+bug/743823>334 <https://bugs.launchpad.net/indicator-power/+bug/743823>
@@ -389,10 +386,6 @@
389386
390 case UP_DEVICE_STATE_CHARGING:387 case UP_DEVICE_STATE_CHARGING:
391 case UP_DEVICE_STATE_PENDING_CHARGE:388 case UP_DEVICE_STATE_PENDING_CHARGE:
392 /* When charging, always use the same icon regardless of percentage.
393 <http://bugs.launchpad.net/indicator-power/+bug/824629> */
394 percentage = 0;
395
396 suffix_str = get_device_icon_suffix (percentage);389 suffix_str = get_device_icon_suffix (percentage);
397 index_str = get_device_icon_index (percentage);390 index_str = get_device_icon_index (percentage);
398 g_ptr_array_add (names, g_strdup_printf ("%s-%s-charging-symbolic", kind_str, suffix_str));391 g_ptr_array_add (names, g_strdup_printf ("%s-%s-charging-symbolic", kind_str, suffix_str));
399392
=== modified file 'tests/test-device.cc'
--- tests/test-device.cc 2013-08-23 17:10:26 +0000
+++ tests/test-device.cc 2013-10-01 14:13:24 +0000
@@ -318,9 +318,9 @@
318 INDICATOR_POWER_DEVICE_PERCENTAGE, 95.0,318 INDICATOR_POWER_DEVICE_PERCENTAGE, 95.0,
319 NULL);319 NULL);
320320
321 g_string_append_printf (expected, "%s-caution-charging-symbolic;", kind_str);321 g_string_append_printf (expected, "%s-full-charging-symbolic;", kind_str);
322 g_string_append_printf (expected, "gpm-%s-000-charging;", kind_str);322 g_string_append_printf (expected, "gpm-%s-100-charging;", kind_str);
323 g_string_append_printf (expected, "%s-caution-charging", kind_str);323 g_string_append_printf (expected, "%s-full-charging", kind_str);
324 check_icon_names (device, expected->str);324 check_icon_names (device, expected->str);
325 g_string_truncate (expected, 0);325 g_string_truncate (expected, 0);
326326
@@ -329,9 +329,9 @@
329 INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING,329 INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING,
330 INDICATOR_POWER_DEVICE_PERCENTAGE, 85.0,330 INDICATOR_POWER_DEVICE_PERCENTAGE, 85.0,
331 NULL);331 NULL);
332 g_string_append_printf (expected, "%s-caution-charging-symbolic;", kind_str);332 g_string_append_printf (expected, "%s-full-charging-symbolic;", kind_str);
333 g_string_append_printf (expected, "gpm-%s-000-charging;", kind_str);333 g_string_append_printf (expected, "gpm-%s-080-charging;", kind_str);
334 g_string_append_printf (expected, "%s-caution-charging", kind_str);334 g_string_append_printf (expected, "%s-full-charging", kind_str);
335 check_icon_names (device, expected->str);335 check_icon_names (device, expected->str);
336 g_string_truncate (expected, 0);336 g_string_truncate (expected, 0);
337337
@@ -340,9 +340,9 @@
340 INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING,340 INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING,
341 INDICATOR_POWER_DEVICE_PERCENTAGE, 50.0,341 INDICATOR_POWER_DEVICE_PERCENTAGE, 50.0,
342 NULL);342 NULL);
343 g_string_append_printf (expected, "%s-caution-charging-symbolic;", kind_str);343 g_string_append_printf (expected, "%s-good-charging-symbolic;", kind_str);
344 g_string_append_printf (expected, "gpm-%s-000-charging;", kind_str);344 g_string_append_printf (expected, "gpm-%s-060-charging;", kind_str);
345 g_string_append_printf (expected, "%s-caution-charging", kind_str);345 g_string_append_printf (expected, "%s-good-charging", kind_str);
346 check_icon_names (device, expected->str);346 check_icon_names (device, expected->str);
347 g_string_truncate (expected, 0);347 g_string_truncate (expected, 0);
348348
@@ -351,9 +351,9 @@
351 INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING,351 INDICATOR_POWER_DEVICE_STATE, UP_DEVICE_STATE_CHARGING,
352 INDICATOR_POWER_DEVICE_PERCENTAGE, 25.0,352 INDICATOR_POWER_DEVICE_PERCENTAGE, 25.0,
353 NULL);353 NULL);
354 g_string_append_printf (expected, "%s-caution-charging-symbolic;", kind_str);354 g_string_append_printf (expected, "%s-low-charging-symbolic;", kind_str);
355 g_string_append_printf (expected, "gpm-%s-000-charging;", kind_str);355 g_string_append_printf (expected, "gpm-%s-020-charging;", kind_str);
356 g_string_append_printf (expected, "%s-caution-charging", kind_str);356 g_string_append_printf (expected, "%s-low-charging", kind_str);
357 check_icon_names (device, expected->str);357 check_icon_names (device, expected->str);
358 g_string_truncate (expected, 0);358 g_string_truncate (expected, 0);
359359

Subscribers

People subscribed via source and target branches