diff options
author | Bastien Nocera <hadess@hadess.net> | 2023-07-05 12:29:39 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2023-07-05 17:39:19 +0200 |
commit | faa5a560f9206641a3eab5e0b9cd9ad15e50acfd (patch) | |
tree | 6013e6c4a29a1db5750063299ac2f23c3c3c82c6 | |
parent | 8dd86689fa399b9576998704f19fe8922162926f (diff) |
linux: Emit added/removed signals when wireless_status changes
Closes: #240
-rw-r--r-- | src/linux/up-backend.c | 9 |
1 files 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); } } |