[gnome-control-center/gnome-42] network: Fixed Network profiles shown on wrong device



commit 2145e0d8de1f0cdfab4f263ec85288714f9cca02
Author: Luciano da Silva Ribas <lucribas@users>
Date:   Thu Sep 22 23:00:24 2022 -0300

    network: Fixed Network profiles shown on wrong device
    
    Added missing interface name during network profile creation.
    
    Fixes #353

 panels/network/net-device-ethernet.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/panels/network/net-device-ethernet.c b/panels/network/net-device-ethernet.c
index ead711cf1..18d483054 100644
--- a/panels/network/net-device-ethernet.c
+++ b/panels/network/net-device-ethernet.c
@@ -395,8 +395,10 @@ add_profile_button_clicked_cb (NetDeviceEthernet *self)
         NMSettingConnection *sc;
         g_autofree gchar *uuid = NULL;
         g_autofree gchar *id = NULL;
+        g_autoptr(GError) error = NULL;
         NetConnectionEditor *editor;
         const GPtrArray *connections;
+        const char *iface;
 
         connection = nm_simple_connection_new ();
         sc = NM_SETTING_CONNECTION (nm_setting_connection_new ());
@@ -414,6 +416,16 @@ add_profile_button_clicked_cb (NetDeviceEthernet *self)
                       NM_SETTING_CONNECTION_AUTOCONNECT, TRUE,
                       NULL);
 
+        iface = nm_device_get_iface (self->device);
+        if (nm_utils_is_valid_iface_name (iface, &error)) {
+            g_object_set (sc,
+                          NM_SETTING_CONNECTION_INTERFACE_NAME, iface,
+                          NULL);
+        } else {
+            g_warning ("Invalid interface Name '%s': %s", iface, error->message);
+            g_error_free (error);
+        }
+
         nm_connection_add_setting (connection, nm_setting_wired_new ());
 
         editor = net_connection_editor_new (connection, self->device, NULL, self->client);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]