static void nmt_editor_section_init (NmtEditorSection *section) { NmtEditorSectionPrivate *priv = NMT_EDITOR_SECTION_GET_PRIVATE (section); priv->header = NMT_EDITOR_GRID (nmt_editor_grid_new ()); priv->body = NMT_EDITOR_GRID (nmt_editor_grid_new ()); priv->toggle = nmt_newt_toggle_button_new (_("Hide"), _("Show")); g_object_ref_sink (priv->toggle); nmt_newt_section_set_header (NMT_NEWT_SECTION (section), NMT_NEWT_WIDGET (priv->header)); nmt_newt_section_set_body (NMT_NEWT_SECTION (section), NMT_NEWT_WIDGET (priv->body)); g_object_bind_property (priv->toggle, "active", section, "open", G_BINDING_SYNC_CREATE); }
static void nmt_newt_section_remove (NmtNewtContainer *container, NmtNewtWidget *widget) { NmtNewtSection *section = NMT_NEWT_SECTION (container); NmtNewtSectionPrivate *priv = NMT_NEWT_SECTION_GET_PRIVATE (section); NmtNewtContainerClass *parent_class = NMT_NEWT_CONTAINER_CLASS (nmt_newt_section_parent_class); if (widget == priv->header) priv->header = NULL; else if (widget == priv->body) priv->body = NULL; else if (widget == priv->border_grid) priv->border_grid = NULL; parent_class->remove (container, widget); }
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); }