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