Merge lp:~ken-vandine/ubuntu-system-settings/rtm-upower-0.99 into lp:ubuntu-system-settings/rtm-14.09

Proposed by Ken VanDine
Status: Merged
Approved by: Timo Jyrinki
Approved revision: 938
Merged at revision: 946
Proposed branch: lp:~ken-vandine/ubuntu-system-settings/rtm-upower-0.99
Merge into: lp:ubuntu-system-settings/rtm-14.09
Diff against target: 87 lines (+16/-3)
4 files modified
debian/control (+1/-0)
plugins/battery/battery.cpp (+5/-1)
plugins/battery/plugin/battery-plugin.cpp (+4/-1)
tests/autopilot/ubuntu_system_settings/tests/__init__.py (+6/-1)
To merge this branch: bzr merge lp:~ken-vandine/ubuntu-system-settings/rtm-upower-0.99
Reviewer Review Type Date Requested Status
Ubuntu Touch System Settings Pending
Review via email: mp+242024@code.launchpad.net

Commit message

Support UPower 0.99

Description of the change

Support UPower 0.99

To post a comment you must log in.
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Approving per the bug comment 'I've confirmed the transition to upower 0.99 fixes this issue, really nice improvement all around.' + QA having signed-off the landing.

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-10-31 14:14:22 +0000
3+++ debian/control 2014-12-04 14:59:12 +0000
4@@ -135,6 +135,7 @@
5 Package: ubuntu-system-settings-autopilot
6 Architecture: all
7 Depends: ubuntu-system-settings,
8+ gir1.2-upowerglib-1.0,
9 python3-autopilot,
10 python3-dbusmock (>= 0.10.1),
11 python3-dateutil,
12
13=== modified file 'plugins/battery/battery.cpp'
14--- plugins/battery/battery.cpp 2014-08-28 07:22:28 +0000
15+++ plugins/battery/battery.cpp 2014-12-04 14:59:12 +0000
16@@ -63,15 +63,19 @@
17
18 void Battery::buildDeviceString() {
19 UpClient *client;
20- gboolean returnIsOk;
21 GPtrArray *devices;
22 UpDeviceKind kind;
23
24 client = up_client_new();
25+
26+#if !UP_CHECK_VERSION(0, 99, 0)
27+ gboolean returnIsOk;
28+
29 returnIsOk = up_client_enumerate_devices_sync(client, nullptr, nullptr);
30
31 if(!returnIsOk)
32 return;
33+#endif
34
35 devices = up_client_get_devices(client);
36
37
38=== modified file 'plugins/battery/plugin/battery-plugin.cpp'
39--- plugins/battery/plugin/battery-plugin.cpp 2014-07-23 13:37:06 +0000
40+++ plugins/battery/plugin/battery-plugin.cpp 2014-12-04 14:59:12 +0000
41@@ -49,10 +49,13 @@
42 {
43 BatteryItem *item (static_cast<BatteryItem *> (user_data));
44
45+#if !UP_CHECK_VERSION(0, 99, 0)
46 gboolean ret = up_client_enumerate_devices_sync (client, nullptr, nullptr);
47 if (!ret) {
48 item->setVisibility (false);
49- } else {
50+ } else
51+#endif
52+ {
53 GPtrArray *devices = up_client_get_devices (client);
54 item->setVisibility (devices->len > 0);
55 g_ptr_array_unref (devices);
56
57=== modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py'
58--- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-10-22 21:34:08 +0000
59+++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2014-12-04 14:59:12 +0000
60@@ -22,6 +22,7 @@
61 from testtools.matchers import Equals, NotEquals, GreaterThan
62 from time import sleep
63 from ubuntu_system_settings import SystemSettings
64+from gi.repository import UPowerGlib
65
66 ACCOUNTS_IFACE = 'org.freedesktop.Accounts'
67 ACCOUNTS_USER_IFACE = 'org.freedesktop.Accounts.User'
68@@ -43,6 +44,8 @@
69 NM_SERVICE = 'org.freedesktop.NetworkManager'
70 NM_PATH = '/org/freedesktop/NetworkManager'
71 NM_IFACE = 'org.freedesktop.NetworkManager'
72+UPOWER_VERSION = str(UPowerGlib.MAJOR_VERSION)
73+UPOWER_VERSION += '.' + str(UPowerGlib.MINOR_VERSION)
74
75
76 class UbuntuSystemSettingsTestCase(
77@@ -74,7 +77,9 @@
78 cls.dbus_con = cls.get_dbus(True)
79 # Add a mock Upower environment so we get consistent results
80 (cls.p_mock, cls.obj_upower) = cls.spawn_server_template(
81- 'upower', {'OnBattery': True}, stdout=subprocess.PIPE)
82+ 'upower',
83+ {'OnBattery': True, 'DaemonVersion': UPOWER_VERSION},
84+ stdout=subprocess.PIPE)
85 cls.dbusmock = dbus.Interface(cls.obj_upower, dbusmock.MOCK_IFACE)
86
87 def setUp(self, panel=None):

Subscribers

People subscribed via source and target branches