[gnome-control-center] network: Convert WirelessSecurity 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 WirelessSecurity property to a virtual method
- Date: Wed, 27 Nov 2019 22:11:19 +0000 (UTC)
commit e5ae62a6a303fad49aeb385b556bbb943ee2c2cc
Author: Robert Ancell <robert ancell canonical com>
Date: Thu Nov 7 13:58:30 2019 +1300
network: Convert WirelessSecurity property to a virtual method
.../network/wireless-security/wireless-security.c | 24 ++++------------------
.../network/wireless-security/wireless-security.h | 4 +---
panels/network/wireless-security/ws-dynamic-wep.c | 9 ++++++--
panels/network/wireless-security/ws-leap.c | 9 ++++++--
panels/network/wireless-security/ws-wpa-eap.c | 9 ++++++--
panels/network/wireless-security/ws-wpa-psk.c | 9 ++++++--
6 files changed, 33 insertions(+), 31 deletions(-)
---
diff --git a/panels/network/wireless-security/wireless-security.c
b/panels/network/wireless-security/wireless-security.c
index 0fff7e218..fed7e2025 100644
--- a/panels/network/wireless-security/wireless-security.c
+++ b/panels/network/wireless-security/wireless-security.c
@@ -36,7 +36,6 @@
#include "utils.h"
typedef struct {
- gboolean adhoc_compatible;
char *username, *password;
gboolean always_ask, show_password;
} WirelessSecurityPrivate;
@@ -68,11 +67,7 @@ wireless_security_dispose (GObject *object)
void
wireless_security_init (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = wireless_security_get_instance_private (self);
-
g_resources_register (wireless_security_get_resource ());
-
- priv->adhoc_compatible = TRUE;
}
void
@@ -141,24 +136,13 @@ wireless_security_fill_connection (WirelessSecurity *self,
return WIRELESS_SECURITY_GET_CLASS (self)->fill_connection (self, connection);
}
-void
-wireless_security_set_adhoc_compatible (WirelessSecurity *self, gboolean adhoc_compatible)
-{
- WirelessSecurityPrivate *priv = wireless_security_get_instance_private (self);
-
- g_return_if_fail (WIRELESS_IS_SECURITY (self));
-
- priv->adhoc_compatible = adhoc_compatible;
-}
-
gboolean
wireless_security_adhoc_compatible (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = wireless_security_get_instance_private (self);
-
- g_return_val_if_fail (WIRELESS_IS_SECURITY (self), FALSE);
-
- return priv->adhoc_compatible;
+ if (WIRELESS_SECURITY_GET_CLASS (self)->adhoc_compatible)
+ return WIRELESS_SECURITY_GET_CLASS (self)->adhoc_compatible (self);
+ else
+ return TRUE;
}
const gchar *
diff --git a/panels/network/wireless-security/wireless-security.h
b/panels/network/wireless-security/wireless-security.h
index 6604954ea..fbe0fd4d2 100644
--- a/panels/network/wireless-security/wireless-security.h
+++ b/panels/network/wireless-security/wireless-security.h
@@ -34,6 +34,7 @@ struct _WirelessSecurityClass {
void (*add_to_size_group) (WirelessSecurity *sec, GtkSizeGroup *group);
void (*fill_connection) (WirelessSecurity *sec, NMConnection *connection);
gboolean (*validate) (WirelessSecurity *sec, GError **error);
+ gboolean (*adhoc_compatible) (WirelessSecurity *sec);
GtkWidget* (*get_widget) (WirelessSecurity *sec);
};
@@ -47,9 +48,6 @@ void wireless_security_add_to_size_group (WirelessSecurity *sec,
void wireless_security_fill_connection (WirelessSecurity *sec,
NMConnection *connection);
-void wireless_security_set_adhoc_compatible (WirelessSecurity *sec,
- gboolean adhoc_compatible);
-
gboolean wireless_security_adhoc_compatible (WirelessSecurity *sec);
const gchar *wireless_security_get_username (WirelessSecurity *sec);
diff --git a/panels/network/wireless-security/ws-dynamic-wep.c
b/panels/network/wireless-security/ws-dynamic-wep.c
index 46e1dabcb..ae3d1b3fa 100644
--- a/panels/network/wireless-security/ws-dynamic-wep.c
+++ b/panels/network/wireless-security/ws-dynamic-wep.c
@@ -94,6 +94,12 @@ fill_connection (WirelessSecurity *security, NMConnection *connection)
g_object_set (s_wireless_sec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "ieee8021x", NULL);
}
+static gboolean
+adhoc_compatible (WirelessSecurity *security)
+{
+ return FALSE;
+}
+
static void
auth_combo_changed_cb (WirelessSecurityDynamicWEP *self)
{
@@ -120,6 +126,7 @@ ws_dynamic_wep_class_init (WirelessSecurityDynamicWEPClass *klass)
ws_class->validate = validate;
ws_class->add_to_size_group = add_to_size_group;
ws_class->fill_connection = fill_connection;
+ ws_class->adhoc_compatible = adhoc_compatible;
}
WirelessSecurityDynamicWEP *
@@ -143,8 +150,6 @@ ws_dynamic_wep_new (NMConnection *connection,
self->grid = GTK_GRID (gtk_builder_get_object (self->builder, "grid"));
self->method_box = GTK_BOX (gtk_builder_get_object (self->builder, "method_box"));
- wireless_security_set_adhoc_compatible (WIRELESS_SECURITY (self), FALSE);
-
ws_802_1x_auth_combo_init (WIRELESS_SECURITY (self),
self->auth_combo,
connection,
diff --git a/panels/network/wireless-security/ws-leap.c b/panels/network/wireless-security/ws-leap.c
index 11cc34cc0..f8e148b73 100644
--- a/panels/network/wireless-security/ws-leap.c
+++ b/panels/network/wireless-security/ws-leap.c
@@ -142,6 +142,12 @@ fill_connection (WirelessSecurity *security, NMConnection *connection)
NM_SETTING (s_wireless_sec), self->password_flags_name);
}
+static gboolean
+adhoc_compatible (WirelessSecurity *security)
+{
+ return FALSE;
+}
+
static void
changed_cb (WirelessSecurityLEAP *self)
{
@@ -164,6 +170,7 @@ ws_leap_class_init (WirelessSecurityLEAPClass *klass)
ws_class->validate = validate;
ws_class->add_to_size_group = add_to_size_group;
ws_class->fill_connection = fill_connection;
+ ws_class->adhoc_compatible = adhoc_compatible;
}
WirelessSecurityLEAP *
@@ -187,8 +194,6 @@ ws_leap_new (NMConnection *connection, gboolean secrets_only)
}
}
- wireless_security_set_adhoc_compatible (WIRELESS_SECURITY (self), FALSE);
-
self->editing_connection = secrets_only ? FALSE : TRUE;
self->password_flags_name = NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD;
diff --git a/panels/network/wireless-security/ws-wpa-eap.c b/panels/network/wireless-security/ws-wpa-eap.c
index 943b72e9c..868235393 100644
--- a/panels/network/wireless-security/ws-wpa-eap.c
+++ b/panels/network/wireless-security/ws-wpa-eap.c
@@ -94,6 +94,12 @@ fill_connection (WirelessSecurity *security, NMConnection *connection)
g_object_set (s_wireless_sec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-eap", NULL);
}
+static gboolean
+adhoc_compatible (WirelessSecurity *security)
+{
+ return FALSE;
+}
+
static void
auth_combo_changed_cb (WirelessSecurityWPAEAP *self)
{
@@ -120,6 +126,7 @@ ws_wpa_eap_class_init (WirelessSecurityWPAEAPClass *klass)
ws_class->validate = validate;
ws_class->add_to_size_group = add_to_size_group;
ws_class->fill_connection = fill_connection;
+ ws_class->adhoc_compatible = adhoc_compatible;
}
WirelessSecurityWPAEAP *
@@ -143,8 +150,6 @@ ws_wpa_eap_new (NMConnection *connection,
self->grid = GTK_GRID (gtk_builder_get_object (self->builder, "grid"));
self->method_box = GTK_BOX (gtk_builder_get_object (self->builder, "method_box"));
- wireless_security_set_adhoc_compatible (WIRELESS_SECURITY (self), FALSE);
-
ws_802_1x_auth_combo_init (WIRELESS_SECURITY (self),
self->auth_combo,
connection,
diff --git a/panels/network/wireless-security/ws-wpa-psk.c b/panels/network/wireless-security/ws-wpa-psk.c
index 000d90038..3081ba7aa 100644
--- a/panels/network/wireless-security/ws-wpa-psk.c
+++ b/panels/network/wireless-security/ws-wpa-psk.c
@@ -172,6 +172,12 @@ fill_connection (WirelessSecurity *security, NMConnection *connection)
}
}
+static gboolean
+adhoc_compatible (WirelessSecurity *security)
+{
+ return FALSE;
+}
+
static void
changed_cb (WirelessSecurityWPAPSK *self)
{
@@ -194,6 +200,7 @@ ws_wpa_psk_class_init (WirelessSecurityWPAPSKClass *klass)
ws_class->validate = validate;
ws_class->add_to_size_group = add_to_size_group;
ws_class->fill_connection = fill_connection;
+ ws_class->adhoc_compatible = adhoc_compatible;
}
WirelessSecurityWPAPSK *
@@ -218,8 +225,6 @@ ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only)
self->type_combo = GTK_COMBO_BOX (gtk_builder_get_object (self->builder, "type_combo"));
self->type_label = GTK_LABEL (gtk_builder_get_object (self->builder, "type_label"));
- wireless_security_set_adhoc_compatible (WIRELESS_SECURITY (self), FALSE);
-
self->editing_connection = secrets_only ? FALSE : TRUE;
self->password_flags_name = NM_SETTING_WIRELESS_SECURITY_PSK;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]