aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-10-02 14:10:58 +0000
committerTarmac <Unknown>2013-10-02 14:10:58 +0000
commit29eb8c2f7119020938ca08efb3e63cacea9db0a5 (patch)
treed6ac4c9ad482c4f0b02670b207cab610a9873780 /src
parenta16d12317296ad016876b5ddb285e5985afc6521 (diff)
parent76c62923635e09d63d6407fed0b8648eead6ece8 (diff)
downloadayatana-indicator-power-29eb8c2f7119020938ca08efb3e63cacea9db0a5.tar.gz
ayatana-indicator-power-29eb8c2f7119020938ca08efb3e63cacea9db0a5.tar.bz2
ayatana-indicator-power-29eb8c2f7119020938ca08efb3e63cacea9db0a5.zip
Listen for the "Resuming" signal from upower to refresh devices when resuming from suspend/hibernate. Fixes: https://bugs.launchpad.net/bugs/1224931.
Approved by Ted Gould, PS Jenkins bot.
Diffstat (limited to 'src')
-rw-r--r--src/device-provider-upower.c18
-rw-r--r--src/ib-brightness-control.c2
2 files changed, 19 insertions, 1 deletions
diff --git a/src/device-provider-upower.c b/src/device-provider-upower.c
index 05faeab..1b1b7bd 100644
--- a/src/device-provider-upower.c
+++ b/src/device-provider-upower.c
@@ -249,6 +249,22 @@ on_upower_device_removed (DbusUPower * unused G_GNUC_UNUSED,
}
static void
+on_upower_resuming (DbusUPower * unused G_GNUC_UNUSED,
+ gpointer gself)
+{
+ IndicatorPowerDeviceProviderUPower * self;
+ GHashTableIter iter;
+ gpointer object_path;
+
+ self = INDICATOR_POWER_DEVICE_PROVIDER_UPOWER (gself);
+
+ g_debug ("Resumed from hibernate/sleep; queueing all devices for a refresh");
+ g_hash_table_iter_init (&iter, self->priv->devices);
+ while (g_hash_table_iter_next (&iter, &object_path, NULL))
+ refresh_device_soon (self, object_path);
+}
+
+static void
on_upower_proxy_ready (GObject * source G_GNUC_UNUSED,
GAsyncResult * res,
gpointer gself)
@@ -272,6 +288,8 @@ on_upower_proxy_ready (GObject * source G_GNUC_UNUSED,
p = self->priv;
p->upower_proxy = proxy;
+ g_signal_connect (proxy, "resuming",
+ G_CALLBACK (on_upower_resuming), self);
g_signal_connect (proxy, "device-changed",
G_CALLBACK (on_upower_device_changed), self);
g_signal_connect (proxy, "device-added",
diff --git a/src/ib-brightness-control.c b/src/ib-brightness-control.c
index 2b9b79d..ddc82e5 100644
--- a/src/ib-brightness-control.c
+++ b/src/ib-brightness-control.c
@@ -52,7 +52,7 @@ ib_brightness_control_new (void)
(g_strcmp0 (device_type, "platform") == 0) ||
(g_strcmp0 (device_type, "raw") == 0)) {
path = g_strdup (g_udev_device_get_sysfs_path (device->data));
- g_print ("found: %s\n", path);
+ g_debug ("found: %s", path);
break;
}
}