From faa5a560f9206641a3eab5e0b9cd9ad15e50acfd Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Wed, 5 Jul 2023 12:29:39 +0200 Subject: linux: Emit added/removed signals when wireless_status changes Closes: #240 --- src/linux/up-backend.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/linux/up-backend.c b/src/linux/up-backend.c index 7f68be8..443e070 100644 --- a/src/linux/up-backend.c +++ b/src/linux/up-backend.c @@ -403,6 +403,7 @@ up_device_disconnected_cb (GObject *gobject, GParamSpec *pspec, gpointer user_data) { + UpBackend *backend = user_data; g_autofree char *path = NULL; gboolean disconnected; @@ -412,10 +413,14 @@ up_device_disconnected_cb (GObject *gobject, NULL); if (disconnected) { g_debug("Device %s became disconnected, hiding device", path); - up_device_unregister (UP_DEVICE (gobject)); + if (up_device_is_registered (UP_DEVICE (gobject))) { + g_signal_emit (backend, signals[SIGNAL_DEVICE_REMOVED], 0, gobject); + up_device_unregister (UP_DEVICE (gobject)); + } } else { g_debug ("Device %s became connected, showing device", path); - up_device_register (UP_DEVICE (gobject)); + if (up_device_register (UP_DEVICE (gobject))) + g_signal_emit (backend, signals[SIGNAL_DEVICE_ADDED], 0, gobject); } } -- cgit v1.2.3