mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2025-12-25 05:40:03 +01:00
up-device: Remove history only on device id change
Remove the history when the device id was changed.
This commit is contained in:
parent
76e2b9e571
commit
bbb593d306
1 changed files with 7 additions and 3 deletions
|
|
@ -230,12 +230,16 @@ up_device_notify (GObject *object, GParamSpec *pspec)
|
||||||
if (g_strcmp0 (pspec->name, "type") == 0 ||
|
if (g_strcmp0 (pspec->name, "type") == 0 ||
|
||||||
g_strcmp0 (pspec->name, "is-present") == 0) {
|
g_strcmp0 (pspec->name, "is-present") == 0) {
|
||||||
update_icon_name (device);
|
update_icon_name (device);
|
||||||
/* Clearing the history object will force lazily loading. */
|
/* Clearing the history object for lazily loading when device id was changed. */
|
||||||
g_clear_object (&priv->history);
|
if (priv->history != NULL &&
|
||||||
|
!up_history_is_device_id_equal (priv->history, up_device_get_id(device)))
|
||||||
|
g_clear_object (&priv->history);
|
||||||
} else if (g_strcmp0 (pspec->name, "vendor") == 0 ||
|
} else if (g_strcmp0 (pspec->name, "vendor") == 0 ||
|
||||||
g_strcmp0 (pspec->name, "model") == 0 ||
|
g_strcmp0 (pspec->name, "model") == 0 ||
|
||||||
g_strcmp0 (pspec->name, "serial") == 0) {
|
g_strcmp0 (pspec->name, "serial") == 0) {
|
||||||
g_clear_object (&priv->history);
|
if (priv->history != NULL &&
|
||||||
|
!up_history_is_device_id_equal (priv->history, up_device_get_id(device)))
|
||||||
|
g_clear_object (&priv->history);
|
||||||
} else if (g_strcmp0 (pspec->name, "power-supply") == 0 ||
|
} else if (g_strcmp0 (pspec->name, "power-supply") == 0 ||
|
||||||
g_strcmp0 (pspec->name, "time-to-empty") == 0) {
|
g_strcmp0 (pspec->name, "time-to-empty") == 0) {
|
||||||
update_warning_level (device);
|
update_warning_level (device);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue