[gnome-settings-daemon] power: Update for libupower-glib API changes
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: Update for libupower-glib API changes
- Date: Thu, 17 Oct 2013 15:44:29 +0000 (UTC)
commit 3ebfd1fb9311a2e7f6af748ee0a534c1e7f6946b
Author: Bastien Nocera <hadess hadess net>
Date: Thu Oct 17 14:39:39 2013 +0200
power: Update for libupower-glib API changes
plugins/power/gsd-power-manager.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 51fae45..6f0e9eb 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -249,16 +249,6 @@ engine_coldplug (GsdPowerManager *manager)
guint i;
GPtrArray *array = NULL;
UpDevice *device;
- gboolean ret;
- GError *error = NULL;
-
- /* get devices from UPower */
- ret = up_client_enumerate_devices_sync (manager->priv->up_client, NULL, &error);
- if (!ret) {
- g_warning ("failed to get device list: %s", error->message);
- g_error_free (error);
- return FALSE;
- }
/* add to database */
array = up_client_get_devices (manager->priv->up_client);
@@ -281,9 +271,18 @@ engine_device_added_cb (UpClient *client, UpDevice *device, GsdPowerManager *man
}
static void
-engine_device_removed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager)
+engine_device_removed_cb (UpClient *client, const char *object_path, GsdPowerManager *manager)
{
- g_ptr_array_remove (manager->priv->devices_array, device);
+ guint i;
+
+ for (i = 0; i < manager->priv->devices_array->len; i++) {
+ UpDevice *device = g_ptr_array_index (manager->priv->devices_array, i);
+
+ if (g_strcmp0 (object_path, up_device_get_object_path (device)) == 0) {
+ g_ptr_array_remove_index (manager->priv->devices_array, i);
+ break;
+ }
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]