diff options
author | Pablo Correa Gómez <ablocorrea@hotmail.com> | 2021-06-18 14:32:59 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2021-06-30 10:56:31 +0200 |
commit | 988e79ae24035e202190158d395a1f114c8f34c3 (patch) | |
tree | 56c7a76de8781a689b9ec308a5dcc0fd5c45fb81 | |
parent | d8482bc767db44ea1ae5de6057e194628b4bddbf (diff) |
device: Don't update properties when device isn't exported
The code in up_device_notify() will still eventually be reached when the
up_device_coldplug() implementations are called, and properties are set
for the device type for the first time (rather than during instance
construction).
-rw-r--r-- | src/up-device.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/up-device.c b/src/up-device.c index 0a56810..84b0223 100644 --- a/src/up-device.c +++ b/src/up-device.c @@ -63,10 +63,6 @@ update_warning_level (UpDevice *device) UpDeviceLevel warning_level, battery_level; UpExportedDevice *skeleton = UP_EXPORTED_DEVICE (device); - /* Not finished setting up the object? */ - if (device->priv->daemon == NULL) - return; - /* If the battery level is available, and is critical, * we need to fallback to calculations to get the warning * level, as that might be "action" at this point */ @@ -101,10 +97,6 @@ update_icon_name (UpDevice *device) const gchar *icon_name = NULL; UpExportedDevice *skeleton = UP_EXPORTED_DEVICE (device); - /* Not finished setting up the object? */ - if (device->priv->daemon == NULL) - return; - /* get the icon from some simple rules */ if (up_exported_device_get_type_ (skeleton) == UP_DEVICE_KIND_LINE_POWER) { icon_name = "ac-adapter-symbolic"; @@ -165,6 +157,10 @@ up_device_notify (GObject *object, GParamSpec *pspec) { UpDevice *device = UP_DEVICE (object); + /* Not finished setting up the object? */ + if (device->priv->daemon == NULL) + return; + G_OBJECT_CLASS (up_device_parent_class)->notify (object, pspec); if (g_strcmp0 (pspec->name, "type") == 0 || |