[gnome-applets/wip/gnome-3.10+] Fix building against upower 0.99
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets/wip/gnome-3.10+] Fix building against upower 0.99
- Date: Tue, 12 Aug 2014 12:52:33 +0000 (UTC)
commit 2665e610e4fbb50a42c6f97bab16607d8ffe47da
Author: Dmitry Shachnev <mitya57 gmail com>
Date: Thu May 22 19:38:47 2014 +0400
Fix building against upower 0.99
battstat/battstat-upower.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/battstat/battstat-upower.c b/battstat/battstat-upower.c
index 7370bca..e7c9e53 100644
--- a/battstat/battstat-upower.c
+++ b/battstat/battstat-upower.c
@@ -67,12 +67,18 @@ device_cb (UpClient *client, UpDevice *device, gpointer user_data) {
schedule_status_callback();
}
+static void
+device_removed_cb (UpClient *client, const gchar *object_path, gpointer user_data) {
+ schedule_status_callback();
+}
+
/* ---- public functions ---- */
char *
battstat_upower_initialise (void (*callback) (void))
{
status_updated_callback = callback;
+ GPtrArray *devices;
if( upc != NULL )
return g_strdup( "Already initialised!" );
@@ -80,13 +86,25 @@ battstat_upower_initialise (void (*callback) (void))
if( (upc = up_client_new() ) == NULL )
goto error_out;
+#if UP_CHECK_VERSION(0, 99, 0)
+ devices = up_client_get_devices(upc);
+ if (!devices) {
+ goto error_shutdownclient;
+ }
+ g_ptr_array_unref(devices);
+#else
if (! up_client_enumerate_devices_sync( upc, NULL, NULL ) ) {
goto error_shutdownclient;
}
+#endif
- g_signal_connect_after( upc, "device-changed", device_cb, NULL );
g_signal_connect_after( upc, "device-added", device_cb, NULL );
+#if UP_CHECK_VERSION(0, 99, 0)
+ g_signal_connect_after( upc, "device-removed", device_removed_cb, NULL );
+#else
+ g_signal_connect_after( upc, "device-changed", device_cb, NULL );
g_signal_connect_after( upc, "device-removed", device_cb, NULL );
+#endif
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]