network: Move connection reference outside of CEPage
This commit is contained in:
parent
fc25e17a9f
commit
eb7372d83b
15 changed files with 91 additions and 181 deletions
|
@ -43,6 +43,7 @@ struct _CEPage8021xSecurity {
|
|||
GtkGrid *grid;
|
||||
GtkLabel *security_label;
|
||||
|
||||
NMConnection *connection;
|
||||
GtkWidget *security_widget;
|
||||
WirelessSecurity *security;
|
||||
GtkSizeGroup *group;
|
||||
|
@ -74,7 +75,7 @@ finish_setup (CEPage8021xSecurity *self, gpointer unused, GError *error, gpointe
|
|||
|
||||
self->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
|
||||
self->security = (WirelessSecurity *) ws_wpa_eap_new (CE_PAGE (self)->connection, TRUE, FALSE);
|
||||
self->security = (WirelessSecurity *) ws_wpa_eap_new (self->connection, TRUE, FALSE);
|
||||
if (!self->security) {
|
||||
g_warning ("Could not load 802.1x user interface.");
|
||||
return;
|
||||
|
@ -97,36 +98,6 @@ finish_setup (CEPage8021xSecurity *self, gpointer unused, GError *error, gpointe
|
|||
|
||||
}
|
||||
|
||||
CEPage *
|
||||
ce_page_8021x_security_new (NMConnection *connection,
|
||||
NMClient *client)
|
||||
{
|
||||
CEPage8021xSecurity *self;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_8021X_SECURITY (g_object_new (ce_page_8021x_security_get_type (),
|
||||
"connection", connection,
|
||||
NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/8021x-security-page.ui", &error)) {
|
||||
g_warning ("Couldn't load builder file: %s", error->message);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self->box = GTK_BOX (gtk_builder_get_object (self->builder, "box"));
|
||||
self->enable_8021x_switch = GTK_SWITCH (gtk_builder_get_object (self->builder, "enable_8021x_switch"));
|
||||
self->grid = GTK_GRID (gtk_builder_get_object (self->builder, "grid"));
|
||||
self->security_label = GTK_LABEL (gtk_builder_get_object (self->builder, "security_label"));
|
||||
|
||||
if (nm_connection_get_setting_802_1x (connection))
|
||||
self->initial_have_8021x = TRUE;
|
||||
|
||||
g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
|
||||
|
||||
return CE_PAGE (self);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
ce_page_8021x_security_get_security_setting (CEPage *page)
|
||||
{
|
||||
|
@ -195,11 +166,12 @@ ce_page_8021x_security_init (CEPage8021xSecurity *self)
|
|||
}
|
||||
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
ce_page_8021x_security_dispose (GObject *object)
|
||||
{
|
||||
CEPage8021xSecurity *self = CE_PAGE_8021X_SECURITY (object);
|
||||
|
||||
g_clear_object (&self->builder);
|
||||
g_clear_object (&self->connection);
|
||||
g_clear_pointer (&self->security, wireless_security_unref);
|
||||
g_clear_object (&self->group);
|
||||
|
||||
|
@ -212,11 +184,38 @@ ce_page_8021x_security_class_init (CEPage8021xSecurityClass *security_class)
|
|||
GObjectClass *object_class = G_OBJECT_CLASS (security_class);
|
||||
CEPageClass *parent_class = CE_PAGE_CLASS (security_class);
|
||||
|
||||
/* virtual methods */
|
||||
object_class->dispose = dispose;
|
||||
|
||||
object_class->dispose = ce_page_8021x_security_dispose;
|
||||
parent_class->get_security_setting = ce_page_8021x_security_get_security_setting;
|
||||
parent_class->get_widget = ce_page_8021x_security_get_widget;
|
||||
parent_class->get_title = ce_page_8021x_security_get_title;
|
||||
parent_class->validate = ce_page_8021x_security_validate;
|
||||
}
|
||||
|
||||
CEPage *
|
||||
ce_page_8021x_security_new (NMConnection *connection)
|
||||
{
|
||||
CEPage8021xSecurity *self;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_8021X_SECURITY (g_object_new (ce_page_8021x_security_get_type (), NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/8021x-security-page.ui", &error)) {
|
||||
g_warning ("Couldn't load builder file: %s", error->message);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self->box = GTK_BOX (gtk_builder_get_object (self->builder, "box"));
|
||||
self->enable_8021x_switch = GTK_SWITCH (gtk_builder_get_object (self->builder, "enable_8021x_switch"));
|
||||
self->grid = GTK_GRID (gtk_builder_get_object (self->builder, "grid"));
|
||||
self->security_label = GTK_LABEL (gtk_builder_get_object (self->builder, "security_label"));
|
||||
|
||||
self->connection = g_object_ref (connection);
|
||||
|
||||
if (nm_connection_get_setting_802_1x (connection))
|
||||
self->initial_have_8021x = TRUE;
|
||||
|
||||
g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
|
||||
|
||||
return CE_PAGE (self);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ G_BEGIN_DECLS
|
|||
|
||||
G_DECLARE_FINAL_TYPE (CEPage8021xSecurity, ce_page_8021x_security, CE, PAGE_8021X_SECURITY, CEPage)
|
||||
|
||||
CEPage *ce_page_8021x_security_new (NMConnection *connection,
|
||||
NMClient *client);
|
||||
CEPage *ce_page_8021x_security_new (NMConnection *connection);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -57,6 +57,7 @@ struct _CEPageDetails
|
|||
GtkLabel *strength_heading_label;
|
||||
GtkLabel *strength_label;
|
||||
|
||||
NMConnection *connection;
|
||||
NMDevice *device;
|
||||
NMAccessPoint *ap;
|
||||
NetConnectionEditor *editor;
|
||||
|
@ -153,7 +154,7 @@ all_user_changed (CEPageDetails *self)
|
|||
gboolean all_users;
|
||||
NMSettingConnection *sc;
|
||||
|
||||
sc = nm_connection_get_setting_connection (CE_PAGE (self)->connection);
|
||||
sc = nm_connection_get_setting_connection (self->connection);
|
||||
all_users = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->all_user_check));
|
||||
|
||||
g_object_set (sc, "permissions", NULL, NULL);
|
||||
|
@ -167,7 +168,7 @@ restrict_data_changed (CEPageDetails *self)
|
|||
NMSettingConnection *s_con;
|
||||
NMMetered metered;
|
||||
|
||||
s_con = nm_connection_get_setting_connection (CE_PAGE (self)->connection);
|
||||
s_con = nm_connection_get_setting_connection (self->connection);
|
||||
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->restrict_data_check)))
|
||||
metered = NM_METERED_YES;
|
||||
|
@ -184,7 +185,7 @@ update_restrict_data (CEPageDetails *self)
|
|||
NMMetered metered;
|
||||
const gchar *type;
|
||||
|
||||
s_con = nm_connection_get_setting_connection (CE_PAGE (self)->connection);
|
||||
s_con = nm_connection_get_setting_connection (self->connection);
|
||||
|
||||
if (s_con == NULL)
|
||||
return;
|
||||
|
@ -222,7 +223,7 @@ connect_details_page (CEPageDetails *self)
|
|||
NMIPConfig *ipv4_config = NULL, *ipv6_config = NULL;
|
||||
gboolean have_ipv4_address = FALSE, have_ipv6_address = FALSE;
|
||||
|
||||
sc = nm_connection_get_setting_connection (CE_PAGE (self)->connection);
|
||||
sc = nm_connection_get_setting_connection (self->connection);
|
||||
type = nm_setting_connection_get_connection_type (sc);
|
||||
|
||||
if (NM_IS_DEVICE_WIFI (self->device))
|
||||
|
@ -244,7 +245,7 @@ connect_details_page (CEPageDetails *self)
|
|||
|
||||
ac = nm_device_get_active_connection (self->device);
|
||||
p1 = ac ? nm_active_connection_get_uuid (ac) : NULL;
|
||||
p2 = nm_connection_get_uuid (CE_PAGE (self)->connection);
|
||||
p2 = nm_connection_get_uuid (self->connection);
|
||||
if (g_strcmp0 (p1, p2) == 0) {
|
||||
device_is_active = TRUE;
|
||||
if (NM_IS_DEVICE_WIFI (self->device))
|
||||
|
@ -355,8 +356,8 @@ connect_details_page (CEPageDetails *self)
|
|||
gtk_label_set_label (self->ipv6_heading_label, _("IP Address"));
|
||||
}
|
||||
|
||||
if (!device_is_active && CE_PAGE (self)->connection)
|
||||
update_last_used (self, CE_PAGE (self)->connection);
|
||||
if (!device_is_active && self->connection)
|
||||
update_last_used (self, self->connection);
|
||||
else {
|
||||
gtk_widget_set_visible (GTK_WIDGET (self->last_used_heading_label), FALSE);
|
||||
gtk_widget_set_visible (GTK_WIDGET (self->last_used_label), FALSE);
|
||||
|
@ -401,6 +402,7 @@ ce_page_details_dispose (GObject *object)
|
|||
CEPageDetails *self = CE_PAGE_DETAILS (object);
|
||||
|
||||
g_clear_object (&self->builder);
|
||||
g_clear_object (&self->connection);
|
||||
|
||||
G_OBJECT_CLASS (ce_page_details_parent_class)->dispose (object);
|
||||
}
|
||||
|
@ -436,7 +438,6 @@ ce_page_details_class_init (CEPageDetailsClass *class)
|
|||
|
||||
CEPage *
|
||||
ce_page_details_new (NMConnection *connection,
|
||||
NMClient *client,
|
||||
NMDevice *device,
|
||||
NMAccessPoint *ap,
|
||||
NetConnectionEditor *editor)
|
||||
|
@ -444,9 +445,7 @@ ce_page_details_new (NMConnection *connection,
|
|||
CEPageDetails *self;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_DETAILS (g_object_new (ce_page_details_get_type (),
|
||||
"connection", connection,
|
||||
NULL));
|
||||
self = CE_PAGE_DETAILS (g_object_new (ce_page_details_get_type (), NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/details-page.ui", &error)) {
|
||||
|
@ -478,6 +477,7 @@ ce_page_details_new (NMConnection *connection,
|
|||
self->strength_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder, "strength_heading_label"));
|
||||
self->strength_label = GTK_LABEL (gtk_builder_get_object (self->builder, "strength_label"));
|
||||
|
||||
self->connection = g_object_ref (connection);
|
||||
self->editor = editor;
|
||||
self->device = device;
|
||||
self->ap = ap;
|
||||
|
|
|
@ -31,7 +31,6 @@ G_BEGIN_DECLS
|
|||
G_DECLARE_FINAL_TYPE (CEPageDetails, ce_page_details, CE, PAGE_DETAILS, CEPage)
|
||||
|
||||
CEPage *ce_page_details_new (NMConnection *connection,
|
||||
NMClient *client,
|
||||
NMDevice *device,
|
||||
NMAccessPoint *ap,
|
||||
NetConnectionEditor *editor);
|
||||
|
|
|
@ -225,9 +225,7 @@ ce_page_ethernet_new (NMConnection *connection,
|
|||
CEPageEthernet *self;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_ETHERNET (g_object_new (ce_page_ethernet_get_type (),
|
||||
"connection", connection,
|
||||
NULL));
|
||||
self = CE_PAGE_ETHERNET (g_object_new (ce_page_ethernet_get_type (), NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/ethernet-page.ui", &error)) {
|
||||
|
|
|
@ -905,9 +905,7 @@ ce_page_ip4_new (NMConnection *connection,
|
|||
CEPageIP4 *self;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_IP4 (g_object_new (ce_page_ip4_get_type (),
|
||||
"connection", connection,
|
||||
NULL));
|
||||
self = CE_PAGE_IP4 (g_object_new (ce_page_ip4_get_type (), NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/ip4-page.ui", &error)) {
|
||||
|
|
|
@ -828,9 +828,7 @@ ce_page_ip6_new (NMConnection *connection,
|
|||
CEPageIP6 *self;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_IP6 (g_object_new (ce_page_ip6_get_type (),
|
||||
"connection", connection,
|
||||
NULL));
|
||||
self = CE_PAGE_IP6 (g_object_new (ce_page_ip6_get_type (), NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/ip6-page.ui", &error)) {
|
||||
|
|
|
@ -44,6 +44,7 @@ struct _CEPageSecurity
|
|||
GtkComboBox *security_combo;
|
||||
GtkLabel *security_label;
|
||||
|
||||
NMConnection *connection;
|
||||
const gchar *security_setting;
|
||||
GtkSizeGroup *group;
|
||||
gboolean adhoc;
|
||||
|
@ -215,7 +216,6 @@ set_sensitive (GtkCellLayout *cell_layout,
|
|||
static void
|
||||
finish_setup (CEPageSecurity *self)
|
||||
{
|
||||
NMConnection *connection = CE_PAGE (self)->connection;
|
||||
NMSettingWireless *sw;
|
||||
NMSettingWirelessSecurity *sws;
|
||||
gboolean is_adhoc = FALSE;
|
||||
|
@ -228,7 +228,7 @@ finish_setup (CEPageSecurity *self)
|
|||
int item = 0;
|
||||
GtkCellRenderer *renderer;
|
||||
|
||||
sw = nm_connection_get_setting_wireless (connection);
|
||||
sw = nm_connection_get_setting_wireless (self->connection);
|
||||
g_assert (sw);
|
||||
|
||||
self->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
|
@ -245,7 +245,7 @@ finish_setup (CEPageSecurity *self)
|
|||
is_adhoc = TRUE;
|
||||
self->adhoc = is_adhoc;
|
||||
|
||||
sws = nm_connection_get_setting_wireless_security (connection);
|
||||
sws = nm_connection_get_setting_wireless_security (self->connection);
|
||||
if (sws)
|
||||
default_type = get_default_type_for_security (sws);
|
||||
|
||||
|
@ -266,14 +266,14 @@ finish_setup (CEPageSecurity *self)
|
|||
NMWepKeyType wep_type = NM_WEP_KEY_TYPE_KEY;
|
||||
|
||||
if (default_type == NMU_SEC_STATIC_WEP) {
|
||||
sws = nm_connection_get_setting_wireless_security (connection);
|
||||
sws = nm_connection_get_setting_wireless_security (self->connection);
|
||||
if (sws)
|
||||
wep_type = nm_setting_wireless_security_get_wep_key_type (sws);
|
||||
if (wep_type == NM_WEP_KEY_TYPE_UNKNOWN)
|
||||
wep_type = NM_WEP_KEY_TYPE_KEY;
|
||||
}
|
||||
|
||||
ws_wep = ws_wep_key_new (connection, NM_WEP_KEY_TYPE_KEY, FALSE, FALSE);
|
||||
ws_wep = ws_wep_key_new (self->connection, NM_WEP_KEY_TYPE_KEY, FALSE, FALSE);
|
||||
if (ws_wep) {
|
||||
add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
|
||||
&iter, _("WEP 40/128-bit Key (Hex or ASCII)"),
|
||||
|
@ -283,7 +283,7 @@ finish_setup (CEPageSecurity *self)
|
|||
item++;
|
||||
}
|
||||
|
||||
ws_wep = ws_wep_key_new (connection, NM_WEP_KEY_TYPE_PASSPHRASE, FALSE, FALSE);
|
||||
ws_wep = ws_wep_key_new (self->connection, NM_WEP_KEY_TYPE_PASSPHRASE, FALSE, FALSE);
|
||||
if (ws_wep) {
|
||||
add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
|
||||
&iter, _("WEP 128-bit Passphrase"), TRUE);
|
||||
|
@ -296,7 +296,7 @@ finish_setup (CEPageSecurity *self)
|
|||
if (nm_utils_security_valid (NMU_SEC_LEAP, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
|
||||
WirelessSecurityLEAP *ws_leap;
|
||||
|
||||
ws_leap = ws_leap_new (connection, FALSE);
|
||||
ws_leap = ws_leap_new (self->connection, FALSE);
|
||||
if (ws_leap) {
|
||||
add_security_item (self, WIRELESS_SECURITY (ws_leap), sec_model,
|
||||
&iter, _("LEAP"), FALSE);
|
||||
|
@ -309,7 +309,7 @@ finish_setup (CEPageSecurity *self)
|
|||
if (nm_utils_security_valid (NMU_SEC_DYNAMIC_WEP, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
|
||||
WirelessSecurityDynamicWEP *ws_dynamic_wep;
|
||||
|
||||
ws_dynamic_wep = ws_dynamic_wep_new (connection, TRUE, FALSE);
|
||||
ws_dynamic_wep = ws_dynamic_wep_new (self->connection, TRUE, FALSE);
|
||||
if (ws_dynamic_wep) {
|
||||
add_security_item (self, WIRELESS_SECURITY (ws_dynamic_wep), sec_model,
|
||||
&iter, _("Dynamic WEP (802.1x)"), FALSE);
|
||||
|
@ -323,7 +323,7 @@ finish_setup (CEPageSecurity *self)
|
|||
nm_utils_security_valid (NMU_SEC_WPA2_PSK, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
|
||||
WirelessSecurityWPAPSK *ws_wpa_psk;
|
||||
|
||||
ws_wpa_psk = ws_wpa_psk_new (connection, FALSE);
|
||||
ws_wpa_psk = ws_wpa_psk_new (self->connection, FALSE);
|
||||
if (ws_wpa_psk) {
|
||||
add_security_item (self, WIRELESS_SECURITY (ws_wpa_psk), sec_model,
|
||||
&iter, _("WPA & WPA2 Personal"), FALSE);
|
||||
|
@ -337,7 +337,7 @@ finish_setup (CEPageSecurity *self)
|
|||
nm_utils_security_valid (NMU_SEC_WPA2_ENTERPRISE, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
|
||||
WirelessSecurityWPAEAP *ws_wpa_eap;
|
||||
|
||||
ws_wpa_eap = ws_wpa_eap_new (connection, TRUE, FALSE);
|
||||
ws_wpa_eap = ws_wpa_eap_new (self->connection, TRUE, FALSE);
|
||||
if (ws_wpa_eap) {
|
||||
add_security_item (self, WIRELESS_SECURITY (ws_wpa_eap), sec_model,
|
||||
&iter, _("WPA & WPA2 Enterprise"), FALSE);
|
||||
|
@ -368,6 +368,7 @@ ce_page_security_dispose (GObject *object)
|
|||
CEPageSecurity *self = CE_PAGE_SECURITY (object);
|
||||
|
||||
g_clear_object (&self->builder);
|
||||
g_clear_object (&self->connection);
|
||||
g_clear_object (&self->group);
|
||||
|
||||
G_OBJECT_CLASS (ce_page_security_parent_class)->dispose (object);
|
||||
|
@ -461,17 +462,14 @@ ce_page_security_class_init (CEPageSecurityClass *class)
|
|||
}
|
||||
|
||||
CEPage *
|
||||
ce_page_security_new (NMConnection *connection,
|
||||
NMClient *client)
|
||||
ce_page_security_new (NMConnection *connection)
|
||||
{
|
||||
CEPageSecurity *self;
|
||||
NMUtilsSecurityType default_type = NMU_SEC_NONE;
|
||||
NMSettingWirelessSecurity *sws;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_SECURITY (g_object_new (ce_page_security_get_type (),
|
||||
"connection", connection,
|
||||
NULL));
|
||||
self = CE_PAGE_SECURITY (g_object_new (ce_page_security_get_type (), NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/security-page.ui", &error)) {
|
||||
|
@ -484,6 +482,8 @@ ce_page_security_new (NMConnection *connection,
|
|||
self->security_label = GTK_LABEL (gtk_builder_get_object (self->builder, "security_label"));
|
||||
self->security_combo = GTK_COMBO_BOX (gtk_builder_get_object (self->builder, "security_combo"));
|
||||
|
||||
self->connection = g_object_ref (connection);
|
||||
|
||||
sws = nm_connection_get_setting_wireless_security (connection);
|
||||
if (sws)
|
||||
default_type = get_default_type_for_security (sws);
|
||||
|
|
|
@ -29,7 +29,6 @@ G_BEGIN_DECLS
|
|||
|
||||
G_DECLARE_FINAL_TYPE (CEPageSecurity, ce_page_security, CE, PAGE_SECURITY, CEPage)
|
||||
|
||||
CEPage *ce_page_security_new (NMConnection *connection,
|
||||
NMClient *client);
|
||||
CEPage *ce_page_security_new (NMConnection *connection);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -38,6 +38,7 @@ struct _CEPageVpn
|
|||
GtkLabel *failure_label;
|
||||
GtkEntry *name_entry;
|
||||
|
||||
NMConnection *connection;
|
||||
NMSettingConnection *setting_connection;
|
||||
NMSettingVpn *setting_vpn;
|
||||
|
||||
|
@ -89,12 +90,12 @@ vpn_gnome3ify_editor (GtkWidget *widget)
|
|||
}
|
||||
|
||||
static void
|
||||
load_vpn_plugin (CEPageVpn *self, NMConnection *connection)
|
||||
load_vpn_plugin (CEPageVpn *self)
|
||||
{
|
||||
GtkWidget *ui_widget;
|
||||
|
||||
self->editor = nm_vpn_editor_plugin_get_editor (self->plugin,
|
||||
connection,
|
||||
self->connection,
|
||||
NULL);
|
||||
ui_widget = NULL;
|
||||
if (self->editor)
|
||||
|
@ -131,6 +132,7 @@ ce_page_vpn_dispose (GObject *object)
|
|||
CEPageVpn *self = CE_PAGE_VPN (object);
|
||||
|
||||
g_clear_object (&self->builder);
|
||||
g_clear_object (&self->connection);
|
||||
g_clear_object (&self->editor);
|
||||
|
||||
G_OBJECT_CLASS (ce_page_vpn_parent_class)->dispose (object);
|
||||
|
@ -196,30 +198,26 @@ ce_page_vpn_class_init (CEPageVpnClass *class)
|
|||
static void
|
||||
finish_setup (CEPageVpn *self, gpointer unused, GError *error, gpointer user_data)
|
||||
{
|
||||
NMConnection *connection = CE_PAGE (self)->connection;
|
||||
const char *vpn_type;
|
||||
|
||||
self->setting_connection = nm_connection_get_setting_connection (connection);
|
||||
self->setting_vpn = nm_connection_get_setting_vpn (connection);
|
||||
self->setting_connection = nm_connection_get_setting_connection (self->connection);
|
||||
self->setting_vpn = nm_connection_get_setting_vpn (self->connection);
|
||||
vpn_type = nm_setting_vpn_get_service_type (self->setting_vpn);
|
||||
|
||||
self->plugin = vpn_get_plugin_by_service (vpn_type);
|
||||
if (self->plugin)
|
||||
load_vpn_plugin (self, connection);
|
||||
load_vpn_plugin (self);
|
||||
|
||||
connect_vpn_page (self);
|
||||
}
|
||||
|
||||
CEPage *
|
||||
ce_page_vpn_new (NMConnection *connection,
|
||||
NMClient *client)
|
||||
ce_page_vpn_new (NMConnection *connection)
|
||||
{
|
||||
CEPageVpn *self;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_VPN (g_object_new (ce_page_vpn_get_type (),
|
||||
"connection", connection,
|
||||
NULL));
|
||||
self = CE_PAGE_VPN (g_object_new (ce_page_vpn_get_type (), NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/vpn-page.ui", &error)) {
|
||||
|
@ -231,6 +229,8 @@ ce_page_vpn_new (NMConnection *connection,
|
|||
self->failure_label = GTK_LABEL (gtk_builder_get_object (self->builder, "failure_label"));
|
||||
self->name_entry = GTK_ENTRY (gtk_builder_get_object (self->builder, "name_entry"));
|
||||
|
||||
self->connection = g_object_ref (connection);
|
||||
|
||||
g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
|
||||
|
||||
return CE_PAGE (self);
|
||||
|
|
|
@ -29,7 +29,6 @@ G_BEGIN_DECLS
|
|||
|
||||
G_DECLARE_FINAL_TYPE (CEPageVpn, ce_page_vpn, CE, PAGE_VPN, CEPage)
|
||||
|
||||
CEPage *ce_page_vpn_new (NMConnection *connection,
|
||||
NMClient *client);
|
||||
CEPage *ce_page_vpn_new (NMConnection *connection);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -211,9 +211,7 @@ ce_page_wifi_new (NMConnection *connection,
|
|||
CEPageWifi *self;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
self = CE_PAGE_WIFI (g_object_new (ce_page_wifi_get_type (),
|
||||
"connection", connection,
|
||||
NULL));
|
||||
self = CE_PAGE_WIFI (g_object_new (ce_page_wifi_get_type (), NULL));
|
||||
|
||||
self->builder = gtk_builder_new ();
|
||||
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/control-center/network/wifi-page.ui", &error)) {
|
||||
|
|
|
@ -35,12 +35,6 @@
|
|||
|
||||
G_DEFINE_ABSTRACT_TYPE (CEPage, ce_page, G_TYPE_OBJECT)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_CONNECTION,
|
||||
PROP_INITIALIZED,
|
||||
};
|
||||
|
||||
enum {
|
||||
CHANGED,
|
||||
INITIALIZED,
|
||||
|
@ -61,16 +55,6 @@ ce_page_validate (CEPage *self, NMConnection *connection, GError **error)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
CEPage *self = CE_PAGE (object);
|
||||
|
||||
g_clear_object (&self->connection);
|
||||
|
||||
G_OBJECT_CLASS (ce_page_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
ce_page_get_widget (CEPage *self)
|
||||
{
|
||||
|
@ -103,46 +87,6 @@ ce_page_changed (CEPage *self)
|
|||
g_signal_emit (self, signals[CHANGED], 0);
|
||||
}
|
||||
|
||||
static void
|
||||
get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
CEPage *self = CE_PAGE (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_CONNECTION:
|
||||
g_value_set_object (value, self->connection);
|
||||
break;
|
||||
case PROP_INITIALIZED:
|
||||
g_value_set_boolean (value, self->initialized);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
CEPage *self = CE_PAGE (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_CONNECTION:
|
||||
g_clear_object (&self->connection);
|
||||
self->connection = g_value_dup_object (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ce_page_init (CEPage *self)
|
||||
{
|
||||
|
@ -153,28 +97,6 @@ ce_page_class_init (CEPageClass *page_class)
|
|||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (page_class);
|
||||
|
||||
/* virtual methods */
|
||||
object_class->dispose = dispose;
|
||||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
|
||||
/* Properties */
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_CONNECTION,
|
||||
g_param_spec_object ("connection",
|
||||
"Connection",
|
||||
"Connection",
|
||||
NM_TYPE_CONNECTION,
|
||||
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_INITIALIZED,
|
||||
g_param_spec_boolean ("initialized",
|
||||
"Initialized",
|
||||
"Initialized",
|
||||
FALSE,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
signals[CHANGED] =
|
||||
g_signal_new ("changed",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
|
@ -205,6 +127,7 @@ emit_initialized (CEPage *self,
|
|||
|
||||
void
|
||||
ce_page_complete_init (CEPage *self,
|
||||
NMConnection *connection,
|
||||
const gchar *setting_name,
|
||||
GVariant *secrets,
|
||||
GError *error)
|
||||
|
@ -242,7 +165,7 @@ ce_page_complete_init (CEPage *self,
|
|||
}
|
||||
|
||||
/* Update the connection with the new secrets */
|
||||
if (!nm_connection_update_secrets (self->connection,
|
||||
if (!nm_connection_update_secrets (connection,
|
||||
setting_name,
|
||||
secrets,
|
||||
&update_error))
|
||||
|
|
|
@ -45,7 +45,6 @@ struct _CEPage
|
|||
GObject parent;
|
||||
|
||||
gboolean initialized;
|
||||
NMConnection *connection;
|
||||
};
|
||||
|
||||
struct _CEPageClass
|
||||
|
@ -69,6 +68,7 @@ gboolean ce_page_validate (CEPage *page,
|
|||
gboolean ce_page_get_initialized (CEPage *page);
|
||||
void ce_page_changed (CEPage *page);
|
||||
void ce_page_complete_init (CEPage *page,
|
||||
NMConnection *connection,
|
||||
const gchar *setting_name,
|
||||
GVariant *variant,
|
||||
GError *error);
|
||||
|
|
|
@ -463,7 +463,7 @@ get_secrets_cb (GObject *source_object,
|
|||
if (!variant && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
return;
|
||||
|
||||
ce_page_complete_init (info->page, info->setting_name, variant, g_steal_pointer (&error));
|
||||
ce_page_complete_init (info->page, info->editor->connection, info->setting_name, variant, g_steal_pointer (&error));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -533,14 +533,14 @@ net_connection_editor_set_connection (NetConnectionEditor *self,
|
|||
is_vpn = g_str_equal (type, NM_SETTING_VPN_SETTING_NAME);
|
||||
|
||||
if (!self->is_new_connection)
|
||||
add_page (self, ce_page_details_new (self->connection, self->client, self->device, self->ap, self));
|
||||
add_page (self, ce_page_details_new (self->connection, self->device, self->ap, self));
|
||||
|
||||
if (is_wifi)
|
||||
add_page (self, ce_page_wifi_new (self->connection, self->client));
|
||||
else if (is_wired)
|
||||
add_page (self, ce_page_ethernet_new (self->connection, self->client));
|
||||
else if (is_vpn)
|
||||
add_page (self, ce_page_vpn_new (self->connection, self->client));
|
||||
add_page (self, ce_page_vpn_new (self->connection));
|
||||
else {
|
||||
/* Unsupported type */
|
||||
net_connection_editor_do_fallback (self, type);
|
||||
|
@ -551,9 +551,9 @@ net_connection_editor_set_connection (NetConnectionEditor *self,
|
|||
add_page (self, ce_page_ip6_new (self->connection, self->client));
|
||||
|
||||
if (is_wifi)
|
||||
add_page (self, ce_page_security_new (self->connection, self->client));
|
||||
add_page (self, ce_page_security_new (self->connection));
|
||||
else if (is_wired)
|
||||
add_page (self, ce_page_8021x_security_new (self->connection, self->client));
|
||||
add_page (self, ce_page_8021x_security_new (self->connection));
|
||||
|
||||
pages = g_slist_copy (self->initializing_pages);
|
||||
for (l = pages; l; l = l->next) {
|
||||
|
@ -562,7 +562,7 @@ net_connection_editor_set_connection (NetConnectionEditor *self,
|
|||
|
||||
security_setting = ce_page_get_security_setting (page);
|
||||
if (!security_setting || self->is_new_connection) {
|
||||
ce_page_complete_init (page, NULL, NULL, NULL);
|
||||
ce_page_complete_init (page, NULL, NULL, NULL, NULL);
|
||||
} else {
|
||||
get_secrets_for_page (self, page, security_setting);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue