예제 #1
0
static void
nmt_password_fields_init (NmtPasswordFields *fields)
{
	NmtPasswordFieldsPrivate *priv = NMT_PASSWORD_FIELDS_GET_PRIVATE (fields);

	priv->entry = NMT_NEWT_ENTRY (nmt_newt_entry_new (-1, 0));
	priv->always_ask = NMT_NEWT_CHECKBOX (nmt_newt_checkbox_new (_("Ask for this password every time")));
	priv->show_password = NMT_NEWT_CHECKBOX (nmt_newt_checkbox_new (_("Show password")));
}
static void
nmt_page_bridge_port_constructed (GObject *object)
{
	NmtPageBridgePort *bridge = NMT_PAGE_BRIDGE_PORT (object);
	NmtEditorSection *section;
	NmtEditorGrid *grid;
	NMSettingBridgePort *s_port;
	NmtNewtWidget *widget;
	NMConnection *conn;

	conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (bridge));
	s_port = nm_connection_get_setting_bridge_port (conn);
	if (!s_port) {
		nm_connection_add_setting (conn, nm_setting_bridge_port_new ());
		s_port = nm_connection_get_setting_bridge_port (conn);
	}

	section = nmt_editor_section_new (_("BRIDGE PORT"), NULL, TRUE);
	grid = nmt_editor_section_get_body (section);

	widget = nmt_newt_entry_numeric_new (10, 0, 63);
	g_object_bind_property (s_port, NM_SETTING_BRIDGE_PORT_PRIORITY,
	                        widget, "text",
	                        G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
	nmt_editor_grid_append (grid, _("Priority"), widget, NULL);

	widget = nmt_newt_entry_numeric_new (10, 1, 65535);
	g_object_bind_property (s_port, NM_SETTING_BRIDGE_PORT_PATH_COST,
	                        widget, "text",
	                        G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
	nmt_editor_grid_append (grid, _("Path cost"), widget, NULL);

	widget = nmt_newt_checkbox_new (_("Hairpin mode"));
	g_object_bind_property (s_port, NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE,
	                        widget, "active",
	                        G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
	nmt_editor_grid_append (grid, NULL, widget, NULL);

	nmt_editor_page_add_section (NMT_EDITOR_PAGE (bridge), section);

	G_OBJECT_CLASS (nmt_page_bridge_port_parent_class)->constructed (object);
}
예제 #3
0
static void
nmt_page_ppp_constructed (GObject *object)
{
	NmtPagePpp *ppp = NMT_PAGE_PPP (object);
	NmtPagePppPrivate *priv = NMT_PAGE_PPP_GET_PRIVATE (ppp);
	NmtEditorSection *section;
	NmtEditorGrid *grid;
	NMSettingPpp *s_ppp;
	NmtNewtWidget *widget, *use_mppe;
	NmtNewtGrid *auth_grid, *mppe_grid;
	NmtNewtSection *auth_section, *mppe_section;
	NMConnection *conn;

	conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ppp));
	s_ppp = nm_connection_get_setting_ppp (conn);
	if (s_ppp) {
		priv->lcp_echo_interval = nm_setting_ppp_get_lcp_echo_interval (s_ppp);
		priv->lcp_echo_failure = nm_setting_ppp_get_lcp_echo_failure (s_ppp);
	} else {
		s_ppp = (NMSettingPpp *) nm_setting_ppp_new ();
		nm_connection_add_setting (conn, (NMSetting *) s_ppp);

		priv->lcp_echo_interval = 30;
		priv->lcp_echo_failure = 5;
	}

	section = nmt_editor_section_new (_("PPP CONFIGURATION"), NULL, TRUE);
	grid = nmt_editor_section_get_body (section);

	/* Auth methods */
	widget = nmt_newt_section_new (FALSE);
	auth_section = NMT_NEWT_SECTION (widget);
	g_object_set (auth_section, "open", TRUE, NULL);
	nmt_editor_grid_append (grid, NULL, widget, NULL);

	widget = nmt_newt_label_new (_("Allowed authentication methods:"));
	nmt_newt_section_set_header (auth_section, widget);

	widget = nmt_newt_grid_new ();
	auth_grid = NMT_NEWT_GRID (widget);
	nmt_newt_section_set_body (auth_section, widget);

	widget = nmt_newt_checkbox_new (_("EAP"));
	g_object_bind_property (s_ppp, NM_SETTING_PPP_REFUSE_EAP,
	                        widget, "active",
	                        G_BINDING_BIDIRECTIONAL |
	                        G_BINDING_INVERT_BOOLEAN |
	                        G_BINDING_SYNC_CREATE);
	nmt_newt_grid_add (auth_grid, widget, 0, 0);

	widget = nmt_newt_checkbox_new (_("PAP"));
	g_object_bind_property (s_ppp, NM_SETTING_PPP_REFUSE_PAP,
	                        widget, "active",
	                        G_BINDING_BIDIRECTIONAL |
	                        G_BINDING_INVERT_BOOLEAN |
	                        G_BINDING_SYNC_CREATE);
	nmt_newt_grid_add (auth_grid, widget, 0, 1);

	widget = nmt_newt_checkbox_new (_("CHAP"));
	g_object_bind_property (s_ppp, NM_SETTING_PPP_REFUSE_CHAP,
	                        widget, "active",
	                        G_BINDING_BIDIRECTIONAL |
	                        G_BINDING_INVERT_BOOLEAN |
	                        G_BINDING_SYNC_CREATE);
	nmt_newt_grid_add (auth_grid, widget, 0, 2);

	widget = nmt_newt_checkbox_new (_("MSCHAPv2"));
	g_object_bind_property (s_ppp, NM_SETTING_PPP_REFUSE_MSCHAPV2,
	                        widget, "active",
	                        G_BINDING_BIDIRECTIONAL |
	                        G_BINDING_INVERT_BOOLEAN |
	                        G_BINDING_SYNC_CREATE);
	nmt_newt_grid_add (auth_grid, widget, 0, 3);

	widget = nmt_newt_checkbox_new (_("MSCHAP"));
	g_object_bind_property (s_ppp, NM_SETTING_PPP_REFUSE_MSCHAP,
	                        widget, "active",
	                        G_BINDING_BIDIRECTIONAL |
	                        G_BINDING_INVERT_BOOLEAN |
	                        G_BINDING_SYNC_CREATE);
	nmt_newt_grid_add (auth_grid, widget, 0, 4);

	nmt_editor_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);

	/* MPPE */
	widget = nmt_newt_section_new (FALSE);
	mppe_section = NMT_NEWT_SECTION (widget);
	g_object_set (mppe_section, "open", TRUE, NULL);
	nmt_editor_grid_append (grid, NULL, widget, NULL);

	widget = nmt_newt_checkbox_new (_("Use point-to-point encryption (MPPE)"));
	g_object_bind_property (s_ppp, NM_SETTING_PPP_REQUIRE_MPPE,
	                        widget, "active",
	                        G_BINDING_BIDIRECTIONAL |
	                        G_BINDING_SYNC_CREATE);
	use_mppe = widget;
	nmt_newt_section_set_header (mppe_section, widget);

	widget = nmt_newt_grid_new ();
	mppe_grid = NMT_NEWT_GRID (widget);
	nmt_newt_section_set_body (mppe_section, widget);

	widget = nmt_newt_checkbox_new (_("Require 128-bit encryption"));
	g_object_bind_property (use_mppe, "active",
	                        widget, "sensitive",
	                        G_BINDING_SYNC_CREATE);
	g_object_bind_property (s_ppp, NM_SETTING_PPP_REQUIRE_MPPE_128,
	                        widget, "active",
	                        G_BINDING_BIDIRECTIONAL |
	                        G_BINDING_SYNC_CREATE);
	nmt_newt_grid_add (mppe_grid, widget, 0, 0);

	widget = nmt_newt_checkbox_new (_("Use stateful MPPE"));
	g_object_bind_property (use_mppe, "active",
	                        widget, "sensitive",
	                        G_BINDING_SYNC_CREATE);
	g_object_bind_property (s_ppp, NM_SETTING_PPP_MPPE_STATEFUL,
	                        widget, "active",
	                        G_BINDING_BIDIRECTIONAL |
	                        G_BINDING_SYNC_CREATE);
	nmt_newt_grid_add (mppe_grid, widget, 0, 1);

	nmt_editor_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);

	widget = nmt_newt_checkbox_new (_("Allow BSD data compression"));
	g_object_bind_property (s_ppp, NM_SETTING_PPP_NOBSDCOMP,
	                        widget, "active",
	                        G_BINDING_BIDIRECTIONAL |
	                        G_BINDING_INVERT_BOOLEAN |
	                        G_BINDING_SYNC_CREATE);
	nmt_editor_grid_append (grid, NULL, widget, NULL);

	widget = nmt_newt_checkbox_new (_("Allow Deflate data compression"));
	g_object_bind_property (s_ppp, NM_SETTING_PPP_NODEFLATE,
	                        widget, "active",
	                        G_BINDING_BIDIRECTIONAL |
	                        G_BINDING_INVERT_BOOLEAN |
	                        G_BINDING_SYNC_CREATE);
	nmt_editor_grid_append (grid, NULL, widget, NULL);

	widget = nmt_newt_checkbox_new (_("Use TCP header compression"));
	g_object_bind_property (s_ppp, NM_SETTING_PPP_NO_VJ_COMP,
	                        widget, "active",
	                        G_BINDING_BIDIRECTIONAL |
	                        G_BINDING_INVERT_BOOLEAN |
	                        G_BINDING_SYNC_CREATE);
	nmt_editor_grid_append (grid, NULL, widget, NULL);

	nmt_editor_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);

	widget = nmt_newt_checkbox_new (_("Send PPP echo packets"));
	g_object_bind_property_full (s_ppp, NM_SETTING_PPP_LCP_ECHO_INTERVAL,
	                             widget, "active",
	                             G_BINDING_BIDIRECTIONAL |
	                             G_BINDING_SYNC_CREATE,
	                             transform_lcp_echo_properties_to_checkbox,
	                             transform_checkbox_to_lcp_echo_interval,
	                             ppp, NULL);
	g_object_bind_property_full (s_ppp, NM_SETTING_PPP_LCP_ECHO_FAILURE,
	                             widget, "active",
	                             G_BINDING_BIDIRECTIONAL |
	                             G_BINDING_SYNC_CREATE,
	                             transform_lcp_echo_properties_to_checkbox,
	                             transform_checkbox_to_lcp_echo_failure,
	                             ppp, NULL);
	nmt_editor_grid_append (grid, NULL, widget, NULL);

	nmt_editor_page_add_section (NMT_EDITOR_PAGE (ppp), section);

	G_OBJECT_CLASS (nmt_page_ppp_parent_class)->constructed (object);
}
예제 #4
0
static void
nmt_page_ip4_constructed (GObject *object)
{
	NmtPageIP4 *ip4 = NMT_PAGE_IP4 (object);
	gboolean show_by_default;
	NmtEditorSection *section;
	NmtEditorGrid *grid;
	NMSettingIPConfig *s_ip4;
	NmtNewtWidget *widget, *button;
	NMConnection *conn;

	conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ip4));
	s_ip4 = nm_connection_get_setting_ip4_config (conn);
	if (!s_ip4) {
		s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
		g_object_set (G_OBJECT (s_ip4),
		              NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
		              NULL);
		nm_connection_add_setting (conn, (NMSetting *) s_ip4);
	}

	widget = nmt_newt_popup_new (ip4methods);
	g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_METHOD,
	                        widget, "active-id",
	                        G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);

	if (!g_strcmp0 (nm_setting_ip_config_get_method (s_ip4), NM_SETTING_IP4_CONFIG_METHOD_MANUAL))
		show_by_default = TRUE;
	else if (nm_setting_ip_config_get_num_addresses (s_ip4))
		show_by_default = TRUE;
	else
		show_by_default = FALSE;

	section = nmt_editor_section_new (_("IPv4 CONFIGURATION"), widget, show_by_default);
	grid = nmt_editor_section_get_body (section);

	widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP4_WITH_PREFIX);
	nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET,
	                                                 s_ip4, NM_SETTING_IP_CONFIG_ADDRESSES,
	                                                 widget, "strings",
	                                                 G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
	nmt_editor_grid_append (grid, _("Addresses"), widget, NULL);

	widget = nmt_ip_entry_new (25, AF_INET, FALSE, TRUE);
	nm_editor_bind_ip_gateway_to_string (AF_INET,
	                                     s_ip4,
	                                     widget, "text", "sensitive",
	                                     G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
	nmt_editor_grid_append (grid, _("Gateway"), widget, NULL);

	widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP4);
	nm_editor_bind_ip_addresses_to_strv (AF_INET,
	                                     s_ip4, NM_SETTING_IP_CONFIG_DNS,
	                                     widget, "strings",
	                                     G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
	nmt_editor_grid_append (grid, _("DNS servers"), widget, NULL);

	widget = nmt_address_list_new (NMT_ADDRESS_LIST_HOSTNAME);
	g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_DNS_SEARCH,
	                        widget, "strings",
	                        G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
	nmt_editor_grid_append (grid, _("Search domains"), widget, NULL);

	nmt_editor_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);

	widget = g_object_new (NMT_TYPE_NEWT_LABEL,
	                       "text", "",
	                       "style", NMT_NEWT_LABEL_PLAIN,
	                       NULL);
	g_object_bind_property_full (s_ip4, NM_SETTING_IP_CONFIG_ROUTES,
	                             widget, "text",
	                             G_BINDING_SYNC_CREATE,
	                             ip4_routes_transform_to_description,
	                             NULL, NULL, NULL);
	button = nmt_newt_button_new (_("Edit..."));
	g_signal_connect (button, "clicked", G_CALLBACK (edit_routes), s_ip4);
	nmt_editor_grid_append (grid, _("Routing"), widget, button);

	widget = nmt_newt_checkbox_new (_("Never use this network for default route"));
	g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_NEVER_DEFAULT,
	                        widget, "active",
	                        G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
	nmt_editor_grid_append (grid, NULL, widget, NULL);

	widget = nmt_newt_checkbox_new (_("Ignore automatically obtained routes"));
	g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES,
	                        widget, "active",
	                        G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
	nmt_editor_grid_append (grid, NULL, widget, NULL);

	nmt_editor_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);

	widget = nmt_newt_checkbox_new (_("Require IPv4 addressing for this connection"));
	g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_MAY_FAIL,
	                        widget, "active",
	                        G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL |
	                        G_BINDING_INVERT_BOOLEAN);
	nmt_editor_grid_append (grid, NULL, widget, NULL);

	nmt_editor_page_add_section (NMT_EDITOR_PAGE (ip4), section);

	G_OBJECT_CLASS (nmt_page_ip4_parent_class)->constructed (object);
}
예제 #5
0
static void
nmt_page_bridge_constructed (GObject *object)
{
	NmtPageBridge *bridge = NMT_PAGE_BRIDGE (object);
	NmtDeviceEntry *deventry;
	NmtPageGrid *grid;
	NMSettingBridge *s_bridge;
	NmtNewtWidget *widget, *label, *stp;
	NMConnection *conn;

	conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (bridge));
	s_bridge = nm_connection_get_setting_bridge (conn);
	if (!s_bridge) {
		nm_connection_add_setting (conn, nm_setting_bridge_new ());
		s_bridge = nm_connection_get_setting_bridge (conn);
	}

	deventry = nmt_page_device_get_device_entry (NMT_PAGE_DEVICE (object));
	g_object_bind_property (s_bridge, NM_SETTING_BRIDGE_INTERFACE_NAME,
	                        deventry, "interface-name",
	                        G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);

	grid = NMT_PAGE_GRID (bridge);

	widget = nmt_newt_separator_new ();
	nmt_page_grid_append (grid, _("Slaves"), widget, NULL);
	nmt_page_grid_set_row_flags (grid, widget, NMT_PAGE_GRID_ROW_LABEL_ALIGN_LEFT);

	widget = nmt_slave_list_new (conn, bridge_connection_type_filter, bridge);
	nmt_page_grid_append (grid, NULL, widget, NULL);

	widget = nmt_newt_entry_numeric_new (10, 0, 1000000);
	g_object_bind_property (s_bridge, NM_SETTING_BRIDGE_AGEING_TIME,
	                        widget, "text",
	                        G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
	label = nmt_newt_label_new (_("seconds"));
	nmt_page_grid_append (grid, _("Aging time"), widget, label);

	widget = stp = nmt_newt_checkbox_new (_("Enable STP (Spanning Tree Protocol)"));
	g_object_bind_property (s_bridge, NM_SETTING_BRIDGE_STP,
	                        widget, "active",
	                        G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
	nmt_page_grid_append (grid, NULL, widget, NULL);

	widget = nmt_newt_entry_numeric_new (10, 0, G_MAXINT);
	g_object_bind_property (s_bridge, NM_SETTING_BRIDGE_PRIORITY,
	                        widget, "text",
	                        G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
	g_object_bind_property (s_bridge, NM_SETTING_BRIDGE_STP,
	                        widget, "sensitive",
	                        G_BINDING_SYNC_CREATE);
	nmt_page_grid_append (grid, _("Priority"), widget, NULL);

	widget = nmt_newt_entry_numeric_new (10, 2, 30);
	g_object_bind_property (s_bridge, NM_SETTING_BRIDGE_FORWARD_DELAY,
	                        widget, "text",
	                        G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
	g_object_bind_property (s_bridge, NM_SETTING_BRIDGE_STP,
	                        widget, "sensitive",
	                        G_BINDING_SYNC_CREATE);
	label = nmt_newt_label_new (_("seconds"));
	nmt_page_grid_append (grid, _("Forward delay"), widget, label);

	widget = nmt_newt_entry_numeric_new (10, 1, 10);
	g_object_bind_property (s_bridge, NM_SETTING_BRIDGE_HELLO_TIME,
	                        widget, "text",
	                        G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
	g_object_bind_property (s_bridge, NM_SETTING_BRIDGE_STP,
	                        widget, "sensitive",
	                        G_BINDING_SYNC_CREATE);
	label = nmt_newt_label_new (_("seconds"));
	nmt_page_grid_append (grid, _("Hello time"), widget, label);

	widget = nmt_newt_entry_numeric_new (10, 6, 40);
	g_object_bind_property (s_bridge, NM_SETTING_BRIDGE_MAX_AGE,
	                        widget, "text",
	                        G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
	g_object_bind_property (s_bridge, NM_SETTING_BRIDGE_STP,
	                        widget, "sensitive",
	                        G_BINDING_SYNC_CREATE);
	label = nmt_newt_label_new (_("seconds"));
	nmt_page_grid_append (grid, _("Max age"), widget, label);

	G_OBJECT_CLASS (nmt_page_bridge_parent_class)->constructed (object);
}