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



commit 118de73bd870cb9e81e57b9e526afd4ea89c8355
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 a4c3a7275..6cf0c000e 100644
--- a/panels/network/net-device-ethernet.c
+++ b/panels/network/net-device-ethernet.c
@@ -408,8 +408,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 ());
@@ -427,6 +429,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]