diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2016-09-14 14:15:24 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2016-09-16 16:27:11 +0200 |
commit | cdedd2b53e08acebb8abf21cf2a2d84ab440aaa0 (patch) | |
tree | 75f97973a6ac0b6f061da412725c835a8eff0e4a | |
parent | 8f92ead6e2a9082d5aa4a885680308b4516d70ae (diff) | |
download | NetworkManager-cdedd2b53e08acebb8abf21cf2a2d84ab440aaa0.tar.gz |
manager: emit device-removed signal when a device unrealizes
The 'device-added' and 'device-removed' signals indicate when the
value of the 'Devices' property changes. The property only returns
realized devices and so if a device unrealizes we should emit the
removed signal for it.
Fixes: 5da37a129c25350e6f5041726a23d4d9f8318762
https://bugzilla.gnome.org/show_bug.cgi?id=771324
-rw-r--r-- | src/nm-manager.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c index 9ad6517dfc..836ab76857 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -1868,8 +1868,10 @@ device_realized (NMDevice *device, GParamSpec *pspec, NMManager *self) { + gboolean real = nm_device_is_real (device); + /* Emit D-Bus signals */ - g_signal_emit (self, signals[DEVICE_ADDED], 0, device); + g_signal_emit (self, signals[real ? DEVICE_ADDED : DEVICE_REMOVED], 0, device); _notify (self, PROP_DEVICES); } @@ -6045,7 +6047,8 @@ nm_manager_class_init (NMManagerClass *manager_class) NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_OBJECT); - /* D-Bus exported; emitted only for realized devices */ + /* D-Bus exported; emitted only for realized devices when a device + * becomes unrealized or removed */ signals[DEVICE_REMOVED] = g_signal_new (NM_MANAGER_DEVICE_REMOVED, G_OBJECT_CLASS_TYPE (object_class), |