mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2025-12-20 04:20:04 +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 ||
|
||||
g_strcmp0 (pspec->name, "is-present") == 0) {
|
||||
update_icon_name (device);
|
||||
/* Clearing the history object will force lazily loading. */
|
||||
g_clear_object (&priv->history);
|
||||
/* Clearing the history object for lazily loading when device id was changed. */
|
||||
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 ||
|
||||
g_strcmp0 (pspec->name, "model") == 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 ||
|
||||
g_strcmp0 (pspec->name, "time-to-empty") == 0) {
|
||||
update_warning_level (device);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue