summary refs log tree commit diff
path: root/src/nmtui/nmt-editor.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2025-08-01 19:15:13 +0200
committerMichael Biebl <biebl@debian.org>2025-08-01 19:15:13 +0200
commit7e9091a5960f67a84787c03153324915220e4816 (patch)
treedc743de962532932ebc3b4ed3a36ddd093d97d68 /src/nmtui/nmt-editor.c
parent582eb4472a0f3375042afb9026cbeb50e058a27d (diff)
New upstream version 1.54.0 upstream/1.54.0
Diffstat (limited to 'src/nmtui/nmt-editor.c')
-rw-r--r--src/nmtui/nmt-editor.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/src/nmtui/nmt-editor.c b/src/nmtui/nmt-editor.c
index 6205736a..474d08c2 100644
--- a/src/nmtui/nmt-editor.c
+++ b/src/nmtui/nmt-editor.c
@@ -35,6 +35,7 @@
 #include "nmt-page-ip-tunnel.h"
 #include "nmt-page-ip4.h"
 #include "nmt-page-ip6.h"
+#include "nmt-page-loopback.h"
 #include "nmt-page-macsec.h"
 #include "nmt-page-ppp.h"
 #include "nmt-page-team.h"
@@ -299,13 +300,13 @@ add_sections_for_page(NmtEditor *editor, NmtEditorGrid *grid, NmtEditorPage *pag
 static void
 nmt_editor_constructed(GObject *object)
 {
-    NmtEditor           *editor = NMT_EDITOR(object);
-    NmtEditorPrivate    *priv   = NMT_EDITOR_GET_PRIVATE(editor);
+    NmtEditor           *editor   = NMT_EDITOR(object);
+    NmtEditorPrivate    *priv     = NMT_EDITOR_GET_PRIVATE(editor);
+    NmtDeviceEntry      *deventry = NULL;
     NMSettingConnection *s_con;
     NmtNewtWidget       *vbox, *widget, *buttons;
     NmtEditorGrid       *grid;
     const char          *deventry_label;
-    NmtDeviceEntry      *deventry;
     GType                hardware_type;
     const char          *port_type;
     NmtEditorPage       *page;
@@ -337,22 +338,26 @@ nmt_editor_constructed(GObject *object)
     else
         hardware_type = priv->type_data->device_type;
 
-    /* For connections involving multiple network devices, clarify which one
-     * NMSettingConnection:interface-name refers to.
-     */
-    if (nm_connection_is_type(priv->edit_connection, NM_SETTING_PPPOE_SETTING_NAME))
-        deventry_label = _("Ethernet device");
-    else
-        deventry_label = _("Device");
-
-    widget = nmt_device_entry_new(deventry_label, 40, hardware_type);
-    nmt_editor_grid_append(grid, NULL, widget, NULL);
-    deventry = NMT_DEVICE_ENTRY(widget);
-    g_object_bind_property(s_con,
-                           NM_SETTING_CONNECTION_INTERFACE_NAME,
-                           deventry,
-                           "interface-name",
-                           G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+    if (nm_connection_is_type(priv->edit_connection, NM_SETTING_LOOPBACK_SETTING_NAME)) {
+        g_object_set(s_con, NM_SETTING_CONNECTION_INTERFACE_NAME, "lo", NULL);
+    } else {
+        /* For connections involving multiple network devices, clarify which one
+        * NMSettingConnection:interface-name refers to.
+        */
+        if (nm_connection_is_type(priv->edit_connection, NM_SETTING_PPPOE_SETTING_NAME))
+            deventry_label = _("Ethernet device");
+        else
+            deventry_label = _("Device");
+
+        widget = nmt_device_entry_new(deventry_label, 40, hardware_type);
+        nmt_editor_grid_append(grid, NULL, widget, NULL);
+        deventry = NMT_DEVICE_ENTRY(widget);
+        g_object_bind_property(s_con,
+                               NM_SETTING_CONNECTION_INTERFACE_NAME,
+                               deventry,
+                               "interface-name",
+                               G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+    }
 
     nmt_editor_grid_append(grid, NULL, nmt_newt_separator_new(), NULL);
 
@@ -376,6 +381,8 @@ nmt_editor_constructed(GObject *object)
         page = nmt_page_vlan_new(priv->edit_connection, deventry);
     else if (nm_connection_is_type(priv->edit_connection, NM_SETTING_WIRED_SETTING_NAME))
         page = nmt_page_ethernet_new(priv->edit_connection, deventry);
+    else if (nm_connection_is_type(priv->edit_connection, NM_SETTING_LOOPBACK_SETTING_NAME))
+        page = nmt_page_loopback_new(priv->edit_connection);
     else if (nm_connection_is_type(priv->edit_connection, NM_SETTING_WIRELESS_SETTING_NAME))
         page = nmt_page_wifi_new(priv->edit_connection, deventry);
     else if (nm_connection_is_type(priv->edit_connection, NM_SETTING_IP_TUNNEL_SETTING_NAME))