diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2013-10-01 13:50:48 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2013-10-01 13:50:48 -0500 |
commit | 76c62923635e09d63d6407fed0b8648eead6ece8 (patch) | |
tree | 956f1235d9305c98ed9467343b15e2cf99ac90cd /src | |
parent | 5a739fd7ee27a99f98edc469ab839c6c52d861cb (diff) | |
download | ayatana-indicator-power-76c62923635e09d63d6407fed0b8648eead6ece8.tar.gz ayatana-indicator-power-76c62923635e09d63d6407fed0b8648eead6ece8.tar.bz2 ayatana-indicator-power-76c62923635e09d63d6407fed0b8648eead6ece8.zip |
Listen for the 'Resuming' signal from upower. When it's received, refresh all our devices.
Diffstat (limited to 'src')
-rw-r--r-- | src/device-provider-upower.c | 18 |
1 files changed, 18 insertions, 0 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", |