|
Packit Service |
87a54e |
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
Packit |
5756e2 |
/*
|
|
Packit |
5756e2 |
* Copyright (C) 2013 Red Hat, Inc.
|
|
Packit |
5756e2 |
*/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/**
|
|
Packit |
5756e2 |
* SECTION:nmt-page-bridge-port
|
|
Packit |
5756e2 |
* @short_description: The editor page for Bridge ports
|
|
Packit |
5756e2 |
*/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#include "nm-default.h"
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#include "nmt-page-bridge-port.h"
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
G_DEFINE_TYPE(NmtPageBridgePort, nmt_page_bridge_port, NMT_TYPE_EDITOR_PAGE)
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
NmtEditorPage *
|
|
Packit Service |
a1bd4f |
nmt_page_bridge_port_new(NMConnection *conn)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
return g_object_new(NMT_TYPE_PAGE_BRIDGE_PORT, "connection", conn, NULL);
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static void
|
|
Packit Service |
a1bd4f |
nmt_page_bridge_port_init(NmtPageBridgePort *bridge)
|
|
Packit Service |
a1bd4f |
{}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static void
|
|
Packit Service |
a1bd4f |
nmt_page_bridge_port_constructed(GObject *object)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
NmtPageBridgePort * bridge = NMT_PAGE_BRIDGE_PORT(object);
|
|
Packit Service |
a1bd4f |
NmtEditorSection * section;
|
|
Packit Service |
a1bd4f |
NmtEditorGrid * grid;
|
|
Packit Service |
a1bd4f |
NMSettingBridgePort *s_port;
|
|
Packit Service |
a1bd4f |
NmtNewtWidget * widget;
|
|
Packit Service |
a1bd4f |
NMConnection * conn;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(bridge));
|
|
Packit Service |
a1bd4f |
s_port = nm_connection_get_setting_bridge_port(conn);
|
|
Packit Service |
a1bd4f |
if (!s_port) {
|
|
Packit Service |
a1bd4f |
nm_connection_add_setting(conn, nm_setting_bridge_port_new());
|
|
Packit Service |
a1bd4f |
s_port = nm_connection_get_setting_bridge_port(conn);
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
section = nmt_editor_section_new(_("BRIDGE PORT"), NULL, TRUE);
|
|
Packit Service |
a1bd4f |
grid = nmt_editor_section_get_body(section);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_newt_entry_numeric_new(10, 0, 63);
|
|
Packit Service |
a1bd4f |
g_object_bind_property(s_port,
|
|
Packit Service |
a1bd4f |
NM_SETTING_BRIDGE_PORT_PRIORITY,
|
|
Packit Service |
a1bd4f |
widget,
|
|
Packit Service |
a1bd4f |
"text",
|
|
Packit Service |
a1bd4f |
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(grid, _("Priority"), widget, NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_newt_entry_numeric_new(10, 1, 65535);
|
|
Packit Service |
a1bd4f |
g_object_bind_property(s_port,
|
|
Packit Service |
a1bd4f |
NM_SETTING_BRIDGE_PORT_PATH_COST,
|
|
Packit Service |
a1bd4f |
widget,
|
|
Packit Service |
a1bd4f |
"text",
|
|
Packit Service |
a1bd4f |
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(grid, _("Path cost"), widget, NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_newt_checkbox_new(_("Hairpin mode"));
|
|
Packit Service |
a1bd4f |
g_object_bind_property(s_port,
|
|
Packit Service |
a1bd4f |
NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE,
|
|
Packit Service |
a1bd4f |
widget,
|
|
Packit Service |
a1bd4f |
"active",
|
|
Packit Service |
a1bd4f |
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(grid, NULL, widget, NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
nmt_editor_page_add_section(NMT_EDITOR_PAGE(bridge), section);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
G_OBJECT_CLASS(nmt_page_bridge_port_parent_class)->constructed(object);
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static void
|
|
Packit Service |
a1bd4f |
nmt_page_bridge_port_class_init(NmtPageBridgePortClass *bridge_class)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
GObjectClass *object_class = G_OBJECT_CLASS(bridge_class);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
object_class->constructed = nmt_page_bridge_port_constructed;
|
|
Packit |
5756e2 |
}
|