diff options
author | Thomas Haller <thaller@redhat.com> | 2017-11-02 18:37:32 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-11-08 11:33:32 +0100 |
commit | 715aebe08a99519fe0d6b979db00fe4dbff9d678 (patch) | |
tree | 755f771f62acb51769e8384d75a6fdf31056e1d6 | |
parent | 990af413ac56c784125fe50df64a374933396e3f (diff) | |
download | NetworkManager-715aebe08a99519fe0d6b979db00fe4dbff9d678.tar.gz |
device: inline NMDevice's implementation of can_auto_connect()
Derived classes should not modify or overwrite this essential behavior
of can_auto_connect(). It doesn't belong to the virtual function.
-rw-r--r-- | src/devices/nm-device.c | 30 | ||||
-rw-r--r-- | src/devices/wifi/nm-device-olpc-mesh.c | 1 |
2 files changed, 18 insertions, 13 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index daba9d4d6c..4692590b92 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -4337,15 +4337,8 @@ can_auto_connect (NMDevice *self, NMConnection *connection, char **specific_object) { - NMSettingConnection *s_con; - nm_assert (!specific_object || !*specific_object); - - s_con = nm_connection_get_setting_connection (connection); - if (!nm_setting_connection_get_autoconnect (s_con)) - return FALSE; - - return nm_device_check_connection_available (self, connection, NM_DEVICE_CHECK_CON_AVAILABLE_NONE, NULL); + return TRUE; } /** @@ -4370,13 +4363,26 @@ nm_device_can_auto_connect (NMDevice *self, NMConnection *connection, char **specific_object) { + NMSettingConnection *s_con; + g_return_val_if_fail (NM_IS_DEVICE (self), FALSE); g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE); - g_return_val_if_fail (specific_object && !*specific_object, FALSE); + g_return_val_if_fail (!specific_object || !*specific_object, FALSE); - if (nm_device_autoconnect_allowed (self)) - return NM_DEVICE_GET_CLASS (self)->can_auto_connect (self, connection, specific_object); - return FALSE; + if (!nm_device_autoconnect_allowed (self)) + return FALSE; + + s_con = nm_connection_get_setting_connection (connection); + if (!nm_setting_connection_get_autoconnect (s_con)) + return FALSE; + + if (!nm_device_check_connection_available (self, connection, NM_DEVICE_CHECK_CON_AVAILABLE_NONE, NULL)) + return FALSE; + + if (!NM_DEVICE_GET_CLASS (self)->can_auto_connect (self, connection, specific_object)) + return FALSE; + + return TRUE; } static gboolean diff --git a/src/devices/wifi/nm-device-olpc-mesh.c b/src/devices/wifi/nm-device-olpc-mesh.c index ac78757d9d..18b82d53e7 100644 --- a/src/devices/wifi/nm-device-olpc-mesh.c +++ b/src/devices/wifi/nm-device-olpc-mesh.c @@ -112,7 +112,6 @@ can_auto_connect (NMDevice *device, char **specific_object) { nm_assert (!specific_object || !*specific_object); - return FALSE; } |