aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-power.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-11-04 11:46:50 -0600
committerCharles Kerr <charles.kerr@canonical.com>2012-11-04 11:46:50 -0600
commit2fa0264ed6bda32604d90471797df6fa1c29fa7b (patch)
tree53100735d35548be72df62e5cacd0cabf800ef89 /src/indicator-power.c
parent681e4e979ea8964279b99550f080b5df1c4eccf0 (diff)
parent7d558ffe8277e88dab2c4367b496fbf98a257cc1 (diff)
downloadayatana-indicator-power-2fa0264ed6bda32604d90471797df6fa1c29fa7b.tar.gz
ayatana-indicator-power-2fa0264ed6bda32604d90471797df6fa1c29fa7b.tar.bz2
ayatana-indicator-power-2fa0264ed6bda32604d90471797df6fa1c29fa7b.zip
fix logic error in primary device selection; add unit tests to confirm the fix. (lp:~charlesk/indicator-power/lp-1071757)
Diffstat (limited to 'src/indicator-power.c')
-rw-r--r--src/indicator-power.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c
index 852ccd5..4118dcc 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -399,11 +399,11 @@ device_compare_func (gconstpointer ga, gconstpointer gb)
state = UP_DEVICE_STATE_CHARGING;
if (!ret && (((a_state == state) && a_time) || ((b_state == state) && b_time)))
{
- if (b_state != state) /* a is charging */
+ if (a_state != state) /* b is charging */
{
ret = 1;
}
- if (a_state != state) /* b is charging */
+ else if (b_state != state) /* a is charging */
{
ret = -1;
}