mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-08 13:38:01 +02:00
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).
This commit is contained in:
parent
d8482bc767
commit
988e79ae24
1 changed files with 4 additions and 8 deletions
|
|
@ -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 ||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue