aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2012-11-14 11:09:49 +0100
committerSebastien Bacher <seb128@ubuntu.com>2012-11-14 11:09:49 +0100
commit7ef9fc96bc96d178d84930a466fa8b1f214cfdcf (patch)
tree8e73a42fb7cc85d32f256e954d11962718bf8dbb
parent74bed2a1ceda75184dbc174b457f5d09d3dd47f0 (diff)
parentfb0e7bddb26dfa7b9163754269341c1449be821d (diff)
downloadayatana-indicator-power-7ef9fc96bc96d178d84930a466fa8b1f214cfdcf.tar.gz
ayatana-indicator-power-7ef9fc96bc96d178d84930a466fa8b1f214cfdcf.tar.bz2
ayatana-indicator-power-7ef9fc96bc96d178d84930a466fa8b1f214cfdcf.zip
* New upstream release:
- Fix a device display bug introduced in 12.10.3 (LP: #1075192)
-rw-r--r--AUTHORS1
-rw-r--r--ChangeLog52
-rw-r--r--NEWS3
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--debian/changelog7
-rw-r--r--src/device.c2
-rw-r--r--src/indicator-power.c43
-rw-r--r--tests/test-device.cc29
9 files changed, 134 insertions, 25 deletions
diff --git a/AUTHORS b/AUTHORS
index abbb7a4..a8a9e18 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -10,4 +10,5 @@
Lars Uebernickel
Marco Trevisan (TreviƱo)
Michael Terry
+ Tarmac
Ted Gould
diff --git a/ChangeLog b/ChangeLog
index 5fcc09a..35b1563 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,57 @@
# Generated by Makefile. Do not edit.
+2012-11-13 Charles Kerr <charles.kerr@canonical.com>
+
+ bump NEWS
+
+2012-11-13 Charles Kerr <charles.kerr@canonical.com>
+
+ 12.10.5
+
+2012-11-13 Charles Kerr <charles.kerr@canonical.com>
+
+ backport the 'AC Adapter shown in panel' bugfix from trunk/13.04
+
+2012-11-08 Charles Kerr <charles.kerr@canonical.com>
+
+ add 'check-news' to AM_INIT_AUTOMAKE
+
+2012-11-07 Charles Kerr <charles.kerr@canonical.com>
+
+ Handle choosing a primary device when no device is charging nor discharging. Fixes: https://bugs.launchpad.net/bugs/1075192.
+
+ Approved by Lars Uebernickel, PS Jenkins bot.
+
+2012-11-07 Charles Kerr <charles.kerr@canonical.com>
+
+ change indicator_power_device_get_time_details() s.t. the 'short details' for an AC Adapter is an empty string.
+
+2012-11-07 Charles Kerr <charles.kerr@canonical.com>
+
+ modify DeviceTest.Labels s.t. it fails (currently failing) if the 'short' string for an AC Adapter is nonempty.
+
+2012-11-06 Charles Kerr <charles.kerr@canonical.com>
+
+ when choosing a primary device from devices that are neither charging nor discharging, prefer batteries, then everything except line-power, then line power
+
+2012-11-06 Charles Kerr <charles.kerr@canonical.com>
+
+ in TestDevice.ChoosePrimary, add another test (currently failing) to confirm that when indicator-datetime is choosing from devices that are neither charging nor discharging, batteries are more interesting than other devices, and other devices are more interesting than UP_DEVICE_KIND_LINE_POWER
+
+2012-11-06 Charles Kerr <charles.kerr@canonical.com>
+
+ when choosing between two devices, always pick the one that's not a UP_DEVICE_KIND_LINE_POWER
+
+2012-11-06 Charles Kerr <charles.kerr@canonical.com>
+
+ add unit test (currently failing) to test for the bug reported in LP bug #1075192
+
+2012-10-29 Charles Kerr <charles.kerr@canonical.com>
+
+ Fix the logic error. Add tests to confirm the fix. Fixes: https://bugs.launchpad.net/bugs/1071757.
+
+ Approved by Lars Uebernickel, PS Jenkins bot.
+
2012-11-04 Charles Kerr <charles.kerr@canonical.com>
12.10.4
diff --git a/NEWS b/NEWS
index e068a49..255db6f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+12.10.5
+ - Fix a device display bug introduced in 12.10.3 (LP: #1075192)
+
12.10.4
- Fix primary device selection bug introduced in 12.10.3 (LP: #1071757)
diff --git a/configure b/configure
index 78ed247..dd325f5 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for indicator-power 12.10.4.
+# Generated by GNU Autoconf 2.69 for indicator-power 12.10.5.
#
# Report bugs to <http://bugs.launchpad.net/indicator-power>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='indicator-power'
PACKAGE_TARNAME='indicator-power'
-PACKAGE_VERSION='12.10.4'
-PACKAGE_STRING='indicator-power 12.10.4'
+PACKAGE_VERSION='12.10.5'
+PACKAGE_STRING='indicator-power 12.10.5'
PACKAGE_BUGREPORT='http://bugs.launchpad.net/indicator-power'
PACKAGE_URL='http://launchpad.net/indicator-power'
@@ -1442,7 +1442,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures indicator-power 12.10.4 to adapt to many kinds of systems.
+\`configure' configures indicator-power 12.10.5 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1512,7 +1512,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of indicator-power 12.10.4:";;
+ short | recursive ) echo "Configuration of indicator-power 12.10.5:";;
esac
cat <<\_ACEOF
@@ -1666,7 +1666,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-indicator-power configure 12.10.4
+indicator-power configure 12.10.5
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2202,7 +2202,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by indicator-power $as_me 12.10.4, which was
+It was created by indicator-power $as_me 12.10.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3026,7 +3026,7 @@ fi
# Define the identity of the package.
PACKAGE='indicator-power'
- VERSION='12.10.4'
+ VERSION='12.10.5'
cat >>confdefs.h <<_ACEOF
@@ -25191,7 +25191,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by indicator-power $as_me 12.10.4, which was
+This file was extended by indicator-power $as_me 12.10.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -25258,7 +25258,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-indicator-power config.status 12.10.4
+indicator-power config.status 12.10.5
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 9a0e06c..476a4f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_INIT([indicator-power],
- [12.10.4],
+ [12.10.5],
[http://bugs.launchpad.net/indicator-power],
[indicator-power],
[http://launchpad.net/indicator-power])
diff --git a/debian/changelog b/debian/changelog
index c7d1a85..8d2db74 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+indicator-power (12.10.5-0ubuntu1) UNRELEASED; urgency=low
+
+ * New upstream release:
+ - Fix a device display bug introduced in 12.10.3 (LP: #1075192)
+
+ -- Sebastien Bacher <seb128@ubuntu.com> Wed, 14 Nov 2012 11:08:14 +0100
+
indicator-power (12.10.4-0ubuntu1) raring; urgency=low
* New upstream release.
diff --git a/src/device.c b/src/device.c
index 490ff1a..d028ab7 100644
--- a/src/device.c
+++ b/src/device.c
@@ -612,7 +612,7 @@ indicator_power_device_get_time_details (const IndicatorPowerDevice * device,
{
*details = g_strdup (device_name);
*accessible_name = g_strdup (device_name);
- *short_details = g_strdup (device_name);
+ *short_details = g_strdup ("");
}
else
{
diff --git a/src/indicator-power.c b/src/indicator-power.c
index 4118dcc..06f1c2e 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -352,12 +352,38 @@ build_menu (IndicatorPower *self)
gtk_widget_show_all (GTK_WIDGET (priv->menu));
}
+/* the higher the weight, the more interesting the device */
+static int
+get_device_kind_weight (const IndicatorPowerDevice * device)
+{
+ UpDeviceKind kind;
+ static gboolean initialized = FALSE;
+ static int weights[UP_DEVICE_KIND_LAST];
+
+ kind = indicator_power_device_get_kind (device);
+ g_return_val_if_fail (0<=kind && kind<UP_DEVICE_KIND_LAST, 0);
+
+ if (G_UNLIKELY(!initialized))
+ {
+ int i;
+
+ initialized = TRUE;
+
+ for (i=0; i<UP_DEVICE_KIND_LAST; i++)
+ weights[i] = 1;
+ weights[UP_DEVICE_KIND_BATTERY] = 2;
+ weights[UP_DEVICE_KIND_LINE_POWER] = 0;
+ }
+
+ return weights[kind];
+}
+
/* sort devices from most interesting to least interesting on this criteria:
1. discharging items from least time remaining until most time remaining
2. discharging items with an unknown time remaining
3. charging items from most time left to charge to least time left to charge
4. charging items with an unknown time remaining
- 5. everything else */
+ 5. batteries, then non-line power, then line-power */
static gint
device_compare_func (gconstpointer ga, gconstpointer gb)
{
@@ -418,6 +444,21 @@ device_compare_func (gconstpointer ga, gconstpointer gb)
}
}
+ if (!ret) /* neither device is charging nor discharging... */
+ {
+ const int weight_a = get_device_kind_weight (a);
+ const int weight_b = get_device_kind_weight (b);
+
+ if (weight_a > weight_b)
+ {
+ ret = -1;
+ }
+ else if (weight_a < weight_b)
+ {
+ ret = 1;
+ }
+ }
+
if (!ret)
ret = a_state - b_state;
diff --git a/tests/test-device.cc b/tests/test-device.cc
index 18bdc08..021404f 100644
--- a/tests/test-device.cc
+++ b/tests/test-device.cc
@@ -555,7 +555,7 @@ TEST_F(DeviceTest, Labels)
INDICATOR_POWER_DEVICE_PERCENTAGE, 0.0,
INDICATOR_POWER_DEVICE_TIME, guint64(0),
NULL);
- check_strings (device, "AC Adapter", "AC Adapter", "AC Adapter");
+ check_strings (device, "", "AC Adapter", "AC Adapter");
// cleanup
g_object_unref(o);
@@ -587,19 +587,22 @@ TEST_F(DeviceTest, ChoosePrimary)
sorted in order of preference wrt the spec's criteria.
So tests[i] should be picked over any test with an index greater than i */
struct {
+ int kind;
int state;
guint64 time;
double percentage;
} tests[] = {
- { UP_DEVICE_STATE_DISCHARGING, 49, 50.0 },
- { UP_DEVICE_STATE_DISCHARGING, 50, 50.0 },
- { UP_DEVICE_STATE_DISCHARGING, 50, 100.0 },
- { UP_DEVICE_STATE_DISCHARGING, 51, 50.0 },
- { UP_DEVICE_STATE_CHARGING, 50, 50.0 },
- { UP_DEVICE_STATE_CHARGING, 49, 50.0 },
- { UP_DEVICE_STATE_CHARGING, 49, 100.0 },
- { UP_DEVICE_STATE_CHARGING, 48, 50.0 },
- { UP_DEVICE_STATE_FULLY_CHARGED, 0, 50.0 }
+ { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_DISCHARGING, 49, 50.0 },
+ { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_DISCHARGING, 50, 50.0 },
+ { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_DISCHARGING, 50, 100.0 },
+ { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_DISCHARGING, 51, 50.0 },
+ { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_CHARGING, 50, 50.0 },
+ { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_CHARGING, 49, 50.0 },
+ { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_CHARGING, 49, 100.0 },
+ { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_CHARGING, 48, 50.0 },
+ { UP_DEVICE_KIND_BATTERY, UP_DEVICE_STATE_FULLY_CHARGED, 0, 50.0 },
+ { UP_DEVICE_KIND_KEYBOARD, UP_DEVICE_STATE_FULLY_CHARGED, 0, 50.0 },
+ { UP_DEVICE_KIND_LINE_POWER, UP_DEVICE_STATE_UNKNOWN, 0, 0.0 }
};
device_list = NULL;
@@ -610,11 +613,13 @@ TEST_F(DeviceTest, ChoosePrimary)
{
for (int j=i+1; j<n; j++)
{
- g_object_set (a, INDICATOR_POWER_DEVICE_STATE, tests[i].state,
+ g_object_set (a, INDICATOR_POWER_DEVICE_KIND, tests[i].kind,
+ INDICATOR_POWER_DEVICE_STATE, tests[i].state,
INDICATOR_POWER_DEVICE_TIME, guint64(tests[i].time),
INDICATOR_POWER_DEVICE_PERCENTAGE, tests[i].percentage,
NULL);
- g_object_set (b, INDICATOR_POWER_DEVICE_STATE, tests[j].state,
+ g_object_set (b, INDICATOR_POWER_DEVICE_KIND, tests[j].kind,
+ INDICATOR_POWER_DEVICE_STATE, tests[j].state,
INDICATOR_POWER_DEVICE_TIME, guint64(tests[j].time),
INDICATOR_POWER_DEVICE_PERCENTAGE, tests[j].percentage,
NULL);