Merge lp:~pitti/powerd/upower0.99 into lp:powerd

Proposed by Martin Pitt on 2014-10-30
Status: Merged
Approved by: Oliver Grawert on 2014-10-31
Approved revision: 148
Merged at revision: 147
Proposed branch: lp:~pitti/powerd/upower0.99
Merge into: lp:powerd
Diff against target: 43 lines (+13/-2)
1 file modified
src/power-source.c (+13/-2)
To merge this branch: bzr merge lp:~pitti/powerd/upower0.99
Reviewer Review Type Date Requested Status
Oliver Grawert 2014-10-30 Approve on 2014-10-31
PS Jenkins bot continuous-integration Approve on 2014-10-31
Review via email: mp+240141@code.launchpad.net

Commit message

Support upower 0.99.

Description of the change

Port to upower 0.99 (see https://launchpad.net/bugs/1330037)

Thanks to Tim Lunn for the patch!

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Martin Pitt (pitti) wrote :

FTR, it's impossible to succeed the PS Jenkins test, as that doesn't build against vivid-proposed. But upower 0.99 will be stuck there until we land this transition.

lp:~pitti/powerd/upower0.99 updated on 2014-10-31
148. By Martin Pitt on 2014-10-31

use version check to work for any upower version

Martin Pitt (pitti) wrote :

As discussed on IRC, I modified this to use conditionals, so that this works with both the old and the new upower. This avoids having to branch off.

PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Oliver Grawert (ogra) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/power-source.c'
2--- src/power-source.c 2013-09-03 14:10:41 +0000
3+++ src/power-source.c 2014-10-31 09:45:19 +0000
4@@ -29,7 +29,12 @@
5 static double battery_log_level = 4.0f;
6 static gboolean stats_logged;
7
8-static void up_device_changed_cb(UpClient *client, UpDevice *device,
9+static void up_device_changed_cb(UpClient *client,
10+#if UP_CHECK_VERSION(0,99,0)
11+ GParamSpec *pspec,
12+#else
13+ UpDevice *device,
14+#endif
15 gpointer unused)
16 {
17 gboolean on_battery;
18@@ -96,7 +101,6 @@
19 int powerd_ps_init(void)
20 {
21 GValue v = G_VALUE_INIT;
22- gboolean ret;
23
24 /*
25 * Override default shutdown temperature with device-specific
26@@ -119,11 +123,18 @@
27 powerd_warn("Could not allocate upower client");
28 return -ENODEV;
29 }
30+
31+#if UP_CHECK_VERSION(0,99,0)
32+ g_signal_connect(up_client, "notify",
33+ G_CALLBACK(up_device_changed_cb), NULL);
34+#else
35+ gboolean ret;
36 ret = up_client_enumerate_devices_sync(up_client, NULL, NULL);
37 if (!ret)
38 powerd_warn("Could not enumerate upower devices");
39 g_signal_connect(up_client, "device-changed",
40 G_CALLBACK(up_device_changed_cb), NULL);
41+#endif
42 return 0;
43 }
44

Subscribers

People subscribed via source and target branches