From 68646992097f098e7faefe43f02af7b20bcf3c11 Mon Sep 17 00:00:00 2001 From: Evangelos Foutras Date: Thu, 2 Oct 2014 16:16:34 +0300 Subject: daemon: Update aggregate device on battery removal https://bugs.freedesktop.org/show_bug.cgi?id=84345 Signed-off-by: Richard Hughes --- src/up-daemon.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/up-daemon.c b/src/up-daemon.c index 77eb8a4..e51f1a5 100644 --- a/src/up-daemon.c +++ b/src/up-daemon.c @@ -1035,6 +1035,7 @@ up_daemon_device_removed_cb (UpBackend *backend, GObject *native, UpDevice *devi { const gchar *object_path; UpDaemonPrivate *priv = daemon->priv; + UpDeviceLevel warning_level; g_return_if_fail (UP_IS_DAEMON (daemon)); g_return_if_fail (UP_IS_DEVICE (device)); @@ -1043,6 +1044,12 @@ up_daemon_device_removed_cb (UpBackend *backend, GObject *native, UpDevice *devi /* remove from list */ up_device_list_remove (priv->power_devices, G_OBJECT(device)); + /* update our internal state in case a battery was removed; this also + * ensures that the display device contains up to date information */ + warning_level = up_daemon_get_warning_level_local (daemon); + if (warning_level != priv->warning_level) + up_daemon_set_warning_level (daemon, warning_level); + /* emit */ object_path = up_device_get_object_path (device); g_debug ("emitting device-removed: %s", object_path); -- cgit v1.2.1