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

Subscribers

People subscribed via source and target branches