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

Proposed by Martin Pitt
Status: Merged
Approved by: Oliver Grawert
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 Approve
PS Jenkins bot continuous-integration Approve
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.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
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
148. By Martin Pitt

use version check to work for any upower version

Revision history for this message
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.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Oliver Grawert (ogra) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/power-source.c'
--- src/power-source.c 2013-09-03 14:10:41 +0000
+++ src/power-source.c 2014-10-31 09:45:19 +0000
@@ -29,7 +29,12 @@
29static double battery_log_level = 4.0f;29static double battery_log_level = 4.0f;
30static gboolean stats_logged;30static gboolean stats_logged;
3131
32static void up_device_changed_cb(UpClient *client, UpDevice *device,32static void up_device_changed_cb(UpClient *client,
33#if UP_CHECK_VERSION(0,99,0)
34 GParamSpec *pspec,
35#else
36 UpDevice *device,
37#endif
33 gpointer unused)38 gpointer unused)
34{39{
35 gboolean on_battery;40 gboolean on_battery;
@@ -96,7 +101,6 @@
96int powerd_ps_init(void)101int powerd_ps_init(void)
97{102{
98 GValue v = G_VALUE_INIT;103 GValue v = G_VALUE_INIT;
99 gboolean ret;
100104
101 /*105 /*
102 * Override default shutdown temperature with device-specific106 * Override default shutdown temperature with device-specific
@@ -119,11 +123,18 @@
119 powerd_warn("Could not allocate upower client");123 powerd_warn("Could not allocate upower client");
120 return -ENODEV;124 return -ENODEV;
121 }125 }
126
127#if UP_CHECK_VERSION(0,99,0)
128 g_signal_connect(up_client, "notify",
129 G_CALLBACK(up_device_changed_cb), NULL);
130#else
131 gboolean ret;
122 ret = up_client_enumerate_devices_sync(up_client, NULL, NULL);132 ret = up_client_enumerate_devices_sync(up_client, NULL, NULL);
123 if (!ret)133 if (!ret)
124 powerd_warn("Could not enumerate upower devices");134 powerd_warn("Could not enumerate upower devices");
125 g_signal_connect(up_client, "device-changed",135 g_signal_connect(up_client, "device-changed",
126 G_CALLBACK(up_device_changed_cb), NULL);136 G_CALLBACK(up_device_changed_cb), NULL);
137#endif
127 return 0;138 return 0;
128}139}
129140

Subscribers

People subscribed via source and target branches