diff --git a/src/nmtui/nmt-editor.c b/src/nmtui/nmt-editor.c index 02b0b07013..474d08c278 100644 --- a/src/nmtui/nmt-editor.c +++ b/src/nmtui/nmt-editor.c @@ -300,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; @@ -338,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"); + 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); + 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); @@ -378,7 +382,7 @@ nmt_editor_constructed(GObject *object) 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, deventry); + 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)) diff --git a/src/nmtui/nmt-page-loopback.c b/src/nmtui/nmt-page-loopback.c index a47648745c..e080016867 100644 --- a/src/nmtui/nmt-page-loopback.c +++ b/src/nmtui/nmt-page-loopback.c @@ -14,7 +14,6 @@ #include "nmt-page-loopback.h" #include "libnm-core-aux-intern/nm-libnm-core-utils.h" -#include "nmt-device-entry.h" #include "nmt-mtu-entry.h" G_DEFINE_TYPE(NmtPageLoopback, nmt_page_loopback, NMT_TYPE_EDITOR_PAGE_DEVICE) @@ -27,9 +26,9 @@ nmt_page_loopback_init(NmtPageLoopback *loopback) {} NmtEditorPage * -nmt_page_loopback_new(NMConnection *conn, NmtDeviceEntry *deventry) +nmt_page_loopback_new(NMConnection *conn) { - return g_object_new(NMT_TYPE_PAGE_LOOPBACK, "connection", conn, "device-entry", deventry, NULL); + return g_object_new(NMT_TYPE_PAGE_LOOPBACK, "connection", conn, NULL); } static void diff --git a/src/nmtui/nmt-page-loopback.h b/src/nmtui/nmt-page-loopback.h index 03c76287c0..12c38ef8f2 100644 --- a/src/nmtui/nmt-page-loopback.h +++ b/src/nmtui/nmt-page-loopback.h @@ -28,6 +28,6 @@ typedef struct { GType nmt_page_loopback_get_type(void); -NmtEditorPage *nmt_page_loopback_new(NMConnection *conn, NmtDeviceEntry *deventry); +NmtEditorPage *nmt_page_loopback_new(NMConnection *conn); #endif /* NMT_PAGE_LOOPBACK_H */