network: Convert class property to a virtual method
This commit is contained in:
parent
4178b9404b
commit
3a86e6f162
5 changed files with 36 additions and 11 deletions
|
@ -115,12 +115,20 @@ ce_page_8021x_security_new (NMConnection *connection,
|
||||||
|
|
||||||
g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
|
g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
|
||||||
|
|
||||||
if (self->initial_have_8021x)
|
|
||||||
CE_PAGE (self)->security_setting = NM_SETTING_802_1X_SETTING_NAME;
|
|
||||||
|
|
||||||
return CE_PAGE (self);
|
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)
|
||||||
|
return NM_SETTING_802_1X_SETTING_NAME;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static const gchar *
|
static const gchar *
|
||||||
ce_page_8021x_security_get_title (CEPage *page)
|
ce_page_8021x_security_get_title (CEPage *page)
|
||||||
{
|
{
|
||||||
|
@ -194,6 +202,7 @@ ce_page_8021x_security_class_init (CEPage8021xSecurityClass *security_class)
|
||||||
/* virtual methods */
|
/* virtual methods */
|
||||||
object_class->dispose = dispose;
|
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->get_title = ce_page_8021x_security_get_title;
|
||||||
parent_class->validate = ce_page_8021x_security_validate;
|
parent_class->validate = ce_page_8021x_security_validate;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ struct _CEPageSecurity
|
||||||
GtkComboBox *security_combo;
|
GtkComboBox *security_combo;
|
||||||
GtkLabel *security_label;
|
GtkLabel *security_label;
|
||||||
|
|
||||||
|
const gchar *security_setting;
|
||||||
GtkSizeGroup *group;
|
GtkSizeGroup *group;
|
||||||
gboolean adhoc;
|
gboolean adhoc;
|
||||||
};
|
};
|
||||||
|
@ -373,6 +374,12 @@ ce_page_security_dispose (GObject *object)
|
||||||
G_OBJECT_CLASS (ce_page_security_parent_class)->dispose (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 *
|
static const gchar *
|
||||||
ce_page_security_get_title (CEPage *page)
|
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);
|
CEPageClass *page_class = CE_PAGE_CLASS (class);
|
||||||
|
|
||||||
object_class->dispose = ce_page_security_dispose;
|
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->get_title = ce_page_security_get_title;
|
||||||
page_class->validate = ce_page_security_validate;
|
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_LEAP ||
|
||||||
default_type == NMU_SEC_WPA_PSK ||
|
default_type == NMU_SEC_WPA_PSK ||
|
||||||
default_type == NMU_SEC_WPA2_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 ||
|
if (default_type == NMU_SEC_DYNAMIC_WEP ||
|
||||||
default_type == NMU_SEC_WPA_ENTERPRISE ||
|
default_type == NMU_SEC_WPA_ENTERPRISE ||
|
||||||
default_type == NMU_SEC_WPA2_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);
|
g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
|
||||||
|
|
|
@ -134,6 +134,12 @@ ce_page_vpn_dispose (GObject *object)
|
||||||
G_OBJECT_CLASS (ce_page_vpn_parent_class)->dispose (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 *
|
static const gchar *
|
||||||
ce_page_vpn_get_title (CEPage *page)
|
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);
|
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||||
|
|
||||||
object_class->dispose = ce_page_vpn_dispose;
|
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->get_title = ce_page_vpn_get_title;
|
||||||
page_class->validate = ce_page_vpn_validate;
|
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);
|
g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
|
||||||
|
|
||||||
CE_PAGE (self)->security_setting = NM_SETTING_VPN_SETTING_NAME;
|
|
||||||
|
|
||||||
return CE_PAGE (self);
|
return CE_PAGE (self);
|
||||||
}
|
}
|
||||||
|
|
|
@ -477,7 +477,10 @@ ce_page_cloned_mac_combo_valid (GtkComboBoxText *combo)
|
||||||
const gchar *
|
const gchar *
|
||||||
ce_page_get_security_setting (CEPage *self)
|
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
|
gint
|
||||||
|
|
|
@ -47,7 +47,6 @@ struct _CEPage
|
||||||
gboolean initialized;
|
gboolean initialized;
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
GtkWidget *page;
|
GtkWidget *page;
|
||||||
const gchar *security_setting;
|
|
||||||
|
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
NMClient *client;
|
NMClient *client;
|
||||||
|
@ -58,8 +57,9 @@ struct _CEPageClass
|
||||||
{
|
{
|
||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
|
|
||||||
gboolean (*validate) (CEPage *page, NMConnection *connection, GError **error);
|
gboolean (*validate) (CEPage *page, NMConnection *connection, GError **error);
|
||||||
const gchar *(*get_title) (CEPage *page);
|
const gchar *(*get_title) (CEPage *page);
|
||||||
|
const gchar *(*get_security_setting) (CEPage *page);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType ce_page_get_type (void);
|
GType ce_page_get_type (void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue