summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2019-11-07 12:37:34 +1300
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2019-11-27 22:05:46 +0000
commit3d06da2d30dceb6d3126a5d931aac96a21e64925 (patch)
tree0c6e811ddb653853bea36e3b8c6a824195ad9694
parent4b182dd7c01db421532fbd70d4aa808f7f653231 (diff)
downloadgnome-control-center-3d06da2d30dceb6d3126a5d931aac96a21e64925.tar.gz
network: Convert WirelessSecurity into a GObject
-rw-r--r--panels/network/connection-editor/ce-page-8021x-security.c2
-rw-r--r--panels/network/connection-editor/ce-page-security.c4
-rw-r--r--panels/network/wireless-security/wireless-security.c178
-rw-r--r--panels/network/wireless-security/wireless-security.h41
-rw-r--r--panels/network/wireless-security/ws-dynamic-wep.c57
-rw-r--r--panels/network/wireless-security/ws-dynamic-wep.h13
-rw-r--r--panels/network/wireless-security/ws-leap.c69
-rw-r--r--panels/network/wireless-security/ws-leap.h13
-rw-r--r--panels/network/wireless-security/ws-wep-key.c58
-rw-r--r--panels/network/wireless-security/ws-wep-key.h13
-rw-r--r--panels/network/wireless-security/ws-wpa-eap.c57
-rw-r--r--panels/network/wireless-security/ws-wpa-eap.h13
-rw-r--r--panels/network/wireless-security/ws-wpa-psk.c71
-rw-r--r--panels/network/wireless-security/ws-wpa-psk.h13
14 files changed, 295 insertions, 307 deletions
diff --git a/panels/network/connection-editor/ce-page-8021x-security.c b/panels/network/connection-editor/ce-page-8021x-security.c
index a1ec4eca8..19f8ef3c5 100644
--- a/panels/network/connection-editor/ce-page-8021x-security.c
+++ b/panels/network/connection-editor/ce-page-8021x-security.c
@@ -164,7 +164,7 @@ ce_page_8021x_security_dispose (GObject *object)
CEPage8021xSecurity *self = CE_PAGE_8021X_SECURITY (object);
g_clear_object (&self->connection);
- g_clear_pointer ((WirelessSecurity**) &self->security, wireless_security_unref);
+ g_clear_object (&self->security);
g_clear_object (&self->group);
G_OBJECT_CLASS (ce_page_8021x_security_parent_class)->dispose (object);
diff --git a/panels/network/connection-editor/ce-page-security.c b/panels/network/connection-editor/ce-page-security.c
index f716d7ef4..23cfd3276 100644
--- a/panels/network/connection-editor/ce-page-security.c
+++ b/panels/network/connection-editor/ce-page-security.c
@@ -194,7 +194,7 @@ add_security_item (CEPageSecurity *self,
S_SEC_COLUMN, sec,
S_ADHOC_VALID_COLUMN, adhoc_valid,
-1);
- wireless_security_unref (sec);
+ g_object_unref (sec);
}
static void
@@ -250,7 +250,7 @@ finish_setup (CEPageSecurity *self)
if (sws)
default_type = get_default_type_for_security (sws);
- sec_model = gtk_list_store_new (3, G_TYPE_STRING, WIRELESS_TYPE_SECURITY, G_TYPE_BOOLEAN);
+ sec_model = gtk_list_store_new (3, G_TYPE_STRING, wireless_security_get_type (), G_TYPE_BOOLEAN);
if (nm_utils_security_valid (NMU_SEC_NONE, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
gtk_list_store_insert_with_values (sec_model, &iter, -1,
diff --git a/panels/network/wireless-security/wireless-security.c b/panels/network/wireless-security/wireless-security.c
index 1ad68d73c..dbc9d346f 100644
--- a/panels/network/wireless-security/wireless-security.c
+++ b/panels/network/wireless-security/wireless-security.c
@@ -35,47 +35,56 @@
#include "eap-method-ttls.h"
#include "utils.h"
-struct _WirelessSecurityPrivate {
- guint32 refcount;
- gsize obj_size;
+typedef struct {
WSChangedFunc changed_notify;
gpointer changed_notify_data;
gboolean adhoc_compatible;
char *username, *password;
gboolean always_ask, show_password;
+} WirelessSecurityPrivate;
- WSAddToSizeGroupFunc add_to_size_group;
- WSFillConnectionFunc fill_connection;
- WSGetWidgetFunc get_widget;
- WSValidateFunc validate;
- WSDestroyFunc destroy;
-};
+G_DEFINE_TYPE_WITH_PRIVATE (WirelessSecurity, wireless_security, G_TYPE_OBJECT)
-GType
-wireless_security_get_type (void)
+static void
+wireless_security_dispose (GObject *object)
{
- static GType type_id = 0;
+ WirelessSecurity *self = WIRELESS_SECURITY (object);
+ WirelessSecurityPrivate *priv = wireless_security_get_instance_private (self);
- if (!type_id) {
- g_resources_register (wireless_security_get_resource ());
+ if (priv->password)
+ memset (priv->password, 0, strlen (priv->password));
- type_id = g_boxed_type_register_static ("CcWirelessSecurity",
- (GBoxedCopyFunc) wireless_security_ref,
- (GBoxedFreeFunc) wireless_security_unref);
- }
+ g_clear_pointer (&priv->username, g_free);
+ g_clear_pointer (&priv->password, g_free);
+
+ G_OBJECT_CLASS (wireless_security_parent_class)->dispose (object);
+}
+
+void
+wireless_security_init (WirelessSecurity *self)
+{
+ WirelessSecurityPrivate *priv = wireless_security_get_instance_private (self);
+
+ g_resources_register (wireless_security_get_resource ());
- return type_id;
+ priv->adhoc_compatible = TRUE;
+}
+
+void
+wireless_security_class_init (WirelessSecurityClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->dispose = wireless_security_dispose;
}
GtkWidget *
wireless_security_get_widget (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = self->priv;
- g_return_val_if_fail (self != NULL, NULL);
+ g_return_val_if_fail (WIRELESS_IS_SECURITY (self), NULL);
- g_assert (priv->get_widget);
- return (*(priv->get_widget)) (self);
+ return WIRELESS_SECURITY_GET_CLASS (self)->get_widget (self);
}
void
@@ -83,8 +92,9 @@ wireless_security_set_changed_notify (WirelessSecurity *self,
WSChangedFunc func,
gpointer user_data)
{
- WirelessSecurityPrivate *priv = self->priv;
- g_return_if_fail (self != NULL);
+ WirelessSecurityPrivate *priv = wireless_security_get_instance_private (self);
+
+ g_return_if_fail (WIRELESS_IS_SECURITY (self));
priv->changed_notify = func;
priv->changed_notify_data = user_data;
@@ -93,7 +103,7 @@ wireless_security_set_changed_notify (WirelessSecurity *self,
void
wireless_security_notify_changed (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = self->priv;
+ WirelessSecurityPrivate *priv = wireless_security_get_instance_private (self);
if (priv->changed_notify)
(*(priv->changed_notify)) (self, priv->changed_notify_data);
@@ -102,14 +112,12 @@ wireless_security_notify_changed (WirelessSecurity *self)
gboolean
wireless_security_validate (WirelessSecurity *self, GError **error)
{
- WirelessSecurityPrivate *priv = self->priv;
gboolean result;
- g_return_val_if_fail (self != NULL, FALSE);
+ g_return_val_if_fail (WIRELESS_IS_SECURITY (self), FALSE);
g_return_val_if_fail (!error || !*error, FALSE);
- g_assert (priv->validate);
- result = (*(priv->validate)) (self, error);
+ result = WIRELESS_SECURITY_GET_CLASS (self)->validate (self, error);
if (!result && error && !*error)
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Unknown error validating 802.1X security"));
return result;
@@ -118,102 +126,28 @@ wireless_security_validate (WirelessSecurity *self, GError **error)
void
wireless_security_add_to_size_group (WirelessSecurity *self, GtkSizeGroup *group)
{
- WirelessSecurityPrivate *priv = self->priv;
+ g_return_if_fail (WIRELESS_IS_SECURITY (self));
+ g_return_if_fail (GTK_IS_SIZE_GROUP (group));
- g_return_if_fail (self != NULL);
- g_return_if_fail (group != NULL);
-
- g_assert (priv->add_to_size_group);
- return (*(priv->add_to_size_group)) (self, group);
+ return WIRELESS_SECURITY_GET_CLASS (self)->add_to_size_group (self, group);
}
void
wireless_security_fill_connection (WirelessSecurity *self,
NMConnection *connection)
{
- WirelessSecurityPrivate *priv = self->priv;
-
- g_return_if_fail (self != NULL);
+ g_return_if_fail (WIRELESS_IS_SECURITY (self));
g_return_if_fail (connection != NULL);
- g_assert (priv->fill_connection);
- return (*(priv->fill_connection)) (self, connection);
-}
-
-WirelessSecurity *
-wireless_security_ref (WirelessSecurity *self)
-{
- WirelessSecurityPrivate *priv = self->priv;
-
- g_return_val_if_fail (self != NULL, NULL);
- g_return_val_if_fail (priv->refcount > 0, NULL);
-
- priv->refcount++;
- return self;
-}
-
-void
-wireless_security_unref (WirelessSecurity *self)
-{
- WirelessSecurityPrivate *priv = self->priv;
-
- g_return_if_fail (self != NULL);
- g_return_if_fail (priv->refcount > 0);
-
- priv->refcount--;
- if (priv->refcount == 0) {
- if (priv->destroy)
- priv->destroy (self);
-
- if (priv->password)
- memset (priv->password, 0, strlen (priv->password));
-
- g_clear_pointer (&priv->username, g_free);
- g_clear_pointer (&priv->password, g_free);
-
- g_slice_free1 (priv->obj_size, self);
- g_free (priv);
- }
-}
-
-WirelessSecurity *
-wireless_security_init (gsize obj_size,
- WSGetWidgetFunc get_widget,
- WSValidateFunc validate,
- WSAddToSizeGroupFunc add_to_size_group,
- WSFillConnectionFunc fill_connection,
- WSDestroyFunc destroy)
-{
- g_autoptr(WirelessSecurity) self = NULL;
- WirelessSecurityPrivate *priv;
-
- g_return_val_if_fail (obj_size > 0, NULL);
-
- g_type_ensure (WIRELESS_TYPE_SECURITY);
-
- self = g_slice_alloc0 (obj_size);
- g_assert (self);
- self->priv = priv = g_new0 (WirelessSecurityPrivate, 1);
-
- priv->refcount = 1;
- priv->obj_size = obj_size;
-
- priv->get_widget = get_widget;
- priv->validate = validate;
- priv->add_to_size_group = add_to_size_group;
- priv->fill_connection = fill_connection;
- priv->destroy = destroy;
- priv->adhoc_compatible = TRUE;
-
- return g_steal_pointer (&self);
+ return WIRELESS_SECURITY_GET_CLASS (self)->fill_connection (self, connection);
}
void
wireless_security_set_adhoc_compatible (WirelessSecurity *self, gboolean adhoc_compatible)
{
- WirelessSecurityPrivate *priv = self->priv;
+ WirelessSecurityPrivate *priv = wireless_security_get_instance_private (self);
- g_return_if_fail (self != NULL);
+ g_return_if_fail (WIRELESS_IS_SECURITY (self));
priv->adhoc_compatible = adhoc_compatible;
}
@@ -221,9 +155,9 @@ wireless_security_set_adhoc_compatible (WirelessSecurity *self, gboolean adhoc_c
gboolean
wireless_security_adhoc_compatible (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = self->priv;
+ WirelessSecurityPrivate *priv = wireless_security_get_instance_private (self);
- g_return_val_if_fail (self != NULL, FALSE);
+ g_return_val_if_fail (WIRELESS_IS_SECURITY (self), FALSE);
return priv->adhoc_compatible;
}
@@ -231,9 +165,9 @@ wireless_security_adhoc_compatible (WirelessSecurity *self)
const gchar *
wireless_security_get_username (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = self->priv;
+ WirelessSecurityPrivate *priv = wireless_security_get_instance_private (self);
- g_return_val_if_fail (self != NULL, NULL);
+ g_return_val_if_fail (WIRELESS_IS_SECURITY (self), NULL);
return priv->username;
}
@@ -241,9 +175,9 @@ wireless_security_get_username (WirelessSecurity *self)
const gchar *
wireless_security_get_password (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = self->priv;
+ WirelessSecurityPrivate *priv = wireless_security_get_instance_private (self);
- g_return_val_if_fail (self != NULL, NULL);
+ g_return_val_if_fail (WIRELESS_IS_SECURITY (self), NULL);
return priv->password;
}
@@ -251,9 +185,9 @@ wireless_security_get_password (WirelessSecurity *self)
gboolean
wireless_security_get_always_ask (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = self->priv;
+ WirelessSecurityPrivate *priv = wireless_security_get_instance_private (self);
- g_return_val_if_fail (self != NULL, FALSE);
+ g_return_val_if_fail (WIRELESS_IS_SECURITY (self), FALSE);
return priv->always_ask;
}
@@ -261,9 +195,9 @@ wireless_security_get_always_ask (WirelessSecurity *self)
gboolean
wireless_security_get_show_password (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = self->priv;
+ WirelessSecurityPrivate *priv = wireless_security_get_instance_private (self);
- g_return_val_if_fail (self != NULL, FALSE);
+ g_return_val_if_fail (WIRELESS_IS_SECURITY (self), FALSE);
return priv->show_password;
}
@@ -275,7 +209,7 @@ wireless_security_set_userpass (WirelessSecurity *self,
gboolean always_ask,
gboolean show_password)
{
- WirelessSecurityPrivate *priv = self->priv;
+ WirelessSecurityPrivate *priv = wireless_security_get_instance_private (self);
g_clear_pointer (&priv->username, g_free);
priv->username = g_strdup (user);
diff --git a/panels/network/wireless-security/wireless-security.h b/panels/network/wireless-security/wireless-security.h
index d4e44ea10..3b82eb6c6 100644
--- a/panels/network/wireless-security/wireless-security.h
+++ b/panels/network/wireless-security/wireless-security.h
@@ -20,31 +20,25 @@
* Copyright 2007 - 2014 Red Hat, Inc.
*/
-#ifndef WIRELESS_SECURITY_H
-#define WIRELESS_SECURITY_H
+#pragma once
#include <gtk/gtk.h>
-#define WIRELESS_TYPE_SECURITY (wireless_security_get_type ())
+G_BEGIN_DECLS
-typedef struct _WirelessSecurity WirelessSecurity;
-typedef struct _WirelessSecurityPrivate WirelessSecurityPrivate;
+G_DECLARE_DERIVABLE_TYPE (WirelessSecurity, wireless_security, WIRELESS, SECURITY, GObject)
typedef void (*WSChangedFunc) (WirelessSecurity *sec, gpointer user_data);
-typedef void (*WSAddToSizeGroupFunc) (WirelessSecurity *sec, GtkSizeGroup *group);
-typedef void (*WSFillConnectionFunc) (WirelessSecurity *sec, NMConnection *connection);
-typedef void (*WSDestroyFunc) (WirelessSecurity *sec);
-typedef gboolean (*WSValidateFunc) (WirelessSecurity *sec, GError **error);
-typedef GtkWidget* (*WSGetWidgetFunc) (WirelessSecurity *sec);
+struct _WirelessSecurityClass {
+ GObjectClass parent_class;
-struct _WirelessSecurity {
- WirelessSecurityPrivate *priv;
+ void (*add_to_size_group) (WirelessSecurity *sec, GtkSizeGroup *group);
+ void (*fill_connection) (WirelessSecurity *sec, NMConnection *connection);
+ gboolean (*validate) (WirelessSecurity *sec, GError **error);
+ GtkWidget* (*get_widget) (WirelessSecurity *sec);
};
-#define WIRELESS_SECURITY(x) ((WirelessSecurity *) x)
-
-
GtkWidget *wireless_security_get_widget (WirelessSecurity *sec);
void wireless_security_set_changed_notify (WirelessSecurity *sec,
@@ -78,21 +72,8 @@ void wireless_security_set_userpass (WirelessSecurity *sec,
gboolean always_ask,
gboolean show_password);
-WirelessSecurity *wireless_security_ref (WirelessSecurity *sec);
-
-void wireless_security_unref (WirelessSecurity *sec);
-
-GType wireless_security_get_type (void);
-
/* Below for internal use only */
-WirelessSecurity *wireless_security_init (gsize obj_size,
- WSGetWidgetFunc get_widget,
- WSValidateFunc validate,
- WSAddToSizeGroupFunc add_to_size_group,
- WSFillConnectionFunc fill_connection,
- WSDestroyFunc destroy);
-
void wireless_security_notify_changed (WirelessSecurity *sec);
void wireless_security_clear_ciphers (NMConnection *connection);
@@ -117,6 +98,4 @@ EAPMethod *ws_802_1x_auth_combo_get_eap (GtkComboBox *combo);
void ws_802_1x_fill_connection (GtkComboBox *combo,
NMConnection *connection);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (WirelessSecurity, wireless_security_unref)
-
-#endif /* WIRELESS_SECURITY_H */
+G_END_DECLS
diff --git a/panels/network/wireless-security/ws-dynamic-wep.c b/panels/network/wireless-security/ws-dynamic-wep.c
index 9be227db6..46e1dabcb 100644
--- a/panels/network/wireless-security/ws-dynamic-wep.c
+++ b/panels/network/wireless-security/ws-dynamic-wep.c
@@ -41,33 +41,37 @@ struct _WirelessSecurityDynamicWEP {
GtkSizeGroup *size_group;
};
+G_DEFINE_TYPE (WirelessSecurityDynamicWEP, ws_dynamic_wep, wireless_security_get_type ())
+
static void
-destroy (WirelessSecurity *parent)
+ws_dynamic_wep_dispose (GObject *object)
{
- WirelessSecurityDynamicWEP *self = (WirelessSecurityDynamicWEP *) parent;
+ WirelessSecurityDynamicWEP *self = WS_DYNAMIC_WEP (object);
g_clear_object (&self->builder);
g_clear_object (&self->size_group);
+
+ G_OBJECT_CLASS (ws_dynamic_wep_parent_class)->dispose (object);
}
static GtkWidget *
-get_widget (WirelessSecurity *parent)
+get_widget (WirelessSecurity *security)
{
- WirelessSecurityDynamicWEP *self = (WirelessSecurityDynamicWEP *) parent;
+ WirelessSecurityDynamicWEP *self = WS_DYNAMIC_WEP (security);
return GTK_WIDGET (self->grid);
}
static gboolean
-validate (WirelessSecurity *parent, GError **error)
+validate (WirelessSecurity *security, GError **error)
{
- WirelessSecurityDynamicWEP *self = (WirelessSecurityDynamicWEP *) parent;
+ WirelessSecurityDynamicWEP *self = WS_DYNAMIC_WEP (security);
return eap_method_validate (ws_802_1x_auth_combo_get_eap (self->auth_combo), error);
}
static void
-add_to_size_group (WirelessSecurity *parent, GtkSizeGroup *group)
+add_to_size_group (WirelessSecurity *security, GtkSizeGroup *group)
{
- WirelessSecurityDynamicWEP *self = (WirelessSecurityDynamicWEP *) parent;
+ WirelessSecurityDynamicWEP *self = WS_DYNAMIC_WEP (security);
g_clear_object (&self->size_group);
self->size_group = g_object_ref (group);
@@ -77,9 +81,9 @@ add_to_size_group (WirelessSecurity *parent, GtkSizeGroup *group)
}
static void
-fill_connection (WirelessSecurity *parent, NMConnection *connection)
+fill_connection (WirelessSecurity *security, NMConnection *connection)
{
- WirelessSecurityDynamicWEP *self = (WirelessSecurityDynamicWEP *) parent;
+ WirelessSecurityDynamicWEP *self = WS_DYNAMIC_WEP (security);
NMSettingWirelessSecurity *s_wireless_sec;
ws_802_1x_fill_connection (self->auth_combo, connection);
@@ -100,24 +104,33 @@ auth_combo_changed_cb (WirelessSecurityDynamicWEP *self)
wireless_security_notify_changed (WIRELESS_SECURITY (self));
}
+void
+ws_dynamic_wep_init (WirelessSecurityDynamicWEP *self)
+{
+}
+
+void
+ws_dynamic_wep_class_init (WirelessSecurityDynamicWEPClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ WirelessSecurityClass *ws_class = WIRELESS_SECURITY_CLASS (klass);
+
+ object_class->dispose = ws_dynamic_wep_dispose;
+ ws_class->get_widget = get_widget;
+ ws_class->validate = validate;
+ ws_class->add_to_size_group = add_to_size_group;
+ ws_class->fill_connection = fill_connection;
+}
+
WirelessSecurityDynamicWEP *
ws_dynamic_wep_new (NMConnection *connection,
gboolean is_editor,
gboolean secrets_only)
{
- WirelessSecurity *parent;
WirelessSecurityDynamicWEP *self;
g_autoptr(GError) error = NULL;
- parent = wireless_security_init (sizeof (WirelessSecurityDynamicWEP),
- get_widget,
- validate,
- add_to_size_group,
- fill_connection,
- destroy);
- if (!parent)
- return NULL;
- self = (WirelessSecurityDynamicWEP *) parent;
+ self = g_object_new (ws_dynamic_wep_get_type (), NULL);
self->builder = gtk_builder_new ();
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/ControlCenter/network/ws-dynamic-wep.ui", &error)) {
@@ -130,9 +143,9 @@ 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 (parent, FALSE);
+ wireless_security_set_adhoc_compatible (WIRELESS_SECURITY (self), FALSE);
- ws_802_1x_auth_combo_init (parent,
+ ws_802_1x_auth_combo_init (WIRELESS_SECURITY (self),
self->auth_combo,
connection,
is_editor,
diff --git a/panels/network/wireless-security/ws-dynamic-wep.h b/panels/network/wireless-security/ws-dynamic-wep.h
index e2e5f6a11..95fdf0de8 100644
--- a/panels/network/wireless-security/ws-dynamic-wep.h
+++ b/panels/network/wireless-security/ws-dynamic-wep.h
@@ -20,13 +20,18 @@
* Copyright 2007 - 2014 Red Hat, Inc.
*/
-#ifndef WS_DYNAMIC_WEP_H
-#define WS_DYNAMIC_WEP_H
+#pragma once
-typedef struct _WirelessSecurityDynamicWEP WirelessSecurityDynamicWEP;
+#include <NetworkManager.h>
+
+#include "wireless-security.h"
+
+G_BEGIN_DECLS
+
+G_DECLARE_FINAL_TYPE (WirelessSecurityDynamicWEP, ws_dynamic_wep, WS, DYNAMIC_WEP, WirelessSecurity)
WirelessSecurityDynamicWEP *ws_dynamic_wep_new (NMConnection *connection,
gboolean is_editor,
gboolean secrets_only);
-#endif /* WS_DYNAMIC_WEP_H */
+G_END_DECLS
diff --git a/panels/network/wireless-security/ws-leap.c b/panels/network/wireless-security/ws-leap.c
index f2f1f7191..11cc34cc0 100644
--- a/panels/network/wireless-security/ws-leap.c
+++ b/panels/network/wireless-security/ws-leap.c
@@ -45,12 +45,16 @@ struct _WirelessSecurityLEAP {
const char *password_flags_name;
};
+G_DEFINE_TYPE (WirelessSecurityLEAP, ws_leap, wireless_security_get_type ())
+
static void
-destroy (WirelessSecurity *parent)
+ws_leap_dispose (GObject *object)
{
- WirelessSecurityLEAP *self = (WirelessSecurityLEAP *) parent;
+ WirelessSecurityLEAP *self = WS_LEAP (object);
g_clear_object (&self->builder);
+
+ G_OBJECT_CLASS (ws_leap_parent_class)->dispose (object);
}
static void
@@ -63,16 +67,16 @@ show_toggled_cb (WirelessSecurityLEAP *self)
}
static GtkWidget *
-get_widget (WirelessSecurity *parent)
+get_widget (WirelessSecurity *security)
{
- WirelessSecurityLEAP *self = (WirelessSecurityLEAP *) parent;
+ WirelessSecurityLEAP *self = WS_LEAP (security);
return GTK_WIDGET (self->grid);
}
static gboolean
-validate (WirelessSecurity *parent, GError **error)
+validate (WirelessSecurity *security, GError **error)
{
- WirelessSecurityLEAP *self = (WirelessSecurityLEAP *) parent;
+ WirelessSecurityLEAP *self = WS_LEAP (security);
const char *text;
gboolean ret = TRUE;
@@ -98,17 +102,17 @@ validate (WirelessSecurity *parent, GError **error)
}
static void
-add_to_size_group (WirelessSecurity *parent, GtkSizeGroup *group)
+add_to_size_group (WirelessSecurity *security, GtkSizeGroup *group)
{
- WirelessSecurityLEAP *self = (WirelessSecurityLEAP *) parent;
+ WirelessSecurityLEAP *self = WS_LEAP (security);
gtk_size_group_add_widget (group, GTK_WIDGET (self->username_label));
gtk_size_group_add_widget (group, GTK_WIDGET (self->password_label));
}
static void
-fill_connection (WirelessSecurity *parent, NMConnection *connection)
+fill_connection (WirelessSecurity *security, NMConnection *connection)
{
- WirelessSecurityLEAP *self = (WirelessSecurityLEAP *) parent;
+ WirelessSecurityLEAP *self = WS_LEAP (security);
NMSettingWirelessSecurity *s_wireless_sec;
NMSettingSecretFlags secret_flags;
const char *leap_password = NULL, *leap_username = NULL;
@@ -139,37 +143,37 @@ fill_connection (WirelessSecurity *parent, NMConnection *connection)
}
static void
-update_secrets (WirelessSecurity *parent, NMConnection *connection)
+changed_cb (WirelessSecurityLEAP *self)
{
- WirelessSecurityLEAP *self = (WirelessSecurityLEAP *) parent;
- helper_fill_secret_entry (connection,
- self->password_entry,
- NM_TYPE_SETTING_WIRELESS_SECURITY,
- (HelperSecretFunc) nm_setting_wireless_security_get_leap_password);
+ wireless_security_notify_changed ((WirelessSecurity *) self);
}
-static void
-changed_cb (WirelessSecurityLEAP *self)
+void
+ws_leap_init (WirelessSecurityLEAP *self)
{
- wireless_security_notify_changed ((WirelessSecurity *) self);
+}
+
+void
+ws_leap_class_init (WirelessSecurityLEAPClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ WirelessSecurityClass *ws_class = WIRELESS_SECURITY_CLASS (klass);
+
+ object_class->dispose = ws_leap_dispose;
+ ws_class->get_widget = get_widget;
+ ws_class->validate = validate;
+ ws_class->add_to_size_group = add_to_size_group;
+ ws_class->fill_connection = fill_connection;
}
WirelessSecurityLEAP *
ws_leap_new (NMConnection *connection, gboolean secrets_only)
{
- WirelessSecurity *parent;
WirelessSecurityLEAP *self;
NMSettingWirelessSecurity *wsec = NULL;
g_autoptr(GError) error = NULL;
- parent = wireless_security_init (sizeof (WirelessSecurityLEAP),
- get_widget,
- validate,
- add_to_size_group,
- fill_connection,
- destroy);
- if (!parent)
- return NULL;
+ self = g_object_new (ws_leap_get_type (), NULL);
if (connection) {
wsec = nm_connection_get_setting_wireless_security (connection);
@@ -183,8 +187,8 @@ ws_leap_new (NMConnection *connection, gboolean secrets_only)
}
}
- wireless_security_set_adhoc_compatible (parent, FALSE);
- self = (WirelessSecurityLEAP *) parent;
+ 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;
@@ -208,7 +212,10 @@ ws_leap_new (NMConnection *connection, gboolean secrets_only)
FALSE, secrets_only);
if (wsec)
- update_secrets (WIRELESS_SECURITY (self), connection);
+ helper_fill_secret_entry (connection,
+ self->password_entry,
+ NM_TYPE_SETTING_WIRELESS_SECURITY,
+ (HelperSecretFunc) nm_setting_wireless_security_get_leap_password);
g_signal_connect_swapped (self->username_entry, "changed", G_CALLBACK (changed_cb), self);
if (wsec)
diff --git a/panels/network/wireless-security/ws-leap.h b/panels/network/wireless-security/ws-leap.h
index fedc06d66..33abc6062 100644
--- a/panels/network/wireless-security/ws-leap.h
+++ b/panels/network/wireless-security/ws-leap.h
@@ -20,11 +20,16 @@
* Copyright 2007 - 2014 Red Hat, Inc.
*/
-#ifndef WS_LEAP_H
-#define WS_LEAP_H
+#pragma once
-typedef struct _WirelessSecurityLEAP WirelessSecurityLEAP;
+#include <NetworkManager.h>
+
+#include "wireless-security.h"
+
+G_BEGIN_DECLS
+
+G_DECLARE_FINAL_TYPE (WirelessSecurityLEAP, ws_leap, WS, LEAP, WirelessSecurity)
WirelessSecurityLEAP * ws_leap_new (NMConnection *connection, gboolean secrets_only);
-#endif /* WS_LEAP_H */
+G_END_DECLS
diff --git a/panels/network/wireless-security/ws-wep-key.c b/panels/network/wireless-security/ws-wep-key.c
index 0a799e75b..f394c7c59 100644
--- a/panels/network/wireless-security/ws-wep-key.c
+++ b/panels/network/wireless-security/ws-wep-key.c
@@ -51,6 +51,8 @@ struct _WirelessSecurityWEPKey {
guint8 cur_index;
};
+G_DEFINE_TYPE (WirelessSecurityWEPKey, ws_wep_key, wireless_security_get_type ())
+
static void
show_toggled_cb (WirelessSecurityWEPKey *self)
{
@@ -85,27 +87,29 @@ key_index_combo_changed_cb (WirelessSecurityWEPKey *self)
}
static void
-destroy (WirelessSecurity *parent)
+ws_wep_key_dispose (GObject *object)
{
- WirelessSecurityWEPKey *self = (WirelessSecurityWEPKey *) parent;
+ WirelessSecurityWEPKey *self = WS_WEP_KEY (object);
int i;
g_clear_object (&self->builder);
for (i = 0; i < 4; i++)
memset (self->keys[i], 0, sizeof (self->keys[i]));
+
+ G_OBJECT_CLASS (ws_wep_key_parent_class)->dispose (object);
}
static GtkWidget *
-get_widget (WirelessSecurity *parent)
+get_widget (WirelessSecurity *security)
{
- WirelessSecurityWEPKey *self = (WirelessSecurityWEPKey *) parent;
+ WirelessSecurityWEPKey *self = WS_WEP_KEY (security);
return GTK_WIDGET (self->grid);
}
static gboolean
-validate (WirelessSecurity *parent, GError **error)
+validate (WirelessSecurity *security, GError **error)
{
- WirelessSecurityWEPKey *self = (WirelessSecurityWEPKey *) parent;
+ WirelessSecurityWEPKey *self = WS_WEP_KEY (security);
const char *key;
int i;
@@ -154,18 +158,18 @@ validate (WirelessSecurity *parent, GError **error)
}
static void
-add_to_size_group (WirelessSecurity *parent, GtkSizeGroup *group)
+add_to_size_group (WirelessSecurity *security, GtkSizeGroup *group)
{
- WirelessSecurityWEPKey *self = (WirelessSecurityWEPKey *) parent;
+ WirelessSecurityWEPKey *self = WS_WEP_KEY (security);
gtk_size_group_add_widget (group, GTK_WIDGET (self->auth_method_label));
gtk_size_group_add_widget (group, GTK_WIDGET (self->key_label));
gtk_size_group_add_widget (group, GTK_WIDGET (self->key_index_label));
}
static void
-fill_connection (WirelessSecurity *parent, NMConnection *connection)
+fill_connection (WirelessSecurity *security, NMConnection *connection)
{
- WirelessSecurityWEPKey *self = (WirelessSecurityWEPKey *) parent;
+ WirelessSecurityWEPKey *self = WS_WEP_KEY (security);
NMSettingWirelessSecurity *s_wsec;
NMSettingSecretFlags secret_flags;
gint auth_alg;
@@ -229,9 +233,8 @@ wep_entry_filter_cb (WirelessSecurityWEPKey *self,
}
static void
-update_secrets (WirelessSecurity *parent, NMConnection *connection)
+update_secrets (WirelessSecurityWEPKey *self, NMConnection *connection)
{
- WirelessSecurityWEPKey *self = (WirelessSecurityWEPKey *) parent;
NMSettingWirelessSecurity *s_wsec;
const char *tmp;
int i;
@@ -253,13 +256,30 @@ changed_cb (WirelessSecurityWEPKey *self)
wireless_security_notify_changed ((WirelessSecurity *) self);
}
+void
+ws_wep_key_init (WirelessSecurityWEPKey *self)
+{
+}
+
+void
+ws_wep_key_class_init (WirelessSecurityWEPKeyClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ WirelessSecurityClass *ws_class = WIRELESS_SECURITY_CLASS (klass);
+
+ object_class->dispose = ws_wep_key_dispose;
+ ws_class->get_widget = get_widget;
+ ws_class->validate = validate;
+ ws_class->add_to_size_group = add_to_size_group;
+ ws_class->fill_connection = fill_connection;
+}
+
WirelessSecurityWEPKey *
ws_wep_key_new (NMConnection *connection,
NMWepKeyType type,
gboolean adhoc_create,
gboolean secrets_only)
{
- WirelessSecurity *parent;
WirelessSecurityWEPKey *self;
NMSettingWirelessSecurity *s_wsec = NULL;
NMSetting *setting = NULL;
@@ -268,15 +288,7 @@ ws_wep_key_new (NMConnection *connection,
gboolean is_shared_key = FALSE;
g_autoptr(GError) error = NULL;
- parent = wireless_security_init (sizeof (WirelessSecurityWEPKey),
- get_widget,
- validate,
- add_to_size_group,
- fill_connection,
- destroy);
- if (!parent)
- return NULL;
- self = (WirelessSecurityWEPKey *) parent;
+ self = g_object_new (ws_wep_key_get_type (), NULL);
self->builder = gtk_builder_new ();
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/ControlCenter/network/ws-wep-key.ui", &error)) {
@@ -344,7 +356,7 @@ ws_wep_key_new (NMConnection *connection,
/* Fill the key entry with the key for that index */
if (connection)
- update_secrets (WIRELESS_SECURITY (self), connection);
+ update_secrets (self, connection);
g_signal_connect_swapped (self->show_key_check, "toggled", G_CALLBACK (show_toggled_cb), self);
diff --git a/panels/network/wireless-security/ws-wep-key.h b/panels/network/wireless-security/ws-wep-key.h
index 604eba6bb..85003e2e6 100644
--- a/panels/network/wireless-security/ws-wep-key.h
+++ b/panels/network/wireless-security/ws-wep-key.h
@@ -20,14 +20,19 @@
* Copyright 2007 - 2014 Red Hat, Inc.
*/
-#ifndef WS_WEP_KEY_H
-#define WS_WEP_KEY_H
+#pragma once
-typedef struct _WirelessSecurityWEPKey WirelessSecurityWEPKey;
+#include <NetworkManager.h>
+
+#include "wireless-security.h"
+
+G_BEGIN_DECLS
+
+G_DECLARE_FINAL_TYPE (WirelessSecurityWEPKey, ws_wep_key, WS, WEP_KEY, WirelessSecurity)
WirelessSecurityWEPKey *ws_wep_key_new (NMConnection *connection,
NMWepKeyType type,
gboolean adhoc_create,
gboolean secrets_only);
-#endif /* WS_WEP_KEY_H */
+G_END_DECLS
diff --git a/panels/network/wireless-security/ws-wpa-eap.c b/panels/network/wireless-security/ws-wpa-eap.c
index cb9cff156..943b72e9c 100644
--- a/panels/network/wireless-security/ws-wpa-eap.c
+++ b/panels/network/wireless-security/ws-wpa-eap.c
@@ -41,33 +41,37 @@ struct _WirelessSecurityWPAEAP {
GtkSizeGroup *size_group;
};
+G_DEFINE_TYPE (WirelessSecurityWPAEAP, ws_wpa_eap, wireless_security_get_type ())
+
static void
-destroy (WirelessSecurity *parent)
+ws_wpa_eap_dispose (GObject *object)
{
- WirelessSecurityWPAEAP *self = (WirelessSecurityWPAEAP *) parent;
+ WirelessSecurityWPAEAP *self = WS_WPA_EAP (object);
g_clear_object (&self->builder);
g_clear_object (&self->size_group);
+
+ G_OBJECT_CLASS (ws_wpa_eap_parent_class)->dispose (object);
}
static GtkWidget *
-get_widget (WirelessSecurity *parent)
+get_widget (WirelessSecurity *security)
{
- WirelessSecurityWPAEAP *self = (WirelessSecurityWPAEAP *) parent;
+ WirelessSecurityWPAEAP *self = WS_WPA_EAP (security);
return GTK_WIDGET (self->grid);
}
static gboolean
-validate (WirelessSecurity *parent, GError **error)
+validate (WirelessSecurity *security, GError **error)
{
- WirelessSecurityWPAEAP *self = (WirelessSecurityWPAEAP *) parent;
+ WirelessSecurityWPAEAP *self = WS_WPA_EAP (security);
return eap_method_validate (ws_802_1x_auth_combo_get_eap (self->auth_combo), error);
}
static void
-add_to_size_group (WirelessSecurity *parent, GtkSizeGroup *group)
+add_to_size_group (WirelessSecurity *security, GtkSizeGroup *group)
{
- WirelessSecurityWPAEAP *self = (WirelessSecurityWPAEAP *) parent;
+ WirelessSecurityWPAEAP *self = WS_WPA_EAP (security);
g_clear_object (&self->size_group);
self->size_group = g_object_ref (group);
@@ -77,9 +81,9 @@ add_to_size_group (WirelessSecurity *parent, GtkSizeGroup *group)
}
static void
-fill_connection (WirelessSecurity *parent, NMConnection *connection)
+fill_connection (WirelessSecurity *security, NMConnection *connection)
{
- WirelessSecurityWPAEAP *self = (WirelessSecurityWPAEAP *) parent;
+ WirelessSecurityWPAEAP *self = WS_WPA_EAP (security);
NMSettingWirelessSecurity *s_wireless_sec;
ws_802_1x_fill_connection (self->auth_combo, connection);
@@ -100,24 +104,33 @@ auth_combo_changed_cb (WirelessSecurityWPAEAP *self)
wireless_security_notify_changed (WIRELESS_SECURITY (self));
}
+void
+ws_wpa_eap_init (WirelessSecurityWPAEAP *self)
+{
+}
+
+void
+ws_wpa_eap_class_init (WirelessSecurityWPAEAPClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ WirelessSecurityClass *ws_class = WIRELESS_SECURITY_CLASS (klass);
+
+ object_class->dispose = ws_wpa_eap_dispose;
+ ws_class->get_widget = get_widget;
+ ws_class->validate = validate;
+ ws_class->add_to_size_group = add_to_size_group;
+ ws_class->fill_connection = fill_connection;
+}
+
WirelessSecurityWPAEAP *
ws_wpa_eap_new (NMConnection *connection,
gboolean is_editor,
gboolean secrets_only)
{
- WirelessSecurity *parent;
WirelessSecurityWPAEAP *self;
g_autoptr(GError) error = NULL;
- parent = wireless_security_init (sizeof (WirelessSecurityWPAEAP),
- get_widget,
- validate,
- add_to_size_group,
- fill_connection,
- destroy);
- if (!parent)
- return NULL;
- self = (WirelessSecurityWPAEAP *) parent;
+ self = g_object_new (ws_wpa_eap_get_type (), NULL);
self->builder = gtk_builder_new ();
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/ControlCenter/network/ws-wpa-eap.ui", &error)) {
@@ -130,9 +143,9 @@ 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 (parent, FALSE);
+ wireless_security_set_adhoc_compatible (WIRELESS_SECURITY (self), FALSE);
- ws_802_1x_auth_combo_init (parent,
+ ws_802_1x_auth_combo_init (WIRELESS_SECURITY (self),
self->auth_combo,
connection,
is_editor,
diff --git a/panels/network/wireless-security/ws-wpa-eap.h b/panels/network/wireless-security/ws-wpa-eap.h
index b5c1f9d4e..605a1debe 100644
--- a/panels/network/wireless-security/ws-wpa-eap.h
+++ b/panels/network/wireless-security/ws-wpa-eap.h
@@ -20,12 +20,15 @@
* Copyright 2007 - 2014 Red Hat, Inc.
*/
-#ifndef WS_WPA_EAP_H
-#define WS_WPA_EAP_H
+#pragma once
-#include <gtk/gtk.h>
+#include <NetworkManager.h>
-typedef struct _WirelessSecurityWPAEAP WirelessSecurityWPAEAP;
+#include "wireless-security.h"
+
+G_BEGIN_DECLS
+
+G_DECLARE_FINAL_TYPE (WirelessSecurityWPAEAP, ws_wpa_eap, WS, WPA_EAP, WirelessSecurity)
WirelessSecurityWPAEAP *ws_wpa_eap_new (NMConnection *connection,
gboolean is_editor,
@@ -33,4 +36,4 @@ WirelessSecurityWPAEAP *ws_wpa_eap_new (NMConnection *connection,
GtkComboBox *ws_wpa_eap_get_auth_combo (WirelessSecurityWPAEAP *sec);
-#endif /* WS_WPA_EAP_H */
+G_END_DECLS
diff --git a/panels/network/wireless-security/ws-wpa-psk.c b/panels/network/wireless-security/ws-wpa-psk.c
index e253d17f4..000d90038 100644
--- a/panels/network/wireless-security/ws-wpa-psk.c
+++ b/panels/network/wireless-security/ws-wpa-psk.c
@@ -48,18 +48,22 @@ struct _WirelessSecurityWPAPSK {
const char *password_flags_name;
};
+G_DEFINE_TYPE (WirelessSecurityWPAPSK, ws_wpa_psk, wireless_security_get_type ())
+
static void
-destroy (WirelessSecurity *parent)
+ws_wpa_psk_dispose (GObject *object)
{
- WirelessSecurityWPAPSK *self = (WirelessSecurityWPAPSK *) parent;
+ WirelessSecurityWPAPSK *self = WS_WPA_PSK (object);
g_clear_object (&self->builder);
+
+ G_OBJECT_CLASS (ws_wpa_psk_parent_class)->dispose (object);
}
static GtkWidget *
-get_widget (WirelessSecurity *parent)
+get_widget (WirelessSecurity *security)
{
- WirelessSecurityWPAPSK *self = (WirelessSecurityWPAPSK *) parent;
+ WirelessSecurityWPAPSK *self = WS_WPA_PSK (security);
return GTK_WIDGET (self->grid);
}
@@ -73,9 +77,9 @@ show_toggled_cb (WirelessSecurityWPAPSK *self)
}
static gboolean
-validate (WirelessSecurity *parent, GError **error)
+validate (WirelessSecurity *security, GError **error)
{
- WirelessSecurityWPAPSK *self = (WirelessSecurityWPAPSK *) parent;
+ WirelessSecurityWPAPSK *self = WS_WPA_PSK (security);
const char *key;
gsize len;
int i;
@@ -106,17 +110,17 @@ validate (WirelessSecurity *parent, GError **error)
}
static void
-add_to_size_group (WirelessSecurity *parent, GtkSizeGroup *group)
+add_to_size_group (WirelessSecurity *security, GtkSizeGroup *group)
{
- WirelessSecurityWPAPSK *self = (WirelessSecurityWPAPSK *) parent;
+ WirelessSecurityWPAPSK *self = WS_WPA_PSK (security);
gtk_size_group_add_widget (group, GTK_WIDGET (self->type_label));
gtk_size_group_add_widget (group, GTK_WIDGET (self->password_label));
}
static void
-fill_connection (WirelessSecurity *parent, NMConnection *connection)
+fill_connection (WirelessSecurity *security, NMConnection *connection)
{
- WirelessSecurityWPAPSK *self = (WirelessSecurityWPAPSK *) parent;
+ WirelessSecurityWPAPSK *self = WS_WPA_PSK (security);
const char *key;
NMSettingWireless *s_wireless;
NMSettingWirelessSecurity *s_wireless_sec;
@@ -169,38 +173,37 @@ fill_connection (WirelessSecurity *parent, NMConnection *connection)
}
static void
-update_secrets (WirelessSecurity *parent, NMConnection *connection)
+changed_cb (WirelessSecurityWPAPSK *self)
{
- WirelessSecurityWPAPSK *self = (WirelessSecurityWPAPSK *) parent;
- helper_fill_secret_entry (connection,
- self->password_entry,
- NM_TYPE_SETTING_WIRELESS_SECURITY,
- (HelperSecretFunc) nm_setting_wireless_security_get_psk);
+ wireless_security_notify_changed ((WirelessSecurity *) self);
}
-static void
-changed_cb (WirelessSecurityWPAPSK *self)
+void
+ws_wpa_psk_init (WirelessSecurityWPAPSK *self)
{
- wireless_security_notify_changed ((WirelessSecurity *) self);
+}
+
+void
+ws_wpa_psk_class_init (WirelessSecurityWPAPSKClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ WirelessSecurityClass *ws_class = WIRELESS_SECURITY_CLASS (klass);
+
+ object_class->dispose = ws_wpa_psk_dispose;
+ ws_class->get_widget = get_widget;
+ ws_class->validate = validate;
+ ws_class->add_to_size_group = add_to_size_group;
+ ws_class->fill_connection = fill_connection;
}
WirelessSecurityWPAPSK *
ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only)
{
- WirelessSecurity *parent;
WirelessSecurityWPAPSK *self;
NMSetting *setting = NULL;
g_autoptr(GError) error = NULL;
- parent = wireless_security_init (sizeof (WirelessSecurityWPAPSK),
- get_widget,
- validate,
- add_to_size_group,
- fill_connection,
- destroy);
- if (!parent)
- return NULL;
- self = (WirelessSecurityWPAPSK *) parent;
+ self = g_object_new (ws_wpa_psk_get_type (), NULL);
self->builder = gtk_builder_new ();
if (!gtk_builder_add_from_resource (self->builder, "/org/gnome/ControlCenter/network/ws-wpa-psk.ui", &error)) {
@@ -215,7 +218,7 @@ 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 (parent, FALSE);
+ 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;
@@ -230,8 +233,12 @@ ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only)
FALSE, secrets_only);
/* Fill secrets, if any */
- if (connection)
- update_secrets (WIRELESS_SECURITY (self), connection);
+ if (connection) {
+ helper_fill_secret_entry (connection,
+ self->password_entry,
+ NM_TYPE_SETTING_WIRELESS_SECURITY,
+ (HelperSecretFunc) nm_setting_wireless_security_get_psk);
+ }
g_signal_connect_swapped (self->show_password_check, "toggled", G_CALLBACK (show_toggled_cb), self);
diff --git a/panels/network/wireless-security/ws-wpa-psk.h b/panels/network/wireless-security/ws-wpa-psk.h
index 8b84ed856..d2c4a5bd2 100644
--- a/panels/network/wireless-security/ws-wpa-psk.h
+++ b/panels/network/wireless-security/ws-wpa-psk.h
@@ -20,11 +20,16 @@
* Copyright 2007 - 2014 Red Hat, Inc.
*/
-#ifndef WS_WPA_PSK_H
-#define WS_WPA_PSK_H
+#pragma once
-typedef struct _WirelessSecurityWPAPSK WirelessSecurityWPAPSK;
+#include <NetworkManager.h>
+
+#include "wireless-security.h"
+
+G_BEGIN_DECLS
+
+G_DECLARE_FINAL_TYPE (WirelessSecurityWPAPSK, ws_wpa_psk, WS, WPA_PSK, WirelessSecurity)
WirelessSecurityWPAPSK * ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only);
-#endif /* WS_WEP_KEY_H */
+G_END_DECLS