nmtui/editor: hide "device" field for loopback connections
This field is irrelevant for this device type, since it will always be just "lo".
This commit is contained in:
@@ -302,11 +302,11 @@ nmt_editor_constructed(GObject *object)
|
||||
{
|
||||
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,6 +338,9 @@ nmt_editor_constructed(GObject *object)
|
||||
else
|
||||
hardware_type = priv->type_data->device_type;
|
||||
|
||||
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.
|
||||
*/
|
||||
@@ -354,6 +357,7 @@ nmt_editor_constructed(GObject *object)
|
||||
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))
|
||||
|
@@ -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
|
||||
|
@@ -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 */
|
||||
|
Reference in New Issue
Block a user