From b4e9cd97399d97a7da074d461abfc98ffb28a868 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Fri, 13 May 2022 17:51:29 +0200 Subject: [PATCH] daemon: Only refresh batteries when the "online" state changes There is no need to refresh batteries if we just re-read the status of a line power supply without actually seeing a change ("online" vs. "update-time" property). Fixes: #184 --- src/up-daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/up-daemon.c b/src/up-daemon.c index 52264f3..a10d9cb 100644 --- a/src/up-daemon.c +++ b/src/up-daemon.c @@ -788,7 +788,7 @@ up_daemon_device_changed_cb (UpDevice *device, GParamSpec *pspec, UpDaemon *daem g_object_get (device, "type", &type, NULL); - if (type == UP_DEVICE_KIND_LINE_POWER) { + if (type == UP_DEVICE_KIND_LINE_POWER && g_strcmp0 (prop, "online") == 0) { /* refresh now */ up_daemon_refresh_battery_devices (daemon); }