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
This commit is contained in:
Benjamin Berg 2022-05-13 17:51:29 +02:00 committed by Benjamin Berg
parent 4cccf81cad
commit b4e9cd9739

View file

@ -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);
}