Skip to content

Commit

Permalink
battstat: bump upower required version and drop legacy code
Browse files Browse the repository at this point in the history
  • Loading branch information
raveit65 committed Jul 14, 2020
1 parent 06feef7 commit f7a5d24
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
16 changes: 0 additions & 16 deletions battstat/battstat-upower.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,10 @@ device_cb (UpClient *client, UpDevice *device, gpointer user_data) {
schedule_status_callback();
}

#if UP_CHECK_VERSION (0, 99, 0)
static void
device_removed_cb (UpClient *client, const gchar *object_path, gpointer user_data) {
schedule_status_callback();
}
#endif

/* ---- public functions ---- */

Expand All @@ -87,29 +85,15 @@ battstat_upower_initialise (void (*callback) (void))
if( (upc = up_client_new() ) == NULL )
goto error_out;

#if UP_CHECK_VERSION(0, 99, 0)
GPtrArray *devices;
devices = up_client_get_devices2 (upc);
if (!devices) {
goto error_shutdownclient;
}
g_ptr_array_unref(devices);
#else
GError *gerror;
GCancellable *cancellable = g_cancellable_new ();
if (! up_client_enumerate_devices_sync (upc, cancellable, &gerror)) {
g_debug ("Unable to enumerate upower devices: %s\n", gerror->message);
goto error_shutdownclient;
}
#endif

g_signal_connect_after( upc, "device-added", G_CALLBACK (device_cb), NULL );
#if UP_CHECK_VERSION(0, 99, 0)
g_signal_connect_after( upc, "device-removed", G_CALLBACK (device_removed_cb), NULL );
#else
g_signal_connect_after( upc, "device-changed", G_CALLBACK (device_cb), NULL );
g_signal_connect_after( upc, "device-removed", G_CALLBACK (device_cb), NULL );
#endif

return NULL;

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ GTK_REQUIRED=3.22.0
LIBPANEL4_REQUIRED=1.17.0
LIBGTOP_REQUIRED=2.12.0
LIBNOTIFY_REQUIRED=0.7.0
UPOWER_REQUIRED=0.9.4
UPOWER_REQUIRED=0.99.8
DBUS_GLIB_REQUIRED=0.74
LIBXML_REQUIRED=2.5.0
POLKIT_REQUIRED=0.97
Expand Down

0 comments on commit f7a5d24

Please sign in to comment.