diff options
author | Bastien Nocera <hadess@hadess.net> | 2013-10-14 22:09:19 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2013-10-15 15:01:37 +0200 |
commit | f71ac98cd22867f220808eae35e40b37ef3f9716 (patch) | |
tree | dee6f6c6ec87a40a78196395f1a08b74603e15a8 /src/up-device.c | |
parent | d74e4a7243c000ff042d37e6fd6be880a4cc4fbb (diff) |
daemon: Register on the Bus after coldplug
Both for the daemon and devices, so as to avoid D-Bus changes
storms on startup.
Diffstat (limited to 'src/up-device.c')
-rw-r--r-- | src/up-device.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/src/up-device.c b/src/up-device.c index 371dcb9..2729b03 100644 --- a/src/up-device.c +++ b/src/up-device.c @@ -49,7 +49,6 @@ struct UpDevicePrivate UpHistory *history; GObject *native; gboolean has_ever_refresh; - gboolean during_coldplug; /* properties */ guint64 update_time; @@ -614,10 +613,6 @@ up_device_coldplug (UpDevice *device, UpDaemon *daemon, GObject *native) native_path = up_native_get_native_path (native); device->priv->native_path = g_strdup (native_path); - /* stop signals and callbacks */ - g_object_freeze_notify (G_OBJECT(device)); - device->priv->during_coldplug = TRUE; - /* coldplug source */ if (klass->coldplug != NULL) { ret = klass->coldplug (device); @@ -627,13 +622,6 @@ up_device_coldplug (UpDevice *device, UpDaemon *daemon, GObject *native) } } - /* only put on the bus if we succeeded */ - ret = up_device_register_device (device); - if (!ret) { - g_warning ("failed to register device %s", device->priv->native_path); - goto out; - } - /* force a refresh, although failure isn't fatal */ ret = up_device_refresh_internal (device); if (!ret) { @@ -647,14 +635,19 @@ up_device_coldplug (UpDevice *device, UpDaemon *daemon, GObject *native) /* get the id so we can load the old history */ id = up_device_get_id (device); - if (id != NULL) + if (id != NULL) { up_history_set_id (device->priv->history, id); + g_free (id); + } + + /* only put on the bus if we succeeded */ + ret = up_device_register_device (device); + if (!ret) { + g_warning ("failed to register device %s", device->priv->native_path); + goto out; + } out: - /* start signals and callbacks */ - g_object_thaw_notify (G_OBJECT(device)); - device->priv->during_coldplug = FALSE; - g_free (id); return ret; } @@ -921,10 +914,6 @@ up_device_perhaps_changed_cb (GObject *object, GParamSpec *pspec, UpDevice *devi { g_return_if_fail (UP_IS_DEVICE (device)); - /* don't proxy during coldplug */ - if (device->priv->during_coldplug) - return; - /* save new history */ up_history_set_state (device->priv->history, device->priv->state); up_history_set_charge_data (device->priv->history, device->priv->percentage); |