mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 04:08:01 +02:00
device: move check for no-auto-default to "nm-settings.c"
nm_config_set_no_auto_default_for_device() is called by NMSettings, so it makes sense that also NMSettings checks whether the device is blocked. Of course, there is little difference in practice. The only downside is that most device types don't implement new_default_connection(). So the previous form performed the cheaper check first. On the other hand, we do expect to have profiles for the devices anyway.
This commit is contained in:
parent
d6b84294de
commit
f13454cb1c
2 changed files with 5 additions and 4 deletions
|
|
@ -4796,9 +4796,6 @@ nm_device_new_default_connection (NMDevice *self)
|
|||
if (!NM_DEVICE_GET_CLASS (self)->new_default_connection)
|
||||
return NULL;
|
||||
|
||||
if (nm_config_get_no_auto_default_for_device (nm_config_get (), self))
|
||||
return NULL;
|
||||
|
||||
connection = NM_DEVICE_GET_CLASS (self)->new_default_connection (self);
|
||||
if (!connection)
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -2907,6 +2907,7 @@ static void
|
|||
device_realized (NMDevice *device, GParamSpec *pspec, NMSettings *self)
|
||||
{
|
||||
gs_unref_object NMConnection *connection = NULL;
|
||||
NMSettingsPrivate *priv;
|
||||
NMSettingsConnection *added;
|
||||
GError *error = NULL;
|
||||
|
||||
|
|
@ -2917,12 +2918,15 @@ device_realized (NMDevice *device, GParamSpec *pspec, NMSettings *self)
|
|||
G_CALLBACK (device_realized),
|
||||
self);
|
||||
|
||||
priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
|
||||
/* If the device isn't managed or it already has a default wired connection,
|
||||
* ignore it.
|
||||
*/
|
||||
if ( !nm_device_get_managed (device, FALSE)
|
||||
|| g_object_get_qdata (G_OBJECT (device), _default_wired_connection_quark ())
|
||||
|| have_connection_for_device (self, device))
|
||||
|| have_connection_for_device (self, device)
|
||||
|| nm_config_get_no_auto_default_for_device (priv->config, device))
|
||||
return;
|
||||
|
||||
connection = nm_device_new_default_connection (device);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue