CEPage * ce_page_wired_new (NMConnection *connection, GtkWindow *parent_window, NMClient *client, const char **out_secrets_setting_name, GError **error) { CEPageWired *self; CEPageWiredPrivate *priv; self = CE_PAGE_WIRED (ce_page_new (CE_TYPE_PAGE_WIRED, connection, parent_window, client, UIDIR "/ce-page-wired.ui", "WiredPage", _("Wired"))); if (!self) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load wired user interface.")); return NULL; } wired_private_init (self); priv = CE_PAGE_WIRED_GET_PRIVATE (self); priv->setting = nm_connection_get_setting_wired (connection); if (!priv->setting) { priv->setting = NM_SETTING_WIRED (nm_setting_wired_new ()); nm_connection_add_setting (connection, NM_SETTING (priv->setting)); } g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL); return CE_PAGE (self); }
CEPage * ce_page_wireless_security_new (NMConnection *connection, GtkWindow *parent_window, NMClient *client, const char **out_secrets_setting_name, GError **error) { CEPageWirelessSecurity *self; NMSettingWireless *s_wireless; NMSettingWirelessSecurity *s_wsec = NULL; NMUtilsSecurityType default_type = NMU_SEC_NONE; const char *security; s_wireless = nm_connection_get_setting_wireless (connection); if (!s_wireless) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load WiFi security user interface; missing WiFi setting.")); return NULL; } self = CE_PAGE_WIRELESS_SECURITY (ce_page_new (CE_TYPE_PAGE_WIRELESS_SECURITY, connection, parent_window, client, UIDIR "/ce-page-wireless-security.ui", "WirelessSecurityPage", _("Wireless Security"))); if (!self) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load WiFi security user interface.")); return NULL; } self->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); s_wsec = nm_connection_get_setting_wireless_security (connection); security = nm_setting_wireless_get_security (s_wireless); if (!security || strcmp (security, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)) s_wsec = NULL; if (s_wsec) default_type = get_default_type_for_security (s_wsec); /* Get secrets if the connection is not 802.1x enabled */ if ( default_type == NMU_SEC_STATIC_WEP || default_type == NMU_SEC_LEAP || default_type == NMU_SEC_WPA_PSK || default_type == NMU_SEC_WPA2_PSK) { *out_secrets_setting_name = NM_SETTING_WIRELESS_SECURITY_SETTING_NAME; } /* Or if it is 802.1x enabled */ if ( default_type == NMU_SEC_DYNAMIC_WEP || default_type == NMU_SEC_WPA_ENTERPRISE || default_type == NMU_SEC_WPA2_ENTERPRISE) { *out_secrets_setting_name = NM_SETTING_802_1X_SETTING_NAME; } g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL); return CE_PAGE (self); }
CEPage * ce_page_vpn_new (NMConnectionEditor *editor, NMConnection *connection, GtkWindow *parent_window, NMClient *client, const char **out_secrets_setting_name, GError **error) { CEPageVpn *self; CEPageVpnPrivate *priv; const char *service_type; GError *local = NULL; self = CE_PAGE_VPN (ce_page_new (CE_TYPE_PAGE_VPN, editor, connection, parent_window, client, NULL, NULL, _("VPN"))); if (!self) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load VPN user interface.")); return NULL; } priv = CE_PAGE_VPN_GET_PRIVATE (self); priv->setting = nm_connection_get_setting_vpn (connection); g_assert (priv->setting); service_type = nm_setting_vpn_get_service_type (priv->setting); g_assert (service_type); priv->service_type = g_strdup (service_type); priv->plugin = vpn_get_plugin_by_service (service_type); if (!priv->plugin) { g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not find VPN plugin for “%s”."), service_type); g_object_unref (self); return NULL; } priv->plugin = g_object_ref (priv->plugin); priv->editor = nm_vpn_editor_plugin_get_editor (priv->plugin, CE_PAGE (self)->connection, &local); if (!priv->editor) { g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load editor VPN plugin for “%s” (%s)."), service_type, local ? local->message : _("unknown failure")); g_clear_error (&local); g_object_unref (self); return NULL; } g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL); *out_secrets_setting_name = NM_SETTING_VPN_SETTING_NAME; return CE_PAGE (self); }
CEPage * ce_page_ppp_new (NMConnection *connection, GtkWindow *parent_window, NMClient *client, const char **out_secrets_setting_name, GError **error) { CEPagePpp *self; CEPagePppPrivate *priv; NMSettingConnection *s_con; self = CE_PAGE_PPP (ce_page_new (CE_TYPE_PAGE_PPP, connection, parent_window, client, UIDIR "/ce-page-ppp.ui", "PppPage", _("PPP Settings"))); if (!self) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load PPP user interface.")); return NULL; } ppp_private_init (self); priv = CE_PAGE_PPP_GET_PRIVATE (self); priv->setting = nm_connection_get_setting_ppp (connection); if (!priv->setting) { priv->setting = NM_SETTING_PPP (nm_setting_ppp_new ()); g_object_set (G_OBJECT (priv->setting), NM_SETTING_PPP_LCP_ECHO_FAILURE, 5, NM_SETTING_PPP_LCP_ECHO_INTERVAL, 30, NULL); nm_connection_add_setting (connection, NM_SETTING (priv->setting)); } priv->window_group = gtk_window_group_new (); s_con = nm_connection_get_setting_connection (connection); g_assert (s_con); priv->connection_id = g_strdup (nm_setting_connection_get_id (s_con)); g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL); *out_secrets_setting_name = NM_SETTING_PPP_SETTING_NAME; return CE_PAGE (self); }
CEPage * ce_page_vpn_new (NMConnection *connection, GtkWindow *parent_window, NMClient *client, NMRemoteSettings *settings, const char **out_secrets_setting_name, GError **error) { CEPageVpn *self; CEPageVpnPrivate *priv; const char *service_type; self = CE_PAGE_VPN (ce_page_new (CE_TYPE_PAGE_VPN, connection, parent_window, client, settings, NULL, NULL, _("VPN"))); if (!self) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load VPN user interface.")); return NULL; } priv = CE_PAGE_VPN_GET_PRIVATE (self); priv->setting = nm_connection_get_setting_vpn (connection); g_assert (priv->setting); service_type = nm_setting_vpn_get_service_type (priv->setting); g_assert (service_type); priv->service_type = g_strdup (service_type); priv->plugin = vpn_get_plugin_by_service (service_type); if (!priv->plugin) { g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not find VPN plugin service for '%s'."), service_type); g_object_unref (self); return NULL; } g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL); *out_secrets_setting_name = NM_SETTING_VPN_SETTING_NAME; return CE_PAGE (self); }
CEPage * ce_page_mobile_new (NMConnection *connection, GtkWindow *parent_window, NMClient *client, NMRemoteSettings *settings, const char **out_secrets_setting_name, GError **error) { CEPageMobile *self; CEPageMobilePrivate *priv; self = CE_PAGE_MOBILE (ce_page_new (CE_TYPE_PAGE_MOBILE, connection, parent_window, client, settings, UIDIR "/ce-page-mobile.ui", "MobilePage", _("Mobile Broadband"))); if (!self) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load mobile broadband user interface.")); return NULL; } mobile_private_init (self); priv = CE_PAGE_MOBILE_GET_PRIVATE (self); priv->setting = nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM); if (priv->setting) *out_secrets_setting_name = NM_SETTING_GSM_SETTING_NAME; else { priv->setting = nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA); if (priv->setting) *out_secrets_setting_name = NM_SETTING_CDMA_SETTING_NAME; } if (!priv->setting) { g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "%s", _("Unsupported mobile broadband connection type.")); g_object_unref (self); return NULL; } g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL); return CE_PAGE (self); }
CEPage * ce_page_reset_new (NMConnection *connection, NMClient *client, NetConnectionEditor *editor) { CEPageReset *page; page = CE_PAGE_RESET (ce_page_new (CE_TYPE_PAGE_RESET, connection, client, "/org/gnome/control-center/network/reset-page.ui", _("Reset"))); page->editor = editor; connect_reset_page (page); return CE_PAGE (page); }
CEPage * ce_page_dcb_new (NMConnectionEditor *editor, NMConnection *connection, GtkWindow *parent_window, NMClient *client, const char **out_secrets_setting_name, GError **error) { CEPageDcb *self; CEPageDcbPrivate *priv; CEPage *parent; NMSettingDcb *s_dcb; self = CE_PAGE_DCB (ce_page_new (CE_TYPE_PAGE_DCB, editor, connection, parent_window, client, "/org/gnome/nm_connection_editor/ce-page-dcb.ui", "DcbPage", _("DCB"))); if (!self) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load DCB user interface.")); return NULL; } priv = CE_PAGE_DCB_GET_PRIVATE (self); parent = CE_PAGE (self); priv->enabled = GTK_TOGGLE_BUTTON (gtk_builder_get_object (parent->builder, "dcb_enabled_checkbutton")); priv->box = GTK_BOX (gtk_builder_get_object (parent->builder, "dcb_box")); s_dcb = nm_connection_get_setting_dcb (connection); if (s_dcb) { priv->initial_have_dcb = TRUE; priv->options = (NMSettingDcb *) nm_setting_duplicate (NM_SETTING (s_dcb)); } else priv->options = (NMSettingDcb *) nm_setting_dcb_new (); g_signal_connect (self, CE_PAGE_INITIALIZED, G_CALLBACK (finish_setup), NULL); return CE_PAGE (self); }
CEPage * ce_page_ip4_new (NMConnectionEditor *editor, NMConnection *connection, GtkWindow *parent_window, NMClient *client, const char **out_secrets_setting_name, GError **error) { CEPageIP4 *self; CEPageIP4Private *priv; NMSettingConnection *s_con; self = CE_PAGE_IP4 (ce_page_new (CE_TYPE_PAGE_IP4, editor, connection, parent_window, client, UIDIR "/ce-page-ip4.ui", "IP4Page", _("IPv4 Settings"))); if (!self) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load IPv4 user interface.")); return NULL; } ip4_private_init (self, connection); priv = CE_PAGE_IP4_GET_PRIVATE (self); priv->window_group = gtk_window_group_new (); s_con = nm_connection_get_setting_connection (connection); g_assert (s_con); priv->connection_id = g_strdup (nm_setting_connection_get_id (s_con)); priv->setting = nm_connection_get_setting_ip4_config (connection); g_assert (priv->setting); g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL); return CE_PAGE (self); }
CEPage * ce_page_bridge_port_new (NMConnectionEditor *editor, NMConnection *connection, GtkWindow *parent_window, NMClient *client, const char **out_secrets_setting_name, GError **error) { CEPageBridgePort *self; CEPageBridgePortPrivate *priv; self = CE_PAGE_BRIDGE_PORT (ce_page_new (CE_TYPE_PAGE_BRIDGE_PORT, editor, connection, parent_window, client, UIDIR "/ce-page-bridge-port.ui", "BridgePortPage", /* Translators: a "Bridge Port" is a network * device that is part of a bridge. */ _("Bridge Port"))); if (!self) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load bridge port user interface.")); return NULL; } bridge_port_private_init (self); priv = CE_PAGE_BRIDGE_PORT_GET_PRIVATE (self); priv->setting = nm_connection_get_setting_bridge_port (connection); if (!priv->setting) { priv->setting = NM_SETTING_BRIDGE_PORT (nm_setting_bridge_port_new ()); nm_connection_add_setting (connection, NM_SETTING (priv->setting)); } g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL); return CE_PAGE (self); }
CEPage * ce_page_wifi_new (NMConnectionEditor *editor, NMConnection *connection, GtkWindow *parent_window, NMClient *client, const char **out_secrets_setting_name, GError **error) { CEPageWifi *self; CEPageWifiPrivate *priv; g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); self = CE_PAGE_WIFI (ce_page_new (CE_TYPE_PAGE_WIFI, editor, connection, parent_window, client, UIDIR "/ce-page-wifi.ui", "WifiPage", _("Wi-Fi"))); if (!self) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load Wi-Fi user interface.")); return NULL; } wifi_private_init (self); priv = CE_PAGE_WIFI_GET_PRIVATE (self); priv->setting = nm_connection_get_setting_wireless (connection); if (!priv->setting) { priv->setting = NM_SETTING_WIRELESS (nm_setting_wireless_new ()); nm_connection_add_setting (connection, NM_SETTING (priv->setting)); } g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL); return CE_PAGE (self); }
CEPage * ce_page_bluetooth_new (NMConnectionEditor *editor, NMConnection *connection, GtkWindow *parent_window, NMClient *client, const char **out_secrets_setting_name, GError **error) { CEPageBluetooth *self; CEPageBluetoothPrivate *priv; self = CE_PAGE_BLUETOOTH (ce_page_new (CE_TYPE_PAGE_BLUETOOTH, editor, connection, parent_window, client, UIDIR "/ce-page-bluetooth.ui", "BluetoothPage", _("Bluetooth"))); if (!self) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load Bluetooth user interface.")); return NULL; } bluetooth_private_init (self); priv = CE_PAGE_BLUETOOTH_GET_PRIVATE (self); priv->setting = nm_connection_get_setting_bluetooth (connection); if (!priv->setting) { priv->setting = NM_SETTING_BLUETOOTH (nm_setting_bluetooth_new ()); nm_connection_add_setting (connection, NM_SETTING (priv->setting)); } g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL); *out_secrets_setting_name = NM_SETTING_BLUETOOTH_SETTING_NAME; return CE_PAGE (self); }
CEPage * ce_page_dsl_new (NMConnectionEditor *editor, NMConnection *connection, GtkWindow *parent_window, NMClient *client, const char **out_secrets_setting_name, GError **error) { CEPageDsl *self; CEPageDslPrivate *priv; self = CE_PAGE_DSL (ce_page_new (CE_TYPE_PAGE_DSL, editor, connection, parent_window, client, UIDIR "/ce-page-dsl.ui", "DslPage", _("DSL"))); if (!self) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load DSL user interface.")); return NULL; } dsl_private_init (self); priv = CE_PAGE_DSL_GET_PRIVATE (self); priv->setting = nm_connection_get_setting_pppoe (connection); if (!priv->setting) { priv->setting = NM_SETTING_PPPOE (nm_setting_pppoe_new ()); nm_connection_add_setting (connection, NM_SETTING (priv->setting)); } g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL); *out_secrets_setting_name = NM_SETTING_PPPOE_SETTING_NAME; return CE_PAGE (self); }
CEPage * ce_page_vlan_new (NMConnection *connection, GtkWindow *parent_window, NMClient *client, NMRemoteSettings *settings, const char **out_secrets_setting_name, GError **error) { CEPageVlan *self; CEPageVlanPrivate *priv; self = CE_PAGE_VLAN (ce_page_new (CE_TYPE_PAGE_VLAN, connection, parent_window, client, settings, UIDIR "/ce-page-vlan.ui", "VlanPage", _("VLAN"))); if (!self) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load vlan user interface.")); return NULL; } vlan_private_init (self); priv = CE_PAGE_VLAN_GET_PRIVATE (self); priv->setting = nm_connection_get_setting_vlan (connection); if (!priv->setting) { priv->setting = NM_SETTING_VLAN (nm_setting_vlan_new ()); nm_connection_add_setting (connection, NM_SETTING (priv->setting)); } priv->s_hw = nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED); g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL); return CE_PAGE (self); }