manager: reuse a device connection is active on if none was given upon activation

If a connection is already active let's keep it on the same device. This makes
it possible to reactivate a connection without client knowing which device is
it active on.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
This commit is contained in:
Lubomir Rintel 2015-02-03 16:15:37 +01:00
parent 568a8d1da9
commit 6e94f302b2

View file

@ -2263,6 +2263,17 @@ nm_manager_get_devices (NMManager *manager)
return NM_MANAGER_GET_PRIVATE (manager)->devices;
}
static NMDevice *
nm_manager_get_connection_device (NMManager *self,
NMConnection *connection)
{
NMActiveConnection *ac = find_ac_for_connection (self, connection);
if (ac == NULL)
return NULL;
return nm_active_connection_get_device (ac);
}
static gboolean
impl_manager_get_devices (NMManager *manager, GPtrArray **devices, GError **err)
{
@ -3107,7 +3118,10 @@ validate_activation_request (NMManager *self,
"Device not found");
goto error;
}
} else {
} else
device = nm_manager_get_connection_device (self, connection);
if (!device) {
gboolean is_software = nm_connection_is_virtual (connection);
/* VPN and software-device connections don't need a device yet */