From c4fc72c795c144fb540b5fd056b4cbbaae60b6e1 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 3 Jan 2014 13:58:05 -0500 Subject: [PATCH] devices: start using the DEACTIVATING state When a device is disconnected by the user (as opposed to due to network or hardware error, etc), set it first to DEACTIVATING, which does nothing but queue a transition to disconnected. This lets other parts of NM observe the device when it is about-to-disconnect, but still has an associated connection. --- src/devices/nm-device.c | 5 ++++- src/nm-manager.c | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 4157598055..2a459bb64f 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -4618,7 +4618,7 @@ disconnect_cb (NMDevice *device, TRUE); nm_device_state_changed (device, - NM_DEVICE_STATE_DISCONNECTED, + NM_DEVICE_STATE_DEACTIVATING, NM_DEVICE_STATE_REASON_USER_REQUESTED); dbus_g_method_return (context); } @@ -6304,6 +6304,9 @@ nm_device_state_changed (NMDevice *device, nm_device_queue_state (device, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE); } break; + case NM_DEVICE_STATE_DEACTIVATING: + nm_device_queue_state (device, NM_DEVICE_STATE_DISCONNECTED, reason); + break; case NM_DEVICE_STATE_DISCONNECTED: if (old_state > NM_DEVICE_STATE_DISCONNECTED && priv->default_unmanaged) nm_device_queue_state (device, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE); diff --git a/src/nm-manager.c b/src/nm-manager.c index 2f4785257d..d3fa52436e 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -3489,9 +3489,8 @@ nm_manager_deactivate_connection (NMManager *manager, "The VPN connection was not active."); } else { g_assert (NM_IS_ACT_REQUEST (active)); - /* FIXME: use DEACTIVATING state */ nm_device_state_changed (nm_active_connection_get_device (active), - NM_DEVICE_STATE_DISCONNECTED, + NM_DEVICE_STATE_DEACTIVATING, reason); success = TRUE; }