[gnome-control-center] network: Convert class property to a virtual method
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Convert class property to a virtual method
- Date: Wed, 6 Nov 2019 12:37:39 +0000 (UTC)
commit 3a86e6f162540959641318c4e1597bf53d67e1b4
Author: Robert Ancell <robert ancell canonical com>
Date: Wed Nov 6 14:12:53 2019 +1300
network: Convert class property to a virtual method
panels/network/connection-editor/ce-page-8021x-security.c | 13 +++++++++++--
panels/network/connection-editor/ce-page-security.c | 12 ++++++++++--
panels/network/connection-editor/ce-page-vpn.c | 9 +++++++--
panels/network/connection-editor/ce-page.c | 5 ++++-
panels/network/connection-editor/ce-page.h | 6 +++---
5 files changed, 35 insertions(+), 10 deletions(-)
---
diff --git a/panels/network/connection-editor/ce-page-8021x-security.c
b/panels/network/connection-editor/ce-page-8021x-security.c
index 4b3242dc9..bba071a12 100644
--- a/panels/network/connection-editor/ce-page-8021x-security.c
+++ b/panels/network/connection-editor/ce-page-8021x-security.c
@@ -115,10 +115,18 @@ ce_page_8021x_security_new (NMConnection *connection,
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)
+{
+ CEPage8021xSecurity *self = CE_PAGE_8021X_SECURITY (page);
+
if (self->initial_have_8021x)
- CE_PAGE (self)->security_setting = NM_SETTING_802_1X_SETTING_NAME;
+ return NM_SETTING_802_1X_SETTING_NAME;
- return CE_PAGE (self);
+ return NULL;
}
static const gchar *
@@ -194,6 +202,7 @@ ce_page_8021x_security_class_init (CEPage8021xSecurityClass *security_class)
/* virtual methods */
object_class->dispose = dispose;
+ parent_class->get_security_setting = ce_page_8021x_security_get_security_setting;
parent_class->get_title = ce_page_8021x_security_get_title;
parent_class->validate = ce_page_8021x_security_validate;
}
diff --git a/panels/network/connection-editor/ce-page-security.c
b/panels/network/connection-editor/ce-page-security.c
index e15179d64..1cb86ef5d 100644
--- a/panels/network/connection-editor/ce-page-security.c
+++ b/panels/network/connection-editor/ce-page-security.c
@@ -42,6 +42,7 @@ struct _CEPageSecurity
GtkComboBox *security_combo;
GtkLabel *security_label;
+ const gchar *security_setting;
GtkSizeGroup *group;
gboolean adhoc;
};
@@ -373,6 +374,12 @@ ce_page_security_dispose (GObject *object)
G_OBJECT_CLASS (ce_page_security_parent_class)->dispose (object);
}
+static const gchar *
+ce_page_security_get_security_setting (CEPage *page)
+{
+ return CE_PAGE_SECURITY (page)->security_setting;
+}
+
static const gchar *
ce_page_security_get_title (CEPage *page)
{
@@ -441,6 +448,7 @@ ce_page_security_class_init (CEPageSecurityClass *class)
CEPageClass *page_class = CE_PAGE_CLASS (class);
object_class->dispose = ce_page_security_dispose;
+ page_class->get_security_setting = ce_page_security_get_security_setting;
page_class->get_title = ce_page_security_get_title;
page_class->validate = ce_page_security_validate;
}
@@ -466,13 +474,13 @@ ce_page_security_new (NMConnection *connection,
default_type == NMU_SEC_LEAP ||
default_type == NMU_SEC_WPA_PSK ||
default_type == NMU_SEC_WPA2_PSK) {
- CE_PAGE (self)->security_setting = NM_SETTING_WIRELESS_SECURITY_SETTING_NAME;
+ self->security_setting = NM_SETTING_WIRELESS_SECURITY_SETTING_NAME;
}
if (default_type == NMU_SEC_DYNAMIC_WEP ||
default_type == NMU_SEC_WPA_ENTERPRISE ||
default_type == NMU_SEC_WPA2_ENTERPRISE) {
- CE_PAGE (self)->security_setting = NM_SETTING_802_1X_SETTING_NAME;
+ self->security_setting = NM_SETTING_802_1X_SETTING_NAME;
}
g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
diff --git a/panels/network/connection-editor/ce-page-vpn.c b/panels/network/connection-editor/ce-page-vpn.c
index 42cdcdd73..4da6c6b76 100644
--- a/panels/network/connection-editor/ce-page-vpn.c
+++ b/panels/network/connection-editor/ce-page-vpn.c
@@ -134,6 +134,12 @@ ce_page_vpn_dispose (GObject *object)
G_OBJECT_CLASS (ce_page_vpn_parent_class)->dispose (object);
}
+static const gchar *
+ce_page_vpn_get_security_setting (CEPage *page)
+{
+ return NM_SETTING_VPN_SETTING_NAME;
+}
+
static const gchar *
ce_page_vpn_get_title (CEPage *page)
{
@@ -172,6 +178,7 @@ ce_page_vpn_class_init (CEPageVpnClass *class)
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->dispose = ce_page_vpn_dispose;
+ page_class->get_security_setting = ce_page_vpn_get_security_setting;
page_class->get_title = ce_page_vpn_get_title;
page_class->validate = ce_page_vpn_validate;
}
@@ -210,7 +217,5 @@ ce_page_vpn_new (NMConnection *connection,
g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
- CE_PAGE (self)->security_setting = NM_SETTING_VPN_SETTING_NAME;
-
return CE_PAGE (self);
}
diff --git a/panels/network/connection-editor/ce-page.c b/panels/network/connection-editor/ce-page.c
index def842754..0d994b281 100644
--- a/panels/network/connection-editor/ce-page.c
+++ b/panels/network/connection-editor/ce-page.c
@@ -477,7 +477,10 @@ ce_page_cloned_mac_combo_valid (GtkComboBoxText *combo)
const gchar *
ce_page_get_security_setting (CEPage *self)
{
- return self->security_setting;
+ if (CE_PAGE_GET_CLASS (self)->get_security_setting)
+ return CE_PAGE_GET_CLASS (self)->get_security_setting (self);
+
+ return NULL;
}
gint
diff --git a/panels/network/connection-editor/ce-page.h b/panels/network/connection-editor/ce-page.h
index 3e36affa9..71bb29318 100644
--- a/panels/network/connection-editor/ce-page.h
+++ b/panels/network/connection-editor/ce-page.h
@@ -47,7 +47,6 @@ struct _CEPage
gboolean initialized;
GtkBuilder *builder;
GtkWidget *page;
- const gchar *security_setting;
NMConnection *connection;
NMClient *client;
@@ -58,8 +57,9 @@ struct _CEPageClass
{
GObjectClass parent_class;
- gboolean (*validate) (CEPage *page, NMConnection *connection, GError **error);
- const gchar *(*get_title) (CEPage *page);
+ gboolean (*validate) (CEPage *page, NMConnection *connection, GError **error);
+ const gchar *(*get_title) (CEPage *page);
+ const gchar *(*get_security_setting) (CEPage *page);
};
GType ce_page_get_type (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]