Dominique Leuenberger
079fb291c6
- Add gnome-settings-daemon-upower-backport.patch -- from upstream; support upower 0.99. - Up upower-glib dependency. OBS-URL: https://build.opensuse.org/request/show/211905 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-settings-daemon?expand=0&rev=188
77 lines
2.9 KiB
Diff
77 lines
2.9 KiB
Diff
From: Mike Gorse <mgorse@suse.com>
|
|
Date: Tue Dec 10 14:36:49 CST 2013
|
|
Subject: [PATCH] Support new libupower-glib API
|
|
|
|
Support upower 0.99. Based on commits 88de07 and 3ebfd1 from upstream.
|
|
---
|
|
plugins/power/gsd-power-manager.c | 6 +++---
|
|
diff -ur gnome-settings-daemon-3.10.2.orig/plugins/power/gsd-power-manager.c gnome-settings-daemon-3.10.2/plugins/power/gsd-power-manager.c
|
|
--- gnome-settings-daemon-3.10.2.orig/plugins/power/gsd-power-manager.c 2013-11-12 12:33:05.000000000 -0600
|
|
+++ gnome-settings-daemon-3.10.2/plugins/power/gsd-power-manager.c 2013-12-10 14:21:08.857851976 -0600
|
|
@@ -991,16 +991,6 @@
|
|
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;
|
|
- }
|
|
|
|
engine_recalculate_state (manager);
|
|
|
|
@@ -1031,13 +1021,22 @@
|
|
}
|
|
|
|
static void
|
|
-engine_device_removed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager)
|
|
+engine_device_removed_cb (UpClient *client, const char *object_path, GsdPowerManager *manager)
|
|
{
|
|
- gboolean ret;
|
|
- ret = g_ptr_array_remove (manager->priv->devices_array, device);
|
|
- if (!ret)
|
|
- return;
|
|
- engine_recalculate_state (manager);
|
|
+ gboolean ret = FALSE;
|
|
+ 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);
|
|
+ ret = TRUE;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ if (ret)
|
|
+ engine_recalculate_state (manager);
|
|
}
|
|
|
|
static void
|
|
@@ -2172,7 +2172,7 @@
|
|
}
|
|
|
|
static void
|
|
-up_client_changed_cb (UpClient *client, GsdPowerManager *manager)
|
|
+lid_state_changed_cb (UpClient *client, GParamSpec *pspec, GsdPowerManager *manager)
|
|
{
|
|
gboolean tmp;
|
|
|
|
@@ -3276,8 +3276,8 @@
|
|
G_CALLBACK (engine_device_removed_cb), manager);
|
|
g_signal_connect (manager->priv->up_client, "device-changed",
|
|
G_CALLBACK (engine_device_changed_cb), manager);
|
|
- g_signal_connect_after (manager->priv->up_client, "changed",
|
|
- G_CALLBACK (up_client_changed_cb), manager);
|
|
+ g_signal_connect_after (manager->priv->up_client, "notify::lid-is-closed",
|
|
+ G_CALLBACK (lid_state_changed_cb), manager);
|
|
g_signal_connect (manager->priv->up_client, "notify::on-battery",
|
|
G_CALLBACK (up_client_on_battery_cb), manager);
|
|
|