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:
@@ -300,13 +300,13 @@ add_sections_for_page(NmtEditor *editor, NmtEditorGrid *grid, NmtEditorPage *pag
|
|||||||
static void
|
static void
|
||||||
nmt_editor_constructed(GObject *object)
|
nmt_editor_constructed(GObject *object)
|
||||||
{
|
{
|
||||||
NmtEditor *editor = NMT_EDITOR(object);
|
NmtEditor *editor = NMT_EDITOR(object);
|
||||||
NmtEditorPrivate *priv = NMT_EDITOR_GET_PRIVATE(editor);
|
NmtEditorPrivate *priv = NMT_EDITOR_GET_PRIVATE(editor);
|
||||||
|
NmtDeviceEntry *deventry = NULL;
|
||||||
NMSettingConnection *s_con;
|
NMSettingConnection *s_con;
|
||||||
NmtNewtWidget *vbox, *widget, *buttons;
|
NmtNewtWidget *vbox, *widget, *buttons;
|
||||||
NmtEditorGrid *grid;
|
NmtEditorGrid *grid;
|
||||||
const char *deventry_label;
|
const char *deventry_label;
|
||||||
NmtDeviceEntry *deventry;
|
|
||||||
GType hardware_type;
|
GType hardware_type;
|
||||||
const char *port_type;
|
const char *port_type;
|
||||||
NmtEditorPage *page;
|
NmtEditorPage *page;
|
||||||
@@ -338,22 +338,26 @@ nmt_editor_constructed(GObject *object)
|
|||||||
else
|
else
|
||||||
hardware_type = priv->type_data->device_type;
|
hardware_type = priv->type_data->device_type;
|
||||||
|
|
||||||
/* For connections involving multiple network devices, clarify which one
|
if (nm_connection_is_type(priv->edit_connection, NM_SETTING_LOOPBACK_SETTING_NAME)) {
|
||||||
* NMSettingConnection:interface-name refers to.
|
g_object_set(s_con, NM_SETTING_CONNECTION_INTERFACE_NAME, "lo", NULL);
|
||||||
*/
|
} else {
|
||||||
if (nm_connection_is_type(priv->edit_connection, NM_SETTING_PPPOE_SETTING_NAME))
|
/* For connections involving multiple network devices, clarify which one
|
||||||
deventry_label = _("Ethernet device");
|
* NMSettingConnection:interface-name refers to.
|
||||||
else
|
*/
|
||||||
deventry_label = _("Device");
|
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);
|
widget = nmt_device_entry_new(deventry_label, 40, hardware_type);
|
||||||
nmt_editor_grid_append(grid, NULL, widget, NULL);
|
nmt_editor_grid_append(grid, NULL, widget, NULL);
|
||||||
deventry = NMT_DEVICE_ENTRY(widget);
|
deventry = NMT_DEVICE_ENTRY(widget);
|
||||||
g_object_bind_property(s_con,
|
g_object_bind_property(s_con,
|
||||||
NM_SETTING_CONNECTION_INTERFACE_NAME,
|
NM_SETTING_CONNECTION_INTERFACE_NAME,
|
||||||
deventry,
|
deventry,
|
||||||
"interface-name",
|
"interface-name",
|
||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||||
|
}
|
||||||
|
|
||||||
nmt_editor_grid_append(grid, NULL, nmt_newt_separator_new(), NULL);
|
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))
|
else if (nm_connection_is_type(priv->edit_connection, NM_SETTING_WIRED_SETTING_NAME))
|
||||||
page = nmt_page_ethernet_new(priv->edit_connection, deventry);
|
page = nmt_page_ethernet_new(priv->edit_connection, deventry);
|
||||||
else if (nm_connection_is_type(priv->edit_connection, NM_SETTING_LOOPBACK_SETTING_NAME))
|
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))
|
else if (nm_connection_is_type(priv->edit_connection, NM_SETTING_WIRELESS_SETTING_NAME))
|
||||||
page = nmt_page_wifi_new(priv->edit_connection, deventry);
|
page = nmt_page_wifi_new(priv->edit_connection, deventry);
|
||||||
else if (nm_connection_is_type(priv->edit_connection, NM_SETTING_IP_TUNNEL_SETTING_NAME))
|
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 "nmt-page-loopback.h"
|
||||||
|
|
||||||
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
|
||||||
#include "nmt-device-entry.h"
|
|
||||||
#include "nmt-mtu-entry.h"
|
#include "nmt-mtu-entry.h"
|
||||||
|
|
||||||
G_DEFINE_TYPE(NmtPageLoopback, nmt_page_loopback, NMT_TYPE_EDITOR_PAGE_DEVICE)
|
G_DEFINE_TYPE(NmtPageLoopback, nmt_page_loopback, NMT_TYPE_EDITOR_PAGE_DEVICE)
|
||||||
@@ -27,9 +26,9 @@ nmt_page_loopback_init(NmtPageLoopback *loopback)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
NmtEditorPage *
|
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
|
static void
|
||||||
|
@@ -28,6 +28,6 @@ typedef struct {
|
|||||||
|
|
||||||
GType nmt_page_loopback_get_type(void);
|
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 */
|
#endif /* NMT_PAGE_LOOPBACK_H */
|
||||||
|
Reference in New Issue
Block a user