[libnma/lr/wireless-security: 7/7] xxx



commit 5ad86b1118dd94c137b9a5ab1cfd813f8230d748
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Tue Oct 22 07:16:01 2019 +0200

    xxx

 Makefile.am                        |  11 +-
 src/libnma.ver                     |  43 +++-
 src/nma-ws/nma-eap-fast.c          |  21 +-
 src/nma-ws/nma-eap-fast.h          |   4 +-
 src/nma-ws/nma-eap-leap.c          |  30 ++-
 src/nma-ws/nma-eap-leap.h          |   4 +-
 src/nma-ws/nma-eap-peap.c          |  25 +-
 src/nma-ws/nma-eap-peap.h          |   4 +-
 src/nma-ws/nma-eap-simple.c        |   8 +
 src/nma-ws/nma-eap-tls.c           |  21 +-
 src/nma-ws/nma-eap-tls.h           |   4 +-
 src/nma-ws/nma-eap-ttls.c          |  25 +-
 src/nma-ws/nma-eap-ttls.h          |   4 +-
 src/nma-ws/nma-ws-802-1x-private.h |  30 +++
 src/nma-ws/nma-ws-802-1x.c         | 497 ++++++++++++++++++++++++++++++++++++
 src/nma-ws/nma-ws-802-1x.h         |  23 ++
 src/nma-ws/nma-ws-802-1x.ui        |  72 ++++++
 src/nma-ws/nma-ws-dynamic-wep.c    | 104 ++------
 src/nma-ws/nma-ws-dynamic-wep.h    |  19 +-
 src/nma-ws/nma-ws-dynamic-wep.ui   |  87 -------
 src/nma-ws/nma-ws-helpers.c        |  31 +++
 src/nma-ws/nma-ws-helpers.h        |  18 ++
 src/nma-ws/nma-ws-leap.c           | 294 ++++++++++++++--------
 src/nma-ws/nma-ws-leap.h           |  19 +-
 src/nma-ws/nma-ws-leap.ui          | 152 +++++------
 src/nma-ws/nma-ws-sae.c            | 259 ++++++++++++-------
 src/nma-ws/nma-ws-sae.h            |  19 +-
 src/nma-ws/nma-ws-sae.ui           | 148 +++++------
 src/nma-ws/nma-ws-wep-key.c        | 413 +++++++++++++++++++-----------
 src/nma-ws/nma-ws-wep-key.h        |  19 +-
 src/nma-ws/nma-ws-wep-key.ui       | 227 ++++++++---------
 src/nma-ws/nma-ws-wpa-eap.c        | 108 +++-----
 src/nma-ws/nma-ws-wpa-eap.h        |  22 +-
 src/nma-ws/nma-ws-wpa-eap.ui       |  87 -------
 src/nma-ws/nma-ws-wpa-psk.c        | 261 ++++++++++++-------
 src/nma-ws/nma-ws-wpa-psk.h        |  19 +-
 src/nma-ws/nma-ws-wpa-psk.ui       | 147 +++++------
 src/nma-ws/nma-ws.c                | 503 ++++---------------------------------
 src/nma-ws/nma-ws.h                | 106 +-------
 src/nma.gresource.xml              |   3 +-
 src/wireless-security/ws-leap.ui   |   2 +-
 41 files changed, 2105 insertions(+), 1788 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 60f961a6..f452d759 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -314,7 +314,11 @@ libnma_c_real = \
        src/nma-bar-code.c \
        \
        src/nma-ws/nma-ws.h \
+       src/nma-ws/nma-ws-private.h \
        src/nma-ws/nma-ws.c \
+       src/nma-ws/nma-ws-802-1x.h \
+       src/nma-ws/nma-ws-802-1x-private.h \
+       src/nma-ws/nma-ws-802-1x.c \
        src/nma-ws/nma-ws-sae.h \
        src/nma-ws/nma-ws-sae.c \
        src/nma-ws/nma-ws-wep-key.h \
@@ -340,7 +344,9 @@ libnma_c_real = \
        src/nma-ws/nma-eap-peap.h \
        src/nma-ws/nma-eap-peap.c \
        src/nma-ws/nma-eap-simple.h \
-       src/nma-ws/nma-eap-simple.c
+       src/nma-ws/nma-eap-simple.c \
+       src/nma-ws/nma-ws-helpers.h \
+       src/nma-ws/nma-ws-helpers.c
 
 EXTRA_DIST += \
        src/qrcodegen.c \
@@ -836,11 +842,10 @@ EXTRA_DIST += \
        src/nma-ws/nma-eap-simple.ui \
        src/nma-ws/nma-eap-tls.ui \
        src/nma-ws/nma-eap-ttls.ui \
-       src/nma-ws/nma-ws-dynamic-wep.ui \
+       src/nma-ws/nma-ws-802-1x.ui \
        src/nma-ws/nma-ws-leap.ui \
        src/nma-ws/nma-ws-sae.ui \
        src/nma-ws/nma-ws-wep-key.ui \
-       src/nma-ws/nma-ws-wpa-eap.ui \
        src/nma-ws/nma-ws-wpa-psk.ui \
        src/nma-ws/meson.build
 
diff --git a/src/libnma.ver b/src/libnma.ver
index 7b25e9c8..fcdb0adc 100644
--- a/src/libnma.ver
+++ b/src/libnma.ver
@@ -114,22 +114,47 @@ libnma_1_8_22 {
 } libnma_1_8_12;
 
 libnma_1_8_28 {
-       nma_eap_get_type;
-       nma_eap_method_ca_cert_ignore_load;
-       nma_eap_method_ca_cert_ignore_save;
-       nma_ws_802_1x_fill_connection;
        nma_ws_add_to_size_group;
-       nma_ws_adhoc_compatible;
-       nma_ws_dynamic_wep_new;
        nma_ws_fill_connection;
        nma_ws_get_type;
+       nma_ws_validate;
+
+       nma_eap_get_type;
+       nma_ws_802_1x_get_type;
+
+
+/*
+       nma_ws_802_1x_fill_connection;
+       nma_ws_adhoc_compatible;
+
+       nma_eap_method_ca_cert_ignore_load;
+       nma_eap_method_ca_cert_ignore_save;
+
+       // obsolete
        nma_ws_get_widget;
-       nma_ws_leap_new;
-       nma_ws_sae_new;
        nma_ws_set_changed_notify;
        nma_ws_unref;
-       nma_ws_validate;
+
+       // constructors
+       nma_ws_dynamic_wep_new;
+       nma_ws_leap_new;
+       nma_ws_sae_new;
        nma_ws_wep_key_new;
        nma_ws_wpa_eap_new;
        nma_ws_wpa_psk_new;
+*/
+
+       nma_ws_sae_get_type;
+       nma_ws_leap_get_type;
+       nma_ws_wpa_psk_get_type;
+       nma_ws_wep_key_get_type;
+       nma_ws_dynamic_wep_get_type;
+       nma_ws_wpa_eap_get_type;
+
+
+       /* dialog only */
+/*
+       nma_ws_update_secrets;
+*/
+
 } libnma_1_8_22;
diff --git a/src/nma-ws/nma-eap-fast.c b/src/nma-ws/nma-eap-fast.c
index 1ee93e49..999862c2 100644
--- a/src/nma-ws/nma-eap-fast.c
+++ b/src/nma-ws/nma-eap-fast.c
@@ -13,13 +13,14 @@
 
 #include "nma-eap.h"
 #include "nma-ws.h"
+#include "nma-ws-private.h"
 #include "utils.h"
 #include "helpers.h"
 
 #define I_NAME_COLUMN   0
 #define I_METHOD_COLUMN 1
 
-struct _NMAEapFAST {
+struct _NMAEapFast {
        NMAEap parent;
 
        const char *password_flags_name;
@@ -31,7 +32,7 @@ struct _NMAEapFAST {
 static void
 destroy (NMAEap *parent)
 {
-       NMAEapFAST *method = (NMAEapFAST *) parent;
+       NMAEapFast *method = (NMAEapFast *) parent;
 
        if (method->size_group)
                g_object_unref (method->size_group);
@@ -75,7 +76,7 @@ validate (NMAEap *parent, GError **error)
 static void
 add_to_size_group (NMAEap *parent, GtkSizeGroup *group)
 {
-       NMAEapFAST *method = (NMAEapFAST *) parent;
+       NMAEapFast *method = (NMAEapFast *) parent;
        GtkWidget *widget;
        GtkTreeModel *model;
        GtkTreeIter iter;
@@ -180,7 +181,7 @@ static void
 inner_auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
 {
        NMAEap *parent = (NMAEap *) user_data;
-       NMAEapFAST *method = (NMAEapFAST *) parent;
+       NMAEapFast *method = (NMAEapFast *) parent;
        GtkWidget *vbox;
        NMAEap *eap = NULL;
        GList *elt, *children;
@@ -216,7 +217,7 @@ inner_auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
 }
 
 static GtkWidget *
-inner_auth_combo_init (NMAEapFAST *method,
+inner_auth_combo_init (NMAEapFast *method,
                        NMConnection *connection,
                        NMSetting8021x *s_8021x,
                        gboolean secrets_only)
@@ -304,7 +305,7 @@ static void
 pac_toggled_cb (GtkWidget *widget, gpointer user_data)
 {
        NMAEap *parent = (NMAEap *) user_data;
-       NMAEapFAST *method = (NMAEapFAST *) parent;
+       NMAEapFast *method = (NMAEapFast *) parent;
        gboolean enabled = FALSE;
        GtkWidget *provision_combo;
 
@@ -318,21 +319,21 @@ pac_toggled_cb (GtkWidget *widget, gpointer user_data)
        nma_ws_changed_cb (widget, method->sec_parent);
 }
 
-NMAEapFAST *
+NMAEapFast *
 nma_eap_fast_new (NMAWs *ws_parent,
                   NMConnection *connection,
                   gboolean is_editor,
                   gboolean secrets_only)
 {
        NMAEap *parent;
-       NMAEapFAST *method;
+       NMAEapFast *method;
        GtkWidget *widget;
        GtkFileFilter *filter;
        NMSetting8021x *s_8021x = NULL;
        const char *filename;
        gboolean provisioning_enabled = TRUE;
 
-       parent = nma_eap_init (sizeof (NMAEapFAST),
+       parent = nma_eap_init (sizeof (NMAEapFast),
                               validate,
                               add_to_size_group,
                               fill_connection,
@@ -345,7 +346,7 @@ nma_eap_fast_new (NMAWs *ws_parent,
        if (!parent)
                return NULL;
 
-       method = (NMAEapFAST *) parent;
+       method = (NMAEapFast *) parent;
        method->password_flags_name = NM_SETTING_802_1X_PASSWORD;
        method->sec_parent = ws_parent;
        method->is_editor = is_editor;
diff --git a/src/nma-ws/nma-eap-fast.h b/src/nma-ws/nma-eap-fast.h
index a1ece4df..3194ad1e 100644
--- a/src/nma-ws/nma-eap-fast.h
+++ b/src/nma-ws/nma-eap-fast.h
@@ -10,9 +10,9 @@
 
 #include "nma-ws.h"
 
-typedef struct _NMAEapFAST NMAEapFAST;
+typedef struct _NMAEapFast NMAEapFast;
 
-NMAEapFAST *nma_eap_fast_new (NMAWs *ws_parent,
+NMAEapFast *nma_eap_fast_new (NMAWs *ws_parent,
                               NMConnection *connection,
                               gboolean is_editor,
                               gboolean secrets_only);
diff --git a/src/nma-ws/nma-eap-leap.c b/src/nma-ws/nma-eap-leap.c
index 6d316edb..5a15804e 100644
--- a/src/nma-ws/nma-eap-leap.c
+++ b/src/nma-ws/nma-eap-leap.c
@@ -13,11 +13,12 @@
 
 #include "nma-eap.h"
 #include "nma-ws.h"
+#include "nma-ws-private.h"
 #include "helpers.h"
 #include "nma-ui-utils.h"
 #include "utils.h"
 
-struct _NMAEapLEAP {
+struct _NMAEapLeap {
        NMAEap parent;
 
        NMAWs *ws_parent;
@@ -31,7 +32,7 @@ struct _NMAEapLEAP {
 };
 
 static void
-show_toggled_cb (GtkToggleButton *button, NMAEapLEAP *method)
+show_toggled_cb (GtkToggleButton *button, NMAEapLeap *method)
 {
        gboolean visible;
 
@@ -42,7 +43,7 @@ show_toggled_cb (GtkToggleButton *button, NMAEapLEAP *method)
 static gboolean
 validate (NMAEap *parent, GError **error)
 {
-       NMAEapLEAP *method = (NMAEapLEAP *)parent;
+       NMAEapLeap *method = (NMAEapLeap *)parent;
        const char *text;
        gboolean ret = TRUE;
 
@@ -84,7 +85,7 @@ add_to_size_group (NMAEap *parent, GtkSizeGroup *group)
 static void
 fill_connection (NMAEap *parent, NMConnection *connection)
 {
-       NMAEapLEAP *method = (NMAEapLEAP *) parent;
+       NMAEapLeap *method = (NMAEapLeap *) parent;
        NMSetting8021x *s_8021x;
        NMSettingSecretFlags secret_flags;
        GtkWidget *passwd_entry;
@@ -126,8 +127,9 @@ update_secrets (NMAEap *parent, NMConnection *connection)
 /* Set the UI fields for user, password and show_password to the
  * values as provided by method->ws_parent. */
 static void
-set_userpass_ui (NMAEapLEAP *method)
+set_userpass_ui (NMAEapLeap *method)
 {
+#if 0
        if (method->ws_parent->username) {
                gtk_editable_set_text (GTK_EDITABLE (method->username_entry),
                                       method->ws_parent->username);
@@ -143,16 +145,20 @@ set_userpass_ui (NMAEapLEAP *method)
        }
 
        gtk_toggle_button_set_active (method->show_password, method->ws_parent->show_password);
+#else
+       gtk_editable_set_text (GTK_EDITABLE (method->username_entry), "");
+       gtk_editable_set_text (GTK_EDITABLE (method->password_entry), "");
+#endif
 }
 
 static void
-widgets_realized (GtkWidget *widget, NMAEapLEAP *method)
+widgets_realized (GtkWidget *widget, NMAEapLeap *method)
 {
        set_userpass_ui (method);
 }
 
 static void
-widgets_unrealized (GtkWidget *widget, NMAEapLEAP *method)
+widgets_unrealized (GtkWidget *widget, NMAEapLeap *method)
 {
        nma_ws_set_userpass (method->ws_parent,
                             gtk_editable_get_text (GTK_EDITABLE (method->username_entry)),
@@ -164,7 +170,7 @@ widgets_unrealized (GtkWidget *widget, NMAEapLEAP *method)
 static void
 destroy (NMAEap *parent)
 {
-       NMAEapLEAP *method = (NMAEapLEAP *) parent;
+       NMAEapLeap *method = (NMAEapLeap *) parent;
        GtkWidget *widget;
 
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_leap_notebook"));
@@ -176,17 +182,17 @@ destroy (NMAEap *parent)
        g_signal_handlers_disconnect_by_data (method->show_password, method);
 }
 
-NMAEapLEAP *
+NMAEapLeap *
 nma_eap_leap_new (NMAWs *ws_parent,
                      NMConnection *connection,
                      gboolean secrets_only)
 {
-       NMAEapLEAP *method;
+       NMAEapLeap *method;
        NMAEap *parent;
        GtkWidget *widget;
        NMSetting8021x *s_8021x = NULL;
 
-       parent = nma_eap_init (sizeof (NMAEapLEAP),
+       parent = nma_eap_init (sizeof (NMAEapLeap),
                               validate,
                               add_to_size_group,
                               fill_connection,
@@ -199,7 +205,7 @@ nma_eap_leap_new (NMAWs *ws_parent,
        if (!parent)
                return NULL;
 
-       method = (NMAEapLEAP *) parent;
+       method = (NMAEapLeap *) parent;
        method->password_flags_name = NM_SETTING_802_1X_PASSWORD;
        method->editing_connection = secrets_only ? FALSE : TRUE;
        method->ws_parent = ws_parent;
diff --git a/src/nma-ws/nma-eap-leap.h b/src/nma-ws/nma-eap-leap.h
index 738cf20a..00d7e9ea 100644
--- a/src/nma-ws/nma-eap-leap.h
+++ b/src/nma-ws/nma-eap-leap.h
@@ -10,9 +10,9 @@
 
 #include "nma-ws.h"
 
-typedef struct _NMAEapLEAP NMAEapLEAP;
+typedef struct _NMAEapLeap NMAEapLeap;
 
-NMAEapLEAP *nma_eap_leap_new (NMAWs *ws_parent,
+NMAEapLeap *nma_eap_leap_new (NMAWs *ws_parent,
                               NMConnection *connection,
                               gboolean secrets_only);
 
diff --git a/src/nma-ws/nma-eap-peap.c b/src/nma-ws/nma-eap-peap.c
index f89187c0..cd36f3f4 100644
--- a/src/nma-ws/nma-eap-peap.c
+++ b/src/nma-ws/nma-eap-peap.c
@@ -13,13 +13,14 @@
 
 #include "nma-eap.h"
 #include "nma-ws.h"
+#include "nma-ws-private.h"
 #include "nma-cert-chooser.h"
 #include "utils.h"
 
 #define I_NAME_COLUMN   0
 #define I_METHOD_COLUMN 1
 
-struct _NMAEapPEAP {
+struct _NMAEapPeap {
        NMAEap parent;
 
        const char *password_flags_name;
@@ -32,7 +33,7 @@ struct _NMAEapPEAP {
 static void
 destroy (NMAEap *parent)
 {
-       NMAEapPEAP *method = (NMAEapPEAP *) parent;
+       NMAEapPeap *method = (NMAEapPeap *) parent;
 
        if (method->size_group)
                g_object_unref (method->size_group);
@@ -41,7 +42,7 @@ destroy (NMAEap *parent)
 static gboolean
 validate (NMAEap *parent, GError **error)
 {
-       NMAEapPEAP *method = (NMAEapPEAP *) parent;
+       NMAEapPeap *method = (NMAEapPeap *) parent;
        GtkWidget *widget;
        GtkTreeModel *model;
        GtkTreeIter iter;
@@ -67,7 +68,7 @@ validate (NMAEap *parent, GError **error)
 static void
 ca_cert_not_required_toggled (GtkWidget *button, gpointer user_data)
 {
-       NMAEapPEAP *method = (NMAEapPEAP *) user_data;
+       NMAEapPeap *method = (NMAEapPeap *) user_data;
 
        gtk_widget_set_sensitive (method->ca_cert_chooser,
                                  !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)));
@@ -76,7 +77,7 @@ ca_cert_not_required_toggled (GtkWidget *button, gpointer user_data)
 static void
 add_to_size_group (NMAEap *parent, GtkSizeGroup *group)
 {
-       NMAEapPEAP *method = (NMAEapPEAP *) parent;
+       NMAEapPeap *method = (NMAEapPeap *) parent;
        GtkWidget *widget;
        GtkTreeModel *model;
        GtkTreeIter iter;
@@ -118,7 +119,7 @@ add_to_size_group (NMAEap *parent, GtkSizeGroup *group)
 static void
 fill_connection (NMAEap *parent, NMConnection *connection)
 {
-       NMAEapPEAP *method = (NMAEapPEAP *) parent;
+       NMAEapPeap *method = (NMAEapPeap *) parent;
        NMSetting8021x *s_8021x;
        NMSetting8021xCKFormat format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
        GtkWidget *widget;
@@ -210,7 +211,7 @@ static void
 inner_auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
 {
        NMAEap *parent = (NMAEap *) user_data;
-       NMAEapPEAP *method = (NMAEapPEAP *) parent;
+       NMAEapPeap *method = (NMAEapPeap *) parent;
        GtkWidget *vbox;
        NMAEap *eap = NULL;
        GList *elt, *children;
@@ -245,7 +246,7 @@ inner_auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
 }
 
 static GtkWidget *
-inner_auth_combo_init (NMAEapPEAP *method,
+inner_auth_combo_init (NMAEapPeap *method,
                        NMConnection *connection,
                        NMSetting8021x *s_8021x,
                        gboolean secrets_only)
@@ -346,19 +347,19 @@ update_secrets (NMAEap *parent, NMConnection *connection)
                                              I_METHOD_COLUMN);
 }
 
-NMAEapPEAP *
+NMAEapPeap *
 nma_eap_peap_new (NMAWs *ws_parent,
                   NMConnection *connection,
                   gboolean is_editor,
                   gboolean secrets_only)
 {
        NMAEap *parent;
-       NMAEapPEAP *method;
+       NMAEapPeap *method;
        GtkWidget *widget;
        NMSetting8021x *s_8021x = NULL;
        gboolean ca_not_required = FALSE;
 
-       parent = nma_eap_init (sizeof (NMAEapPEAP),
+       parent = nma_eap_init (sizeof (NMAEapPeap),
                               validate,
                               add_to_size_group,
                               fill_connection,
@@ -371,7 +372,7 @@ nma_eap_peap_new (NMAWs *ws_parent,
        if (!parent)
                return NULL;
 
-       method = (NMAEapPEAP *) parent;
+       method = (NMAEapPeap *) parent;
        method->password_flags_name = NM_SETTING_802_1X_PASSWORD;
        method->sec_parent = ws_parent;
        method->is_editor = is_editor;
diff --git a/src/nma-ws/nma-eap-peap.h b/src/nma-ws/nma-eap-peap.h
index 8f4d88bd..36566c5d 100644
--- a/src/nma-ws/nma-eap-peap.h
+++ b/src/nma-ws/nma-eap-peap.h
@@ -10,9 +10,9 @@
 
 #include "nma-ws.h"
 
-typedef struct _NMAEapPEAP NMAEapPEAP;
+typedef struct _NMAEapPeap NMAEapPeap;
 
-NMAEapPEAP *nma_eap_peap_new (NMAWs *ws_parent,
+NMAEapPeap *nma_eap_peap_new (NMAWs *ws_parent,
                               NMConnection *connection,
                               gboolean is_editor,
                               gboolean secrets_only);
diff --git a/src/nma-ws/nma-eap-simple.c b/src/nma-ws/nma-eap-simple.c
index d5f90c52..c633ac5f 100644
--- a/src/nma-ws/nma-eap-simple.c
+++ b/src/nma-ws/nma-eap-simple.c
@@ -13,6 +13,7 @@
 
 #include "nma-eap.h"
 #include "nma-ws.h"
+#include "nma-ws-private.h"
 #include "helpers.h"
 #include "nma-ui-utils.h"
 #include "utils.h"
@@ -285,6 +286,8 @@ password_storage_changed (GObject *entry,
 static void
 set_userpass_ui (NMAEapSimple *method)
 {
+#if 0
+XXX
        if (method->ws_parent->username) {
                gtk_editable_set_text (GTK_EDITABLE (method->username_entry),
                                       method->ws_parent->username);
@@ -300,6 +303,11 @@ set_userpass_ui (NMAEapSimple *method)
        }
 
        gtk_toggle_button_set_active (method->show_password, method->ws_parent->show_password);
+#else
+       gtk_editable_set_text (GTK_EDITABLE (method->username_entry), "");
+       gtk_editable_set_text (GTK_EDITABLE (method->password_entry), "");
+#endif
+
        password_storage_changed (NULL, NULL, method);
 }
 
diff --git a/src/nma-ws/nma-eap-tls.c b/src/nma-ws/nma-eap-tls.c
index 295fdbb9..31831fc6 100644
--- a/src/nma-ws/nma-eap-tls.c
+++ b/src/nma-ws/nma-eap-tls.c
@@ -14,12 +14,13 @@
 
 #include "nma-eap.h"
 #include "nma-ws.h"
+#include "nma-ws-private.h"
 #include "helpers.h"
 #include "nma-ui-utils.h"
 #include "nma-cert-chooser.h"
 #include "utils.h"
 
-struct _NMAEapTLS {
+struct _NMAEapTls {
        NMAEap parent;
 
 #if LIBNM_BUILD
@@ -38,7 +39,7 @@ struct _NMAEapTLS {
 static gboolean
 validate (NMAEap *parent, GError **error)
 {
-       NMAEapTLS *method = (NMAEapTLS *) parent;
+       NMAEapTls *method = (NMAEapTls *) parent;
        GtkWidget *widget;
        const char *identity;
 
@@ -66,7 +67,7 @@ validate (NMAEap *parent, GError **error)
 static void
 ca_cert_not_required_toggled (GtkWidget *button, gpointer user_data)
 {
-       NMAEapTLS *method = (NMAEapTLS *) user_data;
+       NMAEapTls *method = (NMAEapTls *) user_data;
 
        gtk_widget_set_sensitive (method->ca_cert_chooser,
                                  !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)));
@@ -75,7 +76,7 @@ ca_cert_not_required_toggled (GtkWidget *button, gpointer user_data)
 static void
 add_to_size_group (NMAEap *parent, GtkSizeGroup *group)
 {
-       NMAEapTLS *method = (NMAEapTLS *) parent;
+       NMAEapTls *method = (NMAEapTls *) parent;
        GtkWidget *widget;
 
        widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_identity_label"));
@@ -93,7 +94,7 @@ add_to_size_group (NMAEap *parent, GtkSizeGroup *group)
 static void
 fill_connection (NMAEap *parent, NMConnection *connection)
 {
-       NMAEapTLS *method = (NMAEapTLS *) parent;
+       NMAEapTls *method = (NMAEapTls *) parent;
        NMSetting8021xCKFormat format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
        NMSetting8021x *s_8021x;
        NMSettingSecretFlags secret_flags;
@@ -326,7 +327,7 @@ client_cert_fixup_pkcs12 (NMACertChooser *cert_chooser, gpointer user_data)
 static void
 update_secrets (NMAEap *parent, NMConnection *connection)
 {
-       NMAEapTLS *method = (NMAEapTLS *) parent;
+       NMAEapTls *method = (NMAEapTls *) parent;
 
        nma_eap_setup_cert_chooser (NMA_CERT_CHOOSER (method->client_cert_chooser),
                                    nm_connection_get_setting_802_1x (connection),
@@ -340,19 +341,19 @@ update_secrets (NMAEap *parent, NMConnection *connection)
                                    parent->phase2 ? nm_setting_802_1x_get_phase2_private_key_password : 
nm_setting_802_1x_get_private_key_password);
 }
 
-NMAEapTLS *
+NMAEapTls *
 nma_eap_tls_new (NMAWs *ws_parent,
                  NMConnection *connection,
                  gboolean phase2,
                  gboolean secrets_only)
 {
-       NMAEapTLS *method;
+       NMAEapTls *method;
        NMAEap *parent;
        GtkWidget *widget;
        NMSetting8021x *s_8021x = NULL;
        gboolean ca_not_required = FALSE;
 
-       parent = nma_eap_init (sizeof (NMAEapTLS),
+       parent = nma_eap_init (sizeof (NMAEapTls),
                               validate,
                               add_to_size_group,
                               fill_connection,
@@ -365,7 +366,7 @@ nma_eap_tls_new (NMAWs *ws_parent,
        if (!parent)
                return NULL;
 
-       method = (NMAEapTLS *) parent;
+       method = (NMAEapTls *) parent;
 #if LIBNM_BUILD
 /* libnm-glib doesn't support these. */
        method->ca_cert_password_flags_name = phase2
diff --git a/src/nma-ws/nma-eap-tls.h b/src/nma-ws/nma-eap-tls.h
index 105e0426..fe060958 100644
--- a/src/nma-ws/nma-eap-tls.h
+++ b/src/nma-ws/nma-eap-tls.h
@@ -10,9 +10,9 @@
 
 #include "nma-ws.h"
 
-typedef struct _NMAEapTLS NMAEapTLS;
+typedef struct _NMAEapTls NMAEapTls;
 
-NMAEapTLS *nma_eap_tls_new (NMAWs *ws_parent,
+NMAEapTls *nma_eap_tls_new (NMAWs *ws_parent,
                             NMConnection *connection,
                             gboolean phase2,
                             gboolean secrets_only);
diff --git a/src/nma-ws/nma-eap-ttls.c b/src/nma-ws/nma-eap-ttls.c
index 6f975d10..c496c971 100644
--- a/src/nma-ws/nma-eap-ttls.c
+++ b/src/nma-ws/nma-eap-ttls.c
@@ -13,13 +13,14 @@
 
 #include "nma-eap.h"
 #include "nma-ws.h"
+#include "nma-ws-private.h"
 #include "nma-cert-chooser.h"
 #include "utils.h"
 
 #define I_NAME_COLUMN   0
 #define I_METHOD_COLUMN 1
 
-struct _NMAEapTTLS {
+struct _NMAEapTtls {
        NMAEap parent;
 
        const char *password_flags_name;
@@ -33,7 +34,7 @@ struct _NMAEapTTLS {
 static void
 destroy (NMAEap *parent)
 {
-       NMAEapTTLS *method = (NMAEapTTLS *) parent;
+       NMAEapTtls *method = (NMAEapTtls *) parent;
 
        if (method->size_group)
                g_object_unref (method->size_group);
@@ -42,7 +43,7 @@ destroy (NMAEap *parent)
 static gboolean
 validate (NMAEap *parent, GError **error)
 {
-       NMAEapTTLS *method = (NMAEapTTLS *) parent;
+       NMAEapTtls *method = (NMAEapTtls *) parent;
        GtkWidget *widget;
        GtkTreeModel *model;
        GtkTreeIter iter;
@@ -68,7 +69,7 @@ validate (NMAEap *parent, GError **error)
 static void
 ca_cert_not_required_toggled (GtkWidget *button, gpointer user_data)
 {
-       NMAEapTTLS *method = (NMAEapTTLS *) user_data;
+       NMAEapTtls *method = (NMAEapTtls *) user_data;
 
        gtk_widget_set_sensitive (method->ca_cert_chooser,
                                  !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)));
@@ -77,7 +78,7 @@ ca_cert_not_required_toggled (GtkWidget *button, gpointer user_data)
 static void
 add_to_size_group (NMAEap *parent, GtkSizeGroup *group)
 {
-       NMAEapTTLS *method = (NMAEapTTLS *) parent;
+       NMAEapTtls *method = (NMAEapTtls *) parent;
        GtkWidget *widget;
        GtkTreeModel *model;
        GtkTreeIter iter;
@@ -115,7 +116,7 @@ add_to_size_group (NMAEap *parent, GtkSizeGroup *group)
 static void
 fill_connection (NMAEap *parent, NMConnection *connection)
 {
-       NMAEapTTLS *method = (NMAEapTTLS *) parent;
+       NMAEapTtls *method = (NMAEapTtls *) parent;
        NMSetting8021x *s_8021x;
        NMSetting8021xCKFormat format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
 #if LIBNM_BUILD
@@ -193,7 +194,7 @@ static void
 inner_auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
 {
        NMAEap *parent = (NMAEap *) user_data;
-       NMAEapTTLS *method = (NMAEapTTLS *) parent;
+       NMAEapTtls *method = (NMAEapTtls *) parent;
        GtkWidget *vbox;
        NMAEap *eap = NULL;
        GList *elt, *children;
@@ -229,7 +230,7 @@ inner_auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
 }
 
 static GtkWidget *
-inner_auth_combo_init (NMAEapTTLS *method,
+inner_auth_combo_init (NMAEapTtls *method,
                        NMConnection *connection,
                        NMSetting8021x *s_8021x,
                        gboolean secrets_only)
@@ -400,19 +401,19 @@ update_secrets (NMAEap *parent, NMConnection *connection)
                                              I_METHOD_COLUMN);
 }
 
-NMAEapTTLS *
+NMAEapTtls *
 nma_eap_ttls_new (NMAWs *ws_parent,
                      NMConnection *connection,
                      gboolean is_editor,
                      gboolean secrets_only)
 {
        NMAEap *parent;
-       NMAEapTTLS *method;
+       NMAEapTtls *method;
        GtkWidget *widget;
        NMSetting8021x *s_8021x = NULL;
        gboolean ca_not_required = FALSE;
 
-       parent = nma_eap_init (sizeof (NMAEapTTLS),
+       parent = nma_eap_init (sizeof (NMAEapTtls),
                               validate,
                               add_to_size_group,
                               fill_connection,
@@ -425,7 +426,7 @@ nma_eap_ttls_new (NMAWs *ws_parent,
        if (!parent)
                return NULL;
 
-       method = (NMAEapTTLS *) parent;
+       method = (NMAEapTtls *) parent;
        method->password_flags_name = NM_SETTING_802_1X_PASSWORD;
        method->sec_parent = ws_parent;
        method->is_editor = is_editor;
diff --git a/src/nma-ws/nma-eap-ttls.h b/src/nma-ws/nma-eap-ttls.h
index 034ad3e4..0b761a44 100644
--- a/src/nma-ws/nma-eap-ttls.h
+++ b/src/nma-ws/nma-eap-ttls.h
@@ -10,9 +10,9 @@
 
 #include "nma-ws.h"
 
-typedef struct _NMAEapTTLS NMAEapTTLS;
+typedef struct _NMAEapTtls NMAEapTtls;
 
-NMAEapTTLS *nma_eap_ttls_new (NMAWs *ws_parent,
+NMAEapTtls *nma_eap_ttls_new (NMAWs *ws_parent,
                               NMConnection *connection,
                               gboolean is_editor,
                               gboolean secrets_only);
diff --git a/src/nma-ws/nma-ws-802-1x-private.h b/src/nma-ws/nma-ws-802-1x-private.h
new file mode 100644
index 00000000..59a4d5fe
--- /dev/null
+++ b/src/nma-ws/nma-ws-802-1x-private.h
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2007 - 2019 Red Hat, Inc.
+ */
+
+#ifndef NMA_WS_802_1X_PRIVATE_H
+#define NMA_WS_802_1X_PRIVATE_H
+
+struct _NMAWs8021xClass {
+       GtkGridClass parent;
+};
+
+struct _NMAWs8021x {
+       GtkGrid parent;
+
+       GtkWidget *eap_auth_combo;
+       GtkWidget *eap_auth_label;
+       GtkWidget *eap_vbox;
+
+       NMConnection *connection;
+       gboolean secrets_only;
+
+       // XXX props!
+       gboolean is_editor;
+       const char **secrets_hints;
+};
+
+void nma_ws_802_1x_fill_connection (NMAWs *parent, NMConnection *connection);
+
+#endif /* NMA_WS_802_1X_PRIVATE_H */
diff --git a/src/nma-ws/nma-ws-802-1x.c b/src/nma-ws/nma-ws-802-1x.c
new file mode 100644
index 00000000..bf790c85
--- /dev/null
+++ b/src/nma-ws/nma-ws-802-1x.c
@@ -0,0 +1,497 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2007 - 2019 Red Hat, Inc.
+ */
+
+#include "nm-default.h"
+#include "nma-private.h"
+
+#include <ctype.h>
+#include <string.h>
+
+#include "nma-ws.h"
+#include "nma-ws-private.h"
+#include "nma-ws-802-1x.h"
+#include "nma-ws-802-1x-private.h"
+#include "nma-ws-helpers.h"
+#include "nma-ui-utils.h"
+
+#include "nma-eap-tls.h"
+#include "nma-eap-leap.h"
+#include "nma-eap-fast.h"
+#include "nma-eap-ttls.h"
+#include "nma-eap-peap.h"
+#include "nma-eap-simple.h"
+#include "nma-eap.h"
+
+#include "utils.h"
+
+#define AUTH_NAME_COLUMN   0
+#define AUTH_METHOD_COLUMN 1
+
+static void nma_ws_interface_init (NMAWsInterface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (NMAWs8021x, nma_ws_802_1x, GTK_TYPE_GRID,
+                         G_IMPLEMENT_INTERFACE (NMA_TYPE_WS, nma_ws_interface_init))
+
+enum {
+       PROP_0,
+       PROP_CONNECTION,
+       PROP_SECRETS_ONLY,
+       PROP_LAST
+};
+
+#if 0
+void
+nma_ws_set_userpass (NMAWs *sec,
+                     const char *user,
+                     const char *password,
+                     gboolean always_ask,
+                     gboolean show_password)
+{
+       g_free (sec->username);
+       sec->username = g_strdup (user);
+
+       if (sec->password) {
+               memset (sec->password, 0, strlen (sec->password));
+               g_free (sec->password);
+       }
+       sec->password = g_strdup (password);
+
+       if (always_ask != (gboolean) -1)
+               sec->always_ask = always_ask;
+       sec->show_password = show_password;
+}
+
+void
+nma_ws_set_userpass_802_1x (NMAWs *sec,
+                            NMConnection *connection)
+{
+       const char *user = NULL, *password = NULL;
+       gboolean always_ask = FALSE, show_password = FALSE;
+       NMSetting8021x  *setting;
+       NMSettingSecretFlags flags;
+
+       if (!connection)
+               goto set;
+
+       setting = nm_connection_get_setting_802_1x (connection);
+       if (!setting)
+               goto set;
+
+       user = nm_setting_802_1x_get_identity (setting);
+       password = nm_setting_802_1x_get_password (setting);
+
+       if (nm_setting_get_secret_flags (NM_SETTING (setting), NM_SETTING_802_1X_PASSWORD, &flags, NULL))
+               always_ask = !!(flags & NM_SETTING_SECRET_FLAG_NOT_SAVED);
+
+set:
+       nma_ws_set_userpass (sec, user, password, always_ask, show_password);
+}
+#endif
+
+static gboolean
+validate (NMAWs *parent, GError **error)
+{
+       NMAWs8021x *sec = NMA_WS_802_1X (parent);
+       GtkTreeModel *model;
+       GtkTreeIter iter;
+       NMAEap *eap = NULL;
+       gboolean valid = FALSE;
+
+       model = gtk_combo_box_get_model (GTK_COMBO_BOX (sec->eap_auth_combo));
+       gtk_combo_box_get_active_iter (GTK_COMBO_BOX (sec->eap_auth_combo), &iter);
+       gtk_tree_model_get (model, &iter, AUTH_METHOD_COLUMN, &eap, -1);
+       g_assert (eap);
+       valid = nma_eap_validate (eap, error);
+       nma_eap_unref (eap);
+       return valid;
+}
+
+static void
+auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
+{
+       NMAWs8021x *sec = NMA_WS_802_1X (user_data);
+
+       NMAEap *eap = NULL;
+       GList *elt, *children;
+       GtkTreeModel *model;
+       GtkTreeIter iter;
+       GtkWidget *eap_widget;
+       GtkWidget *eap_default_widget = NULL;
+
+       /* Remove any previous wireless security widgets */
+       children = gtk_container_get_children (GTK_CONTAINER (sec->eap_vbox));
+       for (elt = children; elt; elt = g_list_next (elt))
+               gtk_container_remove (GTK_CONTAINER (sec->eap_vbox), GTK_WIDGET (elt->data));
+
+       model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
+       gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter);
+       gtk_tree_model_get (model, &iter, AUTH_METHOD_COLUMN, &eap, -1);
+       g_assert (eap);
+
+       eap_widget = nma_eap_get_widget (eap);
+       g_assert (eap_widget);
+       gtk_widget_unparent (eap_widget);
+
+       gtk_container_add (GTK_CONTAINER (sec->eap_vbox), eap_widget);
+
+       /* Refocus the EAP method's default widget */
+       if (eap->default_field) {
+               eap_default_widget = GTK_WIDGET (gtk_builder_get_object (eap->builder, eap->default_field));
+               if (eap_default_widget)
+                       gtk_widget_grab_focus (eap_default_widget);
+       }
+
+       nma_eap_unref (eap);
+
+       nma_ws_changed_cb (combo, NMA_WS (sec));
+}
+
+static void
+add_to_size_group (NMAWs *parent, GtkSizeGroup *group)
+{
+       NMAWs8021x *sec = NMA_WS_802_1X (parent);
+       NMAEap *eap = NULL;
+       GtkTreeModel *model;
+       GtkTreeIter iter;
+
+       model = gtk_combo_box_get_model (GTK_COMBO_BOX (sec->eap_auth_combo));
+
+       /* Let each EAP method try to update its secrets */
+       if (gtk_tree_model_get_iter_first (model, &iter)) {
+               do {
+                       gtk_tree_model_get (model, &iter, AUTH_METHOD_COLUMN, &eap, -1);
+                       if (eap) {
+                               nma_eap_add_to_size_group (eap, group);
+                               nma_eap_unref (eap);
+                       }
+               } while (gtk_tree_model_iter_next (model, &iter));
+       }
+
+       gtk_size_group_add_widget (group, sec->eap_auth_label);
+}
+
+void
+nma_ws_802_1x_fill_connection (NMAWs *parent, NMConnection *connection)
+{
+       NMAWs8021x *sec = NMA_WS_802_1X (parent);
+       NMSettingWirelessSecurity *s_wireless_sec;
+       NMSetting8021x *s_8021x;
+       NMAEap *eap = NULL;
+       GtkTreeModel *model;
+       GtkTreeIter iter;
+
+       /* Get the NMAEap object */
+       model = gtk_combo_box_get_model (GTK_COMBO_BOX (sec->eap_auth_combo));
+       gtk_combo_box_get_active_iter (GTK_COMBO_BOX (sec->eap_auth_combo), &iter);
+       gtk_tree_model_get (model, &iter, AUTH_METHOD_COLUMN, &eap, -1);
+       g_assert (eap);
+
+       /* Blow away the old wireless security setting by adding a clear one */
+       s_wireless_sec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
+       nm_connection_add_setting (connection, (NMSetting *) s_wireless_sec);
+
+       /* Blow away the old 802.1x setting by adding a clear one */
+       s_8021x = (NMSetting8021x *) nm_setting_802_1x_new ();
+       nm_connection_add_setting (connection, (NMSetting *) s_8021x);
+
+       nma_eap_fill_connection (eap, connection);
+       nma_eap_unref (eap);
+}
+
+static void
+update_secrets (NMAWs *parent, NMConnection *connection)
+{
+       NMAWs8021x *sec = NMA_WS_802_1X (parent);
+       NMAEap *eap = NULL;
+       GtkTreeModel *model;
+       GtkTreeIter iter;
+
+       g_return_if_fail (connection != NULL);
+
+       model = gtk_combo_box_get_model (GTK_COMBO_BOX (sec->eap_auth_combo));
+
+       /* Let each EAP method try to update its secrets */
+       if (gtk_tree_model_get_iter_first (model, &iter)) {
+               do {
+                       gtk_tree_model_get (model, &iter, AUTH_METHOD_COLUMN, &eap, -1);
+                       if (eap) {
+                               nma_eap_update_secrets (eap, connection);
+                               nma_eap_unref (eap);
+                       }
+               } while (gtk_tree_model_iter_next (model, &iter));
+       }
+}
+
+static void
+get_property (GObject *object,
+              guint prop_id,
+              GValue *value,
+              GParamSpec *pspec)
+{
+       NMAWs8021x *sec = NMA_WS_802_1X (object);
+
+       switch (prop_id) {
+       case PROP_CONNECTION:
+               g_value_set_object (value, sec->connection);
+               break;
+       case PROP_SECRETS_ONLY:
+               g_value_set_boolean (value, sec->secrets_only);
+               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)
+{
+       NMAWs8021x *sec = NMA_WS_802_1X (object);
+
+       switch (prop_id) {
+       case PROP_CONNECTION:
+               sec->connection = g_value_dup_object (value);
+               break;
+       case PROP_SECRETS_ONLY:
+               sec->secrets_only = g_value_get_boolean (value);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+nma_ws_802_1x_init (NMAWs8021x *sec)
+{
+       gtk_widget_init_template (GTK_WIDGET (sec));
+}
+
+static void
+nma_ws_interface_init (NMAWsInterface *iface)
+{
+       iface->validate = validate;
+       iface->add_to_size_group = add_to_size_group;
+       iface->fill_connection = nma_ws_802_1x_fill_connection;
+       iface->update_secrets = update_secrets;
+       iface->adhoc_compatible = FALSE;
+       iface->hotspot_compatible = FALSE;
+}
+
+static void
+constructed (GObject *object)
+{
+       NMAWs8021x *sec = NMA_WS_802_1X (object);
+       GtkListStore *auth_model;
+       GtkTreeIter iter;
+       NMAEapSimple *em_md5;
+       NMAEapTls *em_tls;
+       NMAEapLeap *em_leap;
+       NMAEapSimple *em_pwd;
+       NMAEapFast *em_fast;
+       NMAEapTtls *em_ttls;
+       NMAEapPeap *em_peap;
+       const char *default_method = NULL, *ctype = NULL;
+       int active = -1, item = 0;
+       gboolean wired = FALSE;
+       NMAEapSimpleFlags simple_flags = NMA_EAP_SIMPLE_FLAG_NONE;
+
+       /* Grab the default EAP method out of the security object */
+       if (sec->connection) {
+               NMSettingConnection *s_con;
+               NMSetting8021x *s_8021x;
+
+               s_con = nm_connection_get_setting_connection (sec->connection);
+               if (s_con)
+                       ctype = nm_setting_connection_get_connection_type (s_con);
+               if (   (g_strcmp0 (ctype, NM_SETTING_WIRED_SETTING_NAME) == 0)
+                   || nm_connection_get_setting_wired (sec->connection))
+                       wired = TRUE;
+
+               s_8021x = nm_connection_get_setting_802_1x (sec->connection);
+               if (s_8021x && nm_setting_802_1x_get_num_eap_methods (s_8021x))
+                       default_method = nm_setting_802_1x_get_eap_method (s_8021x, 0);
+       }
+
+       /* initialize NMAWs userpass from connection (clear if no connection) */
+       // XXX
+       nma_ws_set_userpass_802_1x (NMA_WS (sec), sec->connection);
+
+       auth_model = gtk_list_store_new (2, G_TYPE_STRING, nma_eap_get_type ());
+
+       // XXX
+       if (sec->is_editor)
+               simple_flags |= NMA_EAP_SIMPLE_FLAG_IS_EDITOR;
+       if (sec->secrets_only)
+               simple_flags |= NMA_EAP_SIMPLE_FLAG_SECRETS_ONLY;
+
+       if (wired) {
+               em_md5 = nma_eap_simple_new (NMA_WS (sec), sec->connection, NMA_EAP_SIMPLE_TYPE_MD5, 
simple_flags, NULL);
+               gtk_list_store_append (auth_model, &iter);
+               gtk_list_store_set (auth_model, &iter,
+                                   AUTH_NAME_COLUMN, _("MD5"),
+                                   AUTH_METHOD_COLUMN, em_md5,
+                                   -1);
+               nma_eap_unref (NMA_EAP (em_md5));
+               if (default_method && (active < 0) && !strcmp (default_method, "md5"))
+                       active = item;
+               item++;
+       }
+
+       em_tls = nma_eap_tls_new (NMA_WS (sec), sec->connection, FALSE, sec->secrets_only);
+       gtk_list_store_append (auth_model, &iter);
+       gtk_list_store_set (auth_model, &iter,
+                           AUTH_NAME_COLUMN, _("TLS"),
+                           AUTH_METHOD_COLUMN, em_tls,
+                           -1);
+       nma_eap_unref (NMA_EAP (em_tls));
+       if (default_method && (active < 0) && !strcmp (default_method, "tls"))
+               active = item;
+       item++;
+
+       if (!wired) {
+               em_leap = nma_eap_leap_new (NMA_WS (sec), sec->connection, sec->secrets_only);
+               gtk_list_store_append (auth_model, &iter);
+               gtk_list_store_set (auth_model, &iter,
+                                   AUTH_NAME_COLUMN, _("LEAP"),
+                                   AUTH_METHOD_COLUMN, em_leap,
+                                   -1);
+               nma_eap_unref (NMA_EAP (em_leap));
+               if (default_method && (active < 0) && !strcmp (default_method, "leap"))
+                       active = item;
+               item++;
+       }
+
+       em_pwd = nma_eap_simple_new (NMA_WS (sec), sec->connection, NMA_EAP_SIMPLE_TYPE_PWD, simple_flags, 
NULL);
+       gtk_list_store_append (auth_model, &iter);
+       gtk_list_store_set (auth_model, &iter,
+                           AUTH_NAME_COLUMN, _("PWD"),
+                           AUTH_METHOD_COLUMN, em_pwd,
+                           -1);
+       nma_eap_unref (NMA_EAP (em_pwd));
+       if (default_method && (active < 0) && !strcmp (default_method, "pwd"))
+               active = item;
+       item++;
+
+       em_fast = nma_eap_fast_new (NMA_WS (sec), sec->connection, sec->is_editor, sec->secrets_only);
+       gtk_list_store_append (auth_model, &iter);
+       gtk_list_store_set (auth_model, &iter,
+                           AUTH_NAME_COLUMN, _("FAST"),
+                           AUTH_METHOD_COLUMN, em_fast,
+                           -1);
+       nma_eap_unref (NMA_EAP (em_fast));
+       if (default_method && (active < 0) && !strcmp (default_method, "fast"))
+               active = item;
+       item++;
+
+       em_ttls = nma_eap_ttls_new (NMA_WS (sec), sec->connection, sec->is_editor, sec->secrets_only);
+       gtk_list_store_append (auth_model, &iter);
+       gtk_list_store_set (auth_model, &iter,
+                           AUTH_NAME_COLUMN, _("Tunneled TLS"),
+                           AUTH_METHOD_COLUMN, em_ttls,
+                           -1);
+       nma_eap_unref (NMA_EAP (em_ttls));
+       if (default_method && (active < 0) && !strcmp (default_method, "ttls"))
+               active = item;
+       item++;
+
+       em_peap = nma_eap_peap_new (NMA_WS (sec), sec->connection, sec->is_editor, sec->secrets_only);
+       gtk_list_store_append (auth_model, &iter);
+       gtk_list_store_set (auth_model, &iter,
+                           AUTH_NAME_COLUMN, _("Protected EAP (PEAP)"),
+                           AUTH_METHOD_COLUMN, em_peap,
+                           -1);
+       nma_eap_unref (NMA_EAP (em_peap));
+       if (default_method && (active < 0) && !strcmp (default_method, "peap"))
+               active = item;
+       item++;
+
+       if (sec->secrets_hints && sec->secrets_hints[0]) {
+               NMAEapSimple *em_hints;
+
+               em_hints = nma_eap_simple_new (NMA_WS (sec), sec->connection, NMA_EAP_SIMPLE_TYPE_UNKNOWN,
+                                                 simple_flags, sec->secrets_hints);
+               gtk_list_store_append (auth_model, &iter);
+               gtk_list_store_set (auth_model, &iter,
+                                   AUTH_NAME_COLUMN, _("Unknown"),
+                                   AUTH_METHOD_COLUMN, em_hints,
+                                   -1);
+               nma_eap_unref (NMA_EAP (em_hints));
+               active = item;
+               item++;
+       } else if (default_method && !strcmp (default_method, "external")) {
+               NMAEapSimple *em_extern;
+               const char *empty_hints[] = { NULL };
+
+               em_extern = nma_eap_simple_new (NMA_WS (sec), sec->connection, NMA_EAP_SIMPLE_TYPE_UNKNOWN,
+                                                  simple_flags, empty_hints);
+               gtk_list_store_append (auth_model, &iter);
+               gtk_list_store_set (auth_model, &iter,
+                                   AUTH_NAME_COLUMN, _("Externally configured"),
+                                   AUTH_METHOD_COLUMN, em_extern,
+                                   -1);
+               nma_eap_unref (NMA_EAP (em_extern));
+                       active = item;
+               item++;
+       }
+
+       gtk_combo_box_set_model (GTK_COMBO_BOX (sec->eap_auth_combo), GTK_TREE_MODEL (auth_model));
+       g_object_unref (G_OBJECT (auth_model));
+       gtk_combo_box_set_active (GTK_COMBO_BOX (sec->eap_auth_combo), active < 0 ? 0 : (guint32) active);
+
+       if (sec->secrets_only) {
+               gtk_widget_hide (sec->eap_auth_combo);
+               gtk_widget_hide (sec->eap_auth_label);
+       }
+
+       G_OBJECT_CLASS (nma_ws_802_1x_parent_class)->constructed (object);
+}
+
+NMAWs8021x *
+nma_ws_802_1x_new (NMConnection *connection, gboolean secrets_only)
+{
+       return g_object_new (NMA_TYPE_WS_802_1X,
+                            "connection", connection,
+                            "secrets-only", secrets_only,
+                            NULL);
+}
+
+static void
+dispose (GObject *object)
+{
+       NMAWs8021x *sec = NMA_WS_802_1X (object);
+
+       g_clear_object (&sec->connection);
+}
+
+static void
+nma_ws_802_1x_class_init (NMAWs8021xClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+       object_class->get_property = get_property;
+       object_class->set_property = set_property;
+       object_class->constructed = constructed;
+       object_class->dispose = dispose;
+
+       g_object_class_override_property (object_class,
+                                         PROP_CONNECTION, "connection");
+
+       g_object_class_override_property (object_class,
+                                         PROP_SECRETS_ONLY, "secrets-only");
+
+        gtk_widget_class_set_template_from_resource (widget_class,
+                                                     "/org/gnome/libnma/nma-ws-802-1x.ui");
+
+       gtk_widget_class_bind_template_child (widget_class, NMAWs8021x, eap_auth_combo);
+       gtk_widget_class_bind_template_child (widget_class, NMAWs8021x, eap_auth_label);
+       gtk_widget_class_bind_template_child (widget_class, NMAWs8021x, eap_vbox);
+
+       gtk_widget_class_bind_template_callback (widget_class, auth_combo_changed_cb);
+}
diff --git a/src/nma-ws/nma-ws-802-1x.h b/src/nma-ws/nma-ws-802-1x.h
new file mode 100644
index 00000000..e9964b4b
--- /dev/null
+++ b/src/nma-ws/nma-ws-802-1x.h
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2007 - 2019 Red Hat, Inc.
+ */
+
+#ifndef NMA_WS_802_1X_H
+#define NMA_WS_802_1X_H
+
+typedef struct _NMAWs8021xClass NMAWs8021xClass;
+typedef struct _NMAWs8021x NMAWs8021x;
+
+#define NMA_TYPE_WS_802_1X            (nma_ws_802_1x_get_type ())
+#define NMA_WS_802_1X(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMA_TYPE_WS_802_1X, NMAWs8021x))
+#define NMA_WS_802_1X_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NMA_TYPE_WS_802_1X, 
NMAWs8021xClass))
+#define NMA_IS_WS_802_1X(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMA_TYPE_WS_802_1X))
+#define NMA_IS_WS_802_1X_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NMA_TYPE_WS_802_1X))
+#define NMA_WS_802_1X_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NMA_TYPE_WS_802_1X, 
NMAWs8021xClass))
+
+GType nma_ws_802_1x_get_type (void);
+
+NMAWs8021x *nma_ws_802_1x_new (NMConnection *connection, gboolean secrets_only);
+
+#endif /* NMA_WS_802_1X_H */
diff --git a/src/nma-ws/nma-ws-802-1x.ui b/src/nma-ws/nma-ws-802-1x.ui
new file mode 100644
index 00000000..74233203
--- /dev/null
+++ b/src/nma-ws/nma-ws-802-1x.ui
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="nm-applet">
+  <requires lib="gtk+" version="3.10"/>
+  <object class="GtkListStore" id="model5">
+    <columns>
+      <!-- column-name gchararray -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0"> </col>
+      </row>
+    </data>
+  </object>
+  <template class="NMAWs8021x" parent="GtkGrid">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="row_spacing">6</property>
+    <property name="column_spacing">6</property>
+    <child>
+      <object class="GtkLabel" id="eap_auth_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Au_thentication</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">eap_auth_combo</property>
+        <property name="xalign">1</property>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkComboBox" id="eap_auth_combo">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="model">model5</property>
+        <child>
+          <object class="GtkCellRendererText" id="renderer5"/>
+          <attributes>
+            <attribute name="text">0</attribute>
+          </attributes>
+        </child>
+        <signal name="changed" handler="auth_combo_changed_cb" swapped="no"/>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkBox" id="eap_vbox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">6</property>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">1</property>
+        <property name="width">2</property>
+      </packing>
+    </child>
+  </template>
+</interface>
diff --git a/src/nma-ws/nma-ws-dynamic-wep.c b/src/nma-ws/nma-ws-dynamic-wep.c
index 95f27b53..bc2f7a23 100644
--- a/src/nma-ws/nma-ws-dynamic-wep.c
+++ b/src/nma-ws/nma-ws-dynamic-wep.c
@@ -4,57 +4,34 @@
  *
  * Copyright 2007 - 2019 Red Hat, Inc.
  */
-
 #include "nm-default.h"
-
-#include <ctype.h>
-#include <string.h>
+#include "nma-private.h"
 
 #include "nma-ws.h"
-#include "nma-eap.h"
+#include "nma-ws-private.h"
+#include "nma-ws-802-1x.h"
+#include "nma-ws-802-1x-private.h"
+#include "nma-ws-dynamic-wep.h"
 
-struct _NMAWsDynamicWEP {
-       NMAWs parent;
+typedef struct {
+       NMAWs8021xClass parent;
+} NMAWsDynamicWepClass;
 
-       GtkSizeGroup *size_group;
+struct _NMAWsDynamicWep {
+       NMAWs8021x parent;
 };
 
-static void
-destroy (NMAWs *parent)
-{
-       NMAWsDynamicWEP *sec = (NMAWsDynamicWEP *) parent;
+static void nma_ws_interface_init (NMAWsInterface *iface);
 
-       if (sec->size_group)
-               g_object_unref (sec->size_group);
-}
-
-static gboolean
-validate (NMAWs *parent, GError **error)
-{
-       return nma_ws_802_1x_validate (parent, "dynamic_wep_auth_combo", error);
-}
-
-static void
-add_to_size_group (NMAWs *parent, GtkSizeGroup *group)
-{
-       NMAWsDynamicWEP *sec = (NMAWsDynamicWEP *) parent;
-
-       if (sec->size_group)
-               g_object_unref (sec->size_group);
-       sec->size_group = g_object_ref (group);
-
-       nma_ws_802_1x_add_to_size_group (parent,
-                                        sec->size_group,
-                                        "dynamic_wep_auth_label",
-                                        "dynamic_wep_auth_combo");
-}
+G_DEFINE_TYPE_WITH_CODE (NMAWsDynamicWep, nma_ws_dynamic_wep, NMA_TYPE_WS_802_1X,
+                         G_IMPLEMENT_INTERFACE (NMA_TYPE_WS, nma_ws_interface_init))
 
 static void
 fill_connection (NMAWs *parent, NMConnection *connection)
 {
        NMSettingWirelessSecurity *s_wireless_sec;
 
-       nma_ws_802_1x_fill_connection (parent, "dynamic_wep_auth_combo", connection);
+       nma_ws_802_1x_fill_connection (parent, connection);
 
        s_wireless_sec = nm_connection_get_setting_wireless_security (connection);
        g_assert (s_wireless_sec);
@@ -63,55 +40,28 @@ fill_connection (NMAWs *parent, NMConnection *connection)
 }
 
 static void
-auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
+nma_ws_dynamic_wep_init (NMAWsDynamicWep *sec)
 {
-       NMAWs *parent = NMA_WS (user_data);
-       NMAWsDynamicWEP *sec = (NMAWsDynamicWEP *) parent;
-
-       nma_ws_802_1x_auth_combo_changed (combo,
-                                         parent,
-                                         "dynamic_wep_method_vbox",
-                                         sec->size_group);
 }
 
 static void
-update_secrets (NMAWs *parent, NMConnection *connection)
+nma_ws_interface_init (NMAWsInterface *iface)
 {
-       nma_ws_802_1x_update_secrets (parent, "dynamic_wep_auth_combo", connection);
+       iface->fill_connection = fill_connection;
 }
 
-NMAWsDynamicWEP *
+NMAWsDynamicWep *
 nma_ws_dynamic_wep_new (NMConnection *connection,
-                        gboolean is_editor,
+                        gboolean is_editor, // XXX
                         gboolean secrets_only)
 {
-       NMAWs *parent;
-       GtkWidget *widget;
-
-       parent = nma_ws_init (sizeof (NMAWsDynamicWEP),
-                             validate,
-                             add_to_size_group,
-                             fill_connection,
-                             update_secrets,
-                             destroy,
-                             "/org/gnome/libnma/nma-ws-dynamic-wep.ui",
-                             "dynamic_wep_notebook",
-                             NULL);
-       if (!parent)
-               return NULL;
-
-       parent->adhoc_compatible = FALSE;
-       parent->hotspot_compatible = FALSE;
-
-       widget = nma_ws_802_1x_auth_combo_init (parent,
-                                               "dynamic_wep_auth_combo",
-                                               "dynamic_wep_auth_label",
-                                               (GCallback) auth_combo_changed_cb,
-                                               connection,
-                                               is_editor,
-                                               secrets_only,
-                                               NULL);
-       auth_combo_changed_cb (widget, (gpointer) parent);
+       return g_object_new (NMA_TYPE_WS_DYNAMIC_WEP,
+                            "connection", connection,
+                            "secrets-only", secrets_only,
+                            NULL);
+}
 
-       return (NMAWsDynamicWEP *) parent;
+static void
+nma_ws_dynamic_wep_class_init (NMAWsDynamicWepClass *klass)
+{
 }
diff --git a/src/nma-ws/nma-ws-dynamic-wep.h b/src/nma-ws/nma-ws-dynamic-wep.h
index 1dfc3f8c..8d1fcda9 100644
--- a/src/nma-ws/nma-ws-dynamic-wep.h
+++ b/src/nma-ws/nma-ws-dynamic-wep.h
@@ -5,13 +5,22 @@
  * Copyright 2007 - 2019 Red Hat, Inc.
  */
 
-#ifndef WS_DYNAMIC_WEP_H
-#define WS_DYNAMIC_WEP_H
+#ifndef NMA_WS_DYNAMIC_WEP_H
+#define NMA_WS_DYNAMIC_WEP_H
 
-typedef struct _NMAWsDynamicWEP NMAWsDynamicWEP;
+typedef struct _NMAWsDynamicWep NMAWsDynamicWep;
 
-NMAWsDynamicWEP *nma_ws_dynamic_wep_new (NMConnection *connection,
+#define NMA_TYPE_WS_DYNAMIC_WEP            (nma_ws_dynamic_wep_get_type ())
+#define NMA_WS_DYNAMIC_WEP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMA_TYPE_WS_SAE, 
NMAWsDynamicWep))
+#define NMA_WS_DYNAMIC_WEP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NMA_TYPE_WS_SAE, 
NMAWsDynamicWepClass))
+#define NMA_IS_WS_DYNAMIC_WEP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMA_TYPE_WS_SAE))
+#define NMA_IS_WS_DYNAMIC_WEP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NMA_TYPE_WS_SAE))
+#define NMA_WS_DYNAMIC_WEP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NMA_TYPE_WS_SAE, 
NMAWsDynamicWepClass))
+
+GType nma_ws_dynamic_wep_get_type (void);
+
+NMAWsDynamicWep *nma_ws_dynamic_wep_new (NMConnection *connection,
                                          gboolean is_editor,
                                          gboolean secrets_only);
 
-#endif /* WS_DYNAMIC_WEP_H */
+#endif /* NMA_WS_DYNAMIC_WEP_H */
diff --git a/src/nma-ws/nma-ws-helpers.c b/src/nma-ws/nma-ws-helpers.c
new file mode 100644
index 00000000..d517ae38
--- /dev/null
+++ b/src/nma-ws/nma-ws-helpers.c
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Dan Williams <dcbw redhat com>
+ *
+ * Copyright 2009 - 2019 Red Hat, Inc.
+ */
+
+#include "nm-default.h"
+#include "nma-private.h"
+#include "nma-ws-helpers.h"
+
+void
+nma_ws_helper_fill_secret_entry (NMConnection *connection,
+                                 GtkEditable *entry,
+                                 GType setting_type,
+                                 HelperSecretFunc func)
+{
+       NMSetting *setting;
+       const char *tmp;
+
+       g_return_if_fail (connection != NULL);
+       g_return_if_fail (entry != NULL);
+       g_return_if_fail (func != NULL);
+
+       setting = nm_connection_get_setting (connection, setting_type);
+       if (setting) {
+               tmp = (*func) (setting);
+               if (tmp)
+                       gtk_editable_set_text (entry, tmp);
+       }
+}
diff --git a/src/nma-ws/nma-ws-helpers.h b/src/nma-ws/nma-ws-helpers.h
new file mode 100644
index 00000000..3f842646
--- /dev/null
+++ b/src/nma-ws/nma-ws-helpers.h
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Dan Williams <dcbw redhat com>
+ *
+ * Copyright 2009 - 2019 Red Hat, Inc.
+ */
+
+#ifndef _NMA_WS_HELPERS_H_
+#define _NMA_WS_HELPERS_H_
+
+typedef const char * (*HelperSecretFunc)(NMSetting *);
+
+void nma_ws_helper_fill_secret_entry (NMConnection *connection,
+                                      GtkEditable *entry,
+                                      GType setting_type,
+                                      HelperSecretFunc func);
+
+#endif  /* _NMA_WS_HELPERS_H_ */
diff --git a/src/nma-ws/nma-ws-leap.c b/src/nma-ws/nma-ws-leap.c
index 6c0814e2..f4c51ccb 100644
--- a/src/nma-ws/nma-ws-leap.c
+++ b/src/nma-ws/nma-ws-leap.c
@@ -8,62 +8,81 @@
 #include "nm-default.h"
 #include "nma-private.h"
 
+#include <ctype.h>
 #include <string.h>
 
 #include "nma-ws.h"
-#include "helpers.h"
+#include "nma-ws-private.h"
+#include "nma-ws-leap.h"
+#include "nma-ws-helpers.h"
 #include "nma-ui-utils.h"
 #include "utils.h"
 
-struct _NMAWsLEAP {
-       NMAWs parent;
-       gboolean editing_connection;
-       const char *password_flags_name;
+typedef struct {
+       GtkGridClass parent;
+} NMAWsLeapClass;
+
+struct _NMAWsLeap {
+       GtkGrid parent;
+
+       GtkWidget *leap_username_entry;
+       GtkWidget *leap_password_entry;
+       GtkWidget *leap_username_label;
+       GtkWidget *leap_password_label;
+       GtkWidget *show_checkbutton_leap;
+
+       NMConnection *connection;
+       gboolean secrets_only;
+};
+
+static void nma_ws_interface_init (NMAWsInterface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (NMAWsLeap, nma_ws_leap, GTK_TYPE_GRID,
+                         G_IMPLEMENT_INTERFACE (NMA_TYPE_WS, nma_ws_interface_init))
+
+enum {
+       PROP_0,
+       PROP_CONNECTION,
+       PROP_SECRETS_ONLY,
+       PROP_LAST
 };
 
 static void
-show_toggled_cb (GtkCheckButton *button, NMAWs *sec)
+show_toggled_cb (GtkCheckButton *button, gpointer user_data)
 {
-       GtkWidget *widget;
+       NMAWsLeap *sec = NMA_WS_LEAP (user_data);
        gboolean visible;
 
-       widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, "leap_password_entry"));
-       g_assert (widget);
-
        visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
-       gtk_entry_set_visibility (GTK_ENTRY (widget), visible);
+       gtk_entry_set_visibility (GTK_ENTRY (sec->leap_password_entry), visible);
 }
 
 static gboolean
 validate (NMAWs *parent, GError **error)
 {
-       GtkWidget *entry;
+       NMAWsLeap *sec = NMA_WS_LEAP (parent);
        NMSettingSecretFlags secret_flags;
        const char *text;
        gboolean ret = TRUE;
 
-       entry = GTK_WIDGET (gtk_builder_get_object (parent->builder, "leap_username_entry"));
-       g_assert (entry);
-       text = gtk_editable_get_text (GTK_EDITABLE (entry));
+       text = gtk_editable_get_text (GTK_EDITABLE (sec->leap_username_entry));
        if (!text || !strlen (text)) {
-               widget_set_error (entry);
+               widget_set_error (sec->leap_username_entry);
                g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("missing leap-username"));
                ret = FALSE;
-       } else
-               widget_unset_error (entry);
-
-       entry = GTK_WIDGET (gtk_builder_get_object (parent->builder, "leap_password_entry"));
-       g_assert (entry);
+       } else {
+               widget_unset_error (sec->leap_username_entry);
+       }
 
-       secret_flags = nma_utils_menu_to_secret_flags (entry);
-       text = gtk_editable_get_text (GTK_EDITABLE (entry));
+       secret_flags = nma_utils_menu_to_secret_flags (sec->leap_password_entry);
+       text = gtk_editable_get_text (GTK_EDITABLE (sec->leap_password_entry));
 
        if (   secret_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED
            || secret_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED
            || (text && strlen (text))) {
-               widget_unset_error (entry);
+               widget_unset_error (sec->leap_password_entry);
        } else {
-               widget_set_error (entry);
+               widget_set_error (sec->leap_password_entry);
                if (ret) {
                        g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("missing leap-password"));
                        ret = FALSE;
@@ -76,34 +95,26 @@ validate (NMAWs *parent, GError **error)
 static void
 add_to_size_group (NMAWs *parent, GtkSizeGroup *group)
 {
-       GtkWidget *widget;
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "leap_username_label"));
-       gtk_size_group_add_widget (group, widget);
+       NMAWsLeap *sec = NMA_WS_LEAP (parent);
 
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "leap_password_label"));
-       gtk_size_group_add_widget (group, widget);
+       gtk_size_group_add_widget (group, sec->leap_username_label);
+       gtk_size_group_add_widget (group, sec->leap_password_label);
 }
 
 static void
 fill_connection (NMAWs *parent, NMConnection *connection)
 {
-       NMAWsLEAP *sec = (NMAWsLEAP *) parent;
+       NMAWsLeap *sec = (NMAWsLeap *) parent;
        NMSettingWirelessSecurity *s_wireless_sec;
        NMSettingSecretFlags secret_flags;
-       GtkWidget *widget, *passwd_entry;
        const char *leap_password = NULL, *leap_username = NULL;
 
        /* Blow away the old security setting by adding a clear one */
        s_wireless_sec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
        nm_connection_add_setting (connection, (NMSetting *) s_wireless_sec);
 
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "leap_username_entry"));
-       leap_username = gtk_editable_get_text (GTK_EDITABLE (widget));
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "leap_password_entry"));
-       passwd_entry = widget;
-       leap_password = gtk_editable_get_text (GTK_EDITABLE (widget));
+       leap_username = gtk_editable_get_text (GTK_EDITABLE (sec->leap_username_entry));
+       leap_password = gtk_editable_get_text (GTK_EDITABLE (sec->leap_password_entry));
 
        g_object_set (s_wireless_sec,
                      NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "ieee8021x",
@@ -113,48 +124,96 @@ fill_connection (NMAWs *parent, NMConnection *connection)
                      NULL);
 
        /* Save LEAP_PASSWORD_FLAGS to the connection */
-       secret_flags = nma_utils_menu_to_secret_flags (passwd_entry);
-       nm_setting_set_secret_flags (NM_SETTING (s_wireless_sec), sec->password_flags_name,
+       secret_flags = nma_utils_menu_to_secret_flags (sec->leap_password_entry);
+       nm_setting_set_secret_flags (NM_SETTING (s_wireless_sec), NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD,
                                     secret_flags, NULL);
 
        /* Update secret flags and popup when editing the connection */
-       if (sec->editing_connection)
-               nma_utils_update_password_storage (passwd_entry, secret_flags,
-                                                  NM_SETTING (s_wireless_sec), sec->password_flags_name);
+       if (!sec->secrets_only) {
+               nma_utils_update_password_storage (sec->leap_password_entry, secret_flags,
+                                                  NM_SETTING (s_wireless_sec),
+                                                  NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD);
+       }
 }
 
 static void
 update_secrets (NMAWs *parent, NMConnection *connection)
 {
-       helper_fill_secret_entry (connection,
-                                 parent->builder,
-                                 "leap_password_entry",
-                                 NM_TYPE_SETTING_WIRELESS_SECURITY,
-                                 (HelperSecretFunc) nm_setting_wireless_security_get_leap_password);
+       NMAWsLeap *sec = NMA_WS_LEAP (parent);
+
+       nma_ws_helper_fill_secret_entry (connection,
+                                        GTK_EDITABLE (sec->leap_password_entry),
+                                        NM_TYPE_SETTING_WIRELESS_SECURITY,
+                                        (HelperSecretFunc) nm_setting_wireless_security_get_leap_password);
+}
+
+static void
+get_property (GObject *object,
+              guint prop_id,
+              GValue *value,
+              GParamSpec *pspec)
+{
+       NMAWsLeap *sec = NMA_WS_LEAP (object);
+
+       switch (prop_id) {
+       case PROP_CONNECTION:
+               g_value_set_object (value, sec->connection);
+               break;
+       case PROP_SECRETS_ONLY:
+               g_value_set_boolean (value, sec->secrets_only);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
 }
 
-NMAWsLEAP *
-nma_ws_leap_new (NMConnection *connection, gboolean secrets_only)
+static void
+set_property (GObject *object,
+              guint prop_id,
+              const GValue *value,
+              GParamSpec *pspec)
 {
-       NMAWs *parent;
-       NMAWsLEAP *sec;
-       GtkWidget *widget;
+       NMAWsLeap *sec = NMA_WS_LEAP (object);
+
+       switch (prop_id) {
+       case PROP_CONNECTION:
+               sec->connection = g_value_dup_object (value);
+               break;
+       case PROP_SECRETS_ONLY:
+               sec->secrets_only = g_value_get_boolean (value);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+nma_ws_leap_init (NMAWsLeap *sec)
+{
+       gtk_widget_init_template (GTK_WIDGET (sec));
+}
+
+static void
+nma_ws_interface_init (NMAWsInterface *iface)
+{
+       iface->validate = validate;
+       iface->add_to_size_group = add_to_size_group;
+       iface->fill_connection = fill_connection;
+       iface->update_secrets = update_secrets;
+       iface->adhoc_compatible = FALSE;
+       iface->hotspot_compatible = FALSE;
+}
+
+static void
+constructed (GObject *object)
+{
+       NMAWsLeap *sec = NMA_WS_LEAP (object);
        NMSettingWirelessSecurity *wsec = NULL;
 
-       parent = nma_ws_init (sizeof (NMAWsLEAP),
-                             validate,
-                             add_to_size_group,
-                             fill_connection,
-                             update_secrets,
-                             NULL,
-                             "/org/gnome/libnma/nma-ws-leap.ui",
-                             "leap_notebook",
-                             "leap_username_entry");
-       if (!parent)
-               return NULL;
-
-       if (connection) {
-               wsec = nm_connection_get_setting_wireless_security (connection);
+       if (sec->connection) {
+               wsec = nm_connection_get_setting_wireless_security (sec->connection);
                if (wsec) {
                        const char *auth_alg;
 
@@ -165,41 +224,70 @@ nma_ws_leap_new (NMConnection *connection, gboolean secrets_only)
                }
        }
 
-       parent->adhoc_compatible = FALSE;
-       parent->hotspot_compatible = FALSE;
-       sec = (NMAWsLEAP *) parent;
-       sec->editing_connection = secrets_only ? FALSE : TRUE;
-       sec->password_flags_name = NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD;
+       /* Create password-storage popup menu for password entry under entry's secondary icon */
+       nma_utils_setup_password_storage (sec->leap_password_entry, 0, (NMSetting *) wsec,
+                                         NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD,
+                                         FALSE, sec->secrets_only);
+
+       if (wsec) {
+               update_secrets (NMA_WS (sec), sec->connection);
+               gtk_editable_set_text (GTK_EDITABLE (sec->leap_username_entry),
+                                      nm_setting_wireless_security_get_leap_username (wsec));
+       }
 
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "leap_password_entry"));
-       g_assert (widget);
-       g_signal_connect (G_OBJECT (widget), "changed",
-                         (GCallback) nma_ws_changed_cb,
-                         sec);
+       if (sec->secrets_only) {
+               gtk_widget_hide (sec->leap_username_label);
+               gtk_widget_hide (sec->leap_username_entry);
+       }
 
-       /* Create password-storage popup menu for password entry under entry's secondary icon */
-       nma_utils_setup_password_storage (widget, 0, (NMSetting *) wsec, sec->password_flags_name,
-                                         FALSE, secrets_only);
-
-       if (wsec)
-               update_secrets (NMA_WS (sec), connection);
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "leap_username_entry"));
-       g_assert (widget);
-       g_signal_connect (G_OBJECT (widget), "changed",
-                         (GCallback) nma_ws_changed_cb,
-                         sec);
-       if (wsec)
-               gtk_editable_set_text (GTK_EDITABLE (widget), nm_setting_wireless_security_get_leap_username 
(wsec));
-
-       if (secrets_only)
-               gtk_widget_hide (widget);
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_leap"));
-       g_assert (widget);
-       g_signal_connect (G_OBJECT (widget), "toggled",
-                         (GCallback) show_toggled_cb,
-                         sec);
-
-       return sec;
+       gtk_widget_grab_focus (sec->leap_password_entry);
+
+       G_OBJECT_CLASS (nma_ws_leap_parent_class)->constructed (object);
+}
+
+NMAWsLeap *
+nma_ws_leap_new (NMConnection *connection, gboolean secrets_only)
+{
+       return g_object_new (NMA_TYPE_WS_LEAP,
+                            "connection", connection,
+                            "secrets-only", secrets_only,
+                            NULL);
+}
+
+static void
+dispose (GObject *object)
+{
+       NMAWsLeap *sec = NMA_WS_LEAP (object);
+
+       g_clear_object (&sec->connection);
+}
+
+static void
+nma_ws_leap_class_init (NMAWsLeapClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+       object_class->get_property = get_property;
+       object_class->set_property = set_property;
+       object_class->constructed = constructed;
+       object_class->dispose = dispose;
+
+       g_object_class_override_property (object_class,
+                                         PROP_CONNECTION, "connection");
+
+       g_object_class_override_property (object_class,
+                                         PROP_SECRETS_ONLY, "secrets-only");
+
+        gtk_widget_class_set_template_from_resource (widget_class,
+                                                     "/org/gnome/libnma/nma-ws-leap.ui");
+
+       gtk_widget_class_bind_template_child (widget_class, NMAWsLeap, leap_username_entry);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsLeap, leap_password_entry);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsLeap, leap_username_label);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsLeap, leap_password_label);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsLeap, show_checkbutton_leap);
+
+       gtk_widget_class_bind_template_callback (widget_class, nma_ws_changed_cb);
+       gtk_widget_class_bind_template_callback (widget_class, show_toggled_cb);
 }
diff --git a/src/nma-ws/nma-ws-leap.h b/src/nma-ws/nma-ws-leap.h
index 29f12602..606ce50e 100644
--- a/src/nma-ws/nma-ws-leap.h
+++ b/src/nma-ws/nma-ws-leap.h
@@ -5,11 +5,20 @@
  * Copyright 2007 - 2019 Red Hat, Inc.
  */
 
-#ifndef WS_LEAP_H
-#define WS_LEAP_H
+#ifndef NMA_WS_LEAP_H
+#define NMA_WS_LEAP_H
 
-typedef struct _NMAWsLEAP NMAWsLEAP;
+typedef struct _NMAWsLeap NMAWsLeap;
 
-NMAWsLEAP *nma_ws_leap_new (NMConnection *connection, gboolean secrets_only);
+#define NMA_TYPE_WS_LEAP            (nma_ws_leap_get_type ())
+#define NMA_WS_LEAP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMA_TYPE_WS_LEAP, NMAWsLeap))
+#define NMA_WS_LEAP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NMA_TYPE_WS_LEAP, NMAWsLeapClass))
+#define NMA_IS_WS_LEAP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMA_TYPE_WS_LEAP))
+#define NMA_IS_WS_LEAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NMA_TYPE_WS_LEAP))
+#define NMA_WS_LEAP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NMA_TYPE_WS_LEAP, NMAWsLeapClass))
 
-#endif /* WS_LEAP_H */
+GType nma_ws_leap_get_type (void);
+
+NMAWsLeap *nma_ws_leap_new (NMConnection *connection, gboolean secrets_only);
+
+#endif /* NMA_WS_LEAP_H */
diff --git a/src/nma-ws/nma-ws-leap.ui b/src/nma-ws/nma-ws-leap.ui
index a93121d6..da44a23b 100644
--- a/src/nma-ws/nma-ws-leap.ui
+++ b/src/nma-ws/nma-ws-leap.ui
@@ -1,100 +1,86 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="nm-applet">
   <requires lib="gtk+" version="3.10"/>
-  <object class="GtkNotebook" id="leap_notebook">
+  <template class="NMAWsLeap" parent="GtkGrid">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="show_tabs">False</property>
-    <property name="show_border">False</property>
+    <property name="valign">start</property>
+    <property name="row_spacing">6</property>
+    <property name="column_spacing">6</property>
     <child>
-      <object class="GtkGrid" id="table5">
+      <object class="GtkLabel" id="leap_username_label">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="valign">start</property>
-        <property name="row_spacing">6</property>
-        <property name="column_spacing">6</property>
-        <child>
-          <object class="GtkLabel" id="leap_username_label">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">_Username</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">leap_username_entry</property>
-            <property name="xalign">1</property>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="leap_password_label">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">_Password</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">leap_password_entry</property>
-            <property name="xalign">1</property>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="leap_password_entry">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hexpand">True</property>
-            <property name="visibility">False</property>
-            <property name="activates_default">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkCheckButton" id="show_checkbutton_leap">
-            <property name="label" translatable="yes">Sho_w password</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
-            <property name="hexpand">True</property>
-            <property name="use_underline">True</property>
-            <property name="draw_indicator">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="leap_username_entry">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hexpand">True</property>
-            <property name="activates_default">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">0</property>
-          </packing>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
+        <property name="label" translatable="yes">_Username</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">leap_username_entry</property>
+        <property name="xalign">1</property>
       </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
     </child>
-    <child type="tab">
-      <object class="GtkLabel" id="GtkLabel1">
+    <child>
+      <object class="GtkLabel" id="leap_password_label">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Password</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">leap_password_entry</property>
+        <property name="xalign">1</property>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkEntry" id="leap_password_entry">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="hexpand">True</property>
+        <property name="visibility">False</property>
+        <property name="activates_default">True</property>
+        <signal name="changed" handler="nma_ws_changed_cb" swapped="no"/>
       </object>
       <packing>
-        <property name="tab_fill">False</property>
+        <property name="left_attach">1</property>
+        <property name="top_attach">1</property>
       </packing>
     </child>
-  </object>
+    <child>
+      <object class="GtkCheckButton" id="show_checkbutton_leap">
+        <property name="label" translatable="yes">Sho_w password</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="hexpand">True</property>
+        <property name="use_underline">True</property>
+        <property name="draw_indicator">True</property>
+        <signal name="toggled" handler="show_toggled_cb" swapped="no"/>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkEntry" id="leap_username_entry">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="hexpand">True</property>
+        <property name="activates_default">True</property>
+        <signal name="changed" handler="nma_ws_changed_cb" swapped="no"/>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+  </template>
 </interface>
diff --git a/src/nma-ws/nma-ws-sae.c b/src/nma-ws/nma-ws-sae.c
index 3ac2b95b..e304c5d2 100644
--- a/src/nma-ws/nma-ws-sae.c
+++ b/src/nma-ws/nma-ws-sae.c
@@ -10,54 +10,70 @@
 #include <string.h>
 
 #include "nma-ws.h"
-#include "helpers.h"
+#include "nma-ws-private.h"
+#include "nma-ws-sae.h"
+#include "nma-ws-helpers.h"
 #include "nma-ui-utils.h"
 #include "utils.h"
 
-#define WPA_PMK_LEN 32
+typedef struct {
+       GtkGridClass parent;
+} NMAWsSaeClass;
 
-struct _NMAWsSAE {
-       NMAWs parent;
+struct _NMAWsSae {
+       GtkGrid parent;
 
-       gboolean editing_connection;
-       const char *password_flags_name;
+       GtkWidget *psk_entry;
+       GtkWidget *sae_label;
+       GtkWidget *sae_type_combo;
+       GtkWidget *sae_type_label;
+       GtkWidget *show_checkbutton_sae;
+
+       NMConnection *connection;
+       gboolean secrets_only;
+};
+
+static void nma_ws_interface_init (NMAWsInterface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (NMAWsSae, nma_ws_sae, GTK_TYPE_GRID,
+                         G_IMPLEMENT_INTERFACE (NMA_TYPE_WS, nma_ws_interface_init))
+
+enum {
+       PROP_0,
+       PROP_CONNECTION,
+       PROP_SECRETS_ONLY,
+       PROP_LAST
 };
 
 static void
-show_toggled_cb (GtkCheckButton *button, NMAWs *sec)
+show_toggled_cb (GtkCheckButton *button, gpointer user_data)
 {
-       GtkWidget *widget;
+       NMAWsSae *sec = NMA_WS_SAE (user_data);
        gboolean visible;
 
-       widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, "psk_entry"));
-       g_assert (widget);
-
        visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
-       gtk_entry_set_visibility (GTK_ENTRY (widget), visible);
+       gtk_entry_set_visibility (GTK_ENTRY (sec->psk_entry), visible);
 }
 
 static gboolean
 validate (NMAWs *parent, GError **error)
 {
-       GtkWidget *entry;
+       NMAWsSae *sec = NMA_WS_SAE (parent);
        NMSettingSecretFlags secret_flags;
        const char *key;
 
-       entry = GTK_WIDGET (gtk_builder_get_object (parent->builder, "psk_entry"));
-       g_assert (entry);
-
-       secret_flags = nma_utils_menu_to_secret_flags (entry);
-       key = gtk_editable_get_text (GTK_EDITABLE (entry));
+       secret_flags = nma_utils_menu_to_secret_flags (sec->psk_entry);
+       key = gtk_editable_get_text (GTK_EDITABLE (sec->psk_entry));
 
         if (   secret_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED
             || secret_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED) {
                /* All good. */
        } else if (key == NULL || key[0] == '\0') {
-               widget_set_error (entry);
+               widget_set_error (sec->psk_entry);
                g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("missing password"));
                return FALSE;
        }
-       widget_unset_error (entry);
+       widget_unset_error (sec->psk_entry);
 
        return TRUE;
 }
@@ -65,20 +81,16 @@ validate (NMAWs *parent, GError **error)
 static void
 add_to_size_group (NMAWs *parent, GtkSizeGroup *group)
 {
-       GtkWidget *widget;
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "sae_type_label"));
-       gtk_size_group_add_widget (group, widget);
+       NMAWsSae *sec = NMA_WS_SAE (parent);
 
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "sae_label"));
-       gtk_size_group_add_widget (group, widget);
+       gtk_size_group_add_widget (group, sec->sae_type_label);
+       gtk_size_group_add_widget (group, sec->sae_label);
 }
 
 static void
 fill_connection (NMAWs *parent, NMConnection *connection)
 {
-       NMAWsSAE *sae = (NMAWsSAE *) parent;
-       GtkWidget *widget, *passwd_entry;
+       NMAWsSae *sae = (NMAWsSae *) parent;
        const char *key;
        NMSettingWireless *s_wireless;
        NMSettingWirelessSecurity *s_wireless_sec;
@@ -87,7 +99,7 @@ fill_connection (NMAWs *parent, NMConnection *connection)
        gboolean is_adhoc = FALSE;
 
        s_wireless = nm_connection_get_setting_wireless (connection);
-       g_assert (s_wireless);
+       g_return_if_fail (s_wireless);
 
        mode = nm_setting_wireless_get_mode (s_wireless);
        if (mode && !strcmp (mode, "adhoc"))
@@ -97,20 +109,20 @@ fill_connection (NMAWs *parent, NMConnection *connection)
        s_wireless_sec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
        nm_connection_add_setting (connection, (NMSetting *) s_wireless_sec);
 
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "psk_entry"));
-       passwd_entry = widget;
-       key = gtk_editable_get_text (GTK_EDITABLE (widget));
+       key = gtk_editable_get_text (GTK_EDITABLE (sae->psk_entry));
        g_object_set (s_wireless_sec, NM_SETTING_WIRELESS_SECURITY_PSK, key, NULL);
 
        /* Save PSK_FLAGS to the connection */
-       secret_flags = nma_utils_menu_to_secret_flags (passwd_entry);
+       secret_flags = nma_utils_menu_to_secret_flags (sae->psk_entry);
        nm_setting_set_secret_flags (NM_SETTING (s_wireless_sec), NM_SETTING_WIRELESS_SECURITY_PSK,
                                     secret_flags, NULL);
 
        /* Update secret flags and popup when editing the connection */
-       if (sae->editing_connection)
-               nma_utils_update_password_storage (passwd_entry, secret_flags,
-                                                  NM_SETTING (s_wireless_sec), sae->password_flags_name);
+       if (!sae->secrets_only) {
+               nma_utils_update_password_storage (sae->psk_entry, secret_flags,
+                                                  NM_SETTING (s_wireless_sec),
+                                                  NM_SETTING_WIRELESS_SECURITY_PSK);
+       }
 
        nma_ws_clear_ciphers (connection);
        if (is_adhoc) {
@@ -131,72 +143,143 @@ fill_connection (NMAWs *parent, NMConnection *connection)
 static void
 update_secrets (NMAWs *parent, NMConnection *connection)
 {
-       helper_fill_secret_entry (connection,
-                                 parent->builder,
-                                 "psk_entry",
-                                 NM_TYPE_SETTING_WIRELESS_SECURITY,
-                                 (HelperSecretFunc) nm_setting_wireless_security_get_psk);
+       NMAWsSae *sec = NMA_WS_SAE (parent);
+
+       nma_ws_helper_fill_secret_entry (connection,
+                                        GTK_EDITABLE (sec->psk_entry),
+                                        NM_TYPE_SETTING_WIRELESS_SECURITY,
+                                        (HelperSecretFunc) nm_setting_wireless_security_get_psk);
 }
 
-NMAWsSAE *
-nma_ws_sae_new (NMConnection *connection, gboolean secrets_only)
+static void
+get_property (GObject *object,
+              guint prop_id,
+              GValue *value,
+              GParamSpec *pspec)
 {
-       NMAWs *parent;
-       NMAWsSAE *sec;
+       NMAWsSae *sec = NMA_WS_SAE (object);
+
+       switch (prop_id) {
+       case PROP_CONNECTION:
+               g_value_set_object (value, sec->connection);
+               break;
+       case PROP_SECRETS_ONLY:
+               g_value_set_boolean (value, sec->secrets_only);
+               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)
+{
+       NMAWsSae *sec = NMA_WS_SAE (object);
+
+       switch (prop_id) {
+       case PROP_CONNECTION:
+               sec->connection = g_value_dup_object (value);
+               break;
+       case PROP_SECRETS_ONLY:
+               sec->secrets_only = g_value_get_boolean (value);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+nma_ws_sae_init (NMAWsSae *sec)
+{
+       gtk_widget_init_template (GTK_WIDGET (sec));
+}
+
+static void
+nma_ws_interface_init (NMAWsInterface *iface)
+{
+       iface->validate = validate;
+       iface->add_to_size_group = add_to_size_group;
+       iface->fill_connection = fill_connection;
+       iface->update_secrets = update_secrets;
+       iface->adhoc_compatible = TRUE;
+       iface->hotspot_compatible = TRUE;
+}
+
+static void
+constructed (GObject *object)
+{
+       NMAWsSae *sec = NMA_WS_SAE (object);
        NMSetting *setting = NULL;
-       GtkWidget *widget;
-
-       parent = nma_ws_init (sizeof (NMAWsSAE),
-                             validate,
-                             add_to_size_group,
-                             fill_connection,
-                             update_secrets,
-                             NULL,
-                             "/org/gnome/libnma/nma-ws-sae.ui",
-                             "sae_notebook",
-                             "psk_entry");
-       if (!parent)
-               return NULL;
-
-       parent->adhoc_compatible = TRUE;
-       sec = (NMAWsSAE *) parent;
-       sec->editing_connection = secrets_only ? FALSE : TRUE;
-       sec->password_flags_name = NM_SETTING_WIRELESS_SECURITY_PSK;
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "psk_entry"));
-       g_assert (widget);
-       g_signal_connect (G_OBJECT (widget), "changed",
-                         (GCallback) nma_ws_changed_cb,
-                         sec);
-       gtk_editable_set_width_chars (GTK_EDITABLE (widget), 28);
 
        /* Create password-storage popup menu for password entry under entry's secondary icon */
-       if (connection)
-               setting = (NMSetting *) nm_connection_get_setting_wireless_security (connection);
-       nma_utils_setup_password_storage (widget, 0, setting, sec->password_flags_name,
-                                         FALSE, secrets_only);
+       if (sec->connection)
+               setting = (NMSetting *) nm_connection_get_setting_wireless_security (sec->connection);
+       nma_utils_setup_password_storage (sec->psk_entry, 0, setting, NM_SETTING_WIRELESS_SECURITY_PSK,
+                                         FALSE, sec->secrets_only);
 
        /* Fill secrets, if any */
-       if (connection)
-               update_secrets (NMA_WS (sec), connection);
+       if (sec->connection)
+               update_secrets (NMA_WS (sec), sec->connection);
 
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_sae"));
-       g_assert (widget);
-       g_signal_connect (G_OBJECT (widget), "toggled",
-                         (GCallback) show_toggled_cb,
-                         sec);
+       gtk_widget_grab_focus (sec->psk_entry);
 
        /* Hide WPA/RSN for now since this can be autodetected by NM and the
         * supplicant when connecting to the AP.
         */
+       gtk_widget_hide (sec->sae_type_combo);
+       gtk_widget_hide (sec->sae_type_label);
+
+       G_OBJECT_CLASS (nma_ws_sae_parent_class)->constructed (object);
+}
+
+NMAWsSae *
+nma_ws_sae_new (NMConnection *connection, gboolean secrets_only)
+{
+       return g_object_new (NMA_TYPE_WS_SAE,
+                            "connection", connection,
+                            "secrets-only", secrets_only,
+                            NULL);
+}
+
+static void
+dispose (GObject *object)
+{
+       NMAWsSae *sec = NMA_WS_SAE (object);
+
+       g_clear_object (&sec->connection);
+}
+
+static void
+nma_ws_sae_class_init (NMAWsSaeClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+       object_class->get_property = get_property;
+       object_class->set_property = set_property;
+       object_class->constructed = constructed;
+       object_class->dispose = dispose;
+
+       g_object_class_override_property (object_class,
+                                         PROP_CONNECTION, "connection");
+
+       g_object_class_override_property (object_class,
+                                         PROP_SECRETS_ONLY, "secrets-only");
 
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "sae_type_combo"));
-       g_assert (widget);
-       gtk_widget_hide (widget);
+        gtk_widget_class_set_template_from_resource (widget_class,
+                                                     "/org/gnome/libnma/nma-ws-sae.ui");
 
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "sae_type_label"));
-       g_assert (widget);
-       gtk_widget_hide (widget);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsSae, psk_entry);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsSae, sae_label);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsSae, sae_type_combo);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsSae, sae_type_label);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsSae, show_checkbutton_sae);
 
-       return sec;
+       gtk_widget_class_bind_template_callback (widget_class, nma_ws_changed_cb);
+       gtk_widget_class_bind_template_callback (widget_class, show_toggled_cb);
 }
diff --git a/src/nma-ws/nma-ws-sae.h b/src/nma-ws/nma-ws-sae.h
index 05e0de88..ab07f141 100644
--- a/src/nma-ws/nma-ws-sae.h
+++ b/src/nma-ws/nma-ws-sae.h
@@ -3,14 +3,23 @@
  * Copyright 2007 - 2019 Red Hat, Inc.
  */
 
-#ifndef WS_SAE_H
-#define WS_SAE_H
+#ifndef NMA_WS_SAE_H
+#define NMA_WS_SAE_H
 
 /* For compatibility with NetworkManager-1.20 and earlier. */
 #define NMU_SEC_SAE 9
 
-typedef struct _NMAWsSAE NMAWsSAE;
+typedef struct _NMAWsSae NMAWsSae;
 
-NMAWsSAE *nma_ws_sae_new (NMConnection *connection, gboolean secrets_only);
+#define NMA_TYPE_WS_SAE            (nma_ws_sae_get_type ())
+#define NMA_WS_SAE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMA_TYPE_WS_SAE, NMAWsSae))
+#define NMA_WS_SAE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NMA_TYPE_WS_SAE, NMAWsSaeClass))
+#define NMA_IS_WS_SAE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMA_TYPE_WS_SAE))
+#define NMA_IS_WS_SAE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NMA_TYPE_WS_SAE))
+#define NMA_WS_SAE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NMA_TYPE_WS_SAE, NMAWsSaeClass))
 
-#endif /* WS_SAE_H */
+GType nma_ws_sae_get_type (void);
+
+NMAWsSae *nma_ws_sae_new (NMConnection *connection, gboolean secrets_only);
+
+#endif /* NMA_WS_SAE_H */
diff --git a/src/nma-ws/nma-ws-sae.ui b/src/nma-ws/nma-ws-sae.ui
index 8f0d0413..89094a18 100644
--- a/src/nma-ws/nma-ws-sae.ui
+++ b/src/nma-ws/nma-ws-sae.ui
@@ -1,98 +1,84 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="nm-applet">
   <requires lib="gtk+" version="3.10"/>
-  <object class="GtkNotebook" id="sae_notebook">
+  <template class="NMAWsSae" parent="GtkGrid">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="show_tabs">False</property>
-    <property name="show_border">False</property>
+    <property name="row_spacing">6</property>
+    <property name="column_spacing">6</property>
     <child>
-      <object class="GtkGrid" id="sae_table">
+      <object class="GtkLabel" id="sae_label">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="row_spacing">6</property>
-        <property name="column_spacing">6</property>
-        <child>
-          <object class="GtkLabel" id="sae_label">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">_Password</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">psk_entry</property>
-            <property name="xalign">1</property>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="psk_entry">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hexpand">True</property>
-            <property name="max_length">64</property>
-            <property name="visibility">False</property>
-            <property name="activates_default">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="sae_type_label">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">_Type</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">sae_type_combo</property>
-            <property name="xalign">1</property>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkCheckButton" id="show_checkbutton_sae">
-            <property name="label" translatable="yes">Sho_w password</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
-            <property name="hexpand">True</property>
-            <property name="use_underline">True</property>
-            <property name="draw_indicator">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkComboBox" id="sae_type_combo">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
+        <property name="label" translatable="yes">_Password</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">psk_entry</property>
+        <property name="xalign">1</property>
       </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkEntry" id="psk_entry">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="hexpand">True</property>
+        <property name="max_length">64</property>
+        <property name="visibility">False</property>
+        <property name="activates_default">True</property>
+        <property name="width_chars">28</property>
+        <signal name="changed" handler="nma_ws_changed_cb" swapped="no"/>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="sae_type_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Type</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">sae_type_combo</property>
+        <property name="xalign">1</property>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="show_checkbutton_sae">
+        <property name="label" translatable="yes">Sho_w password</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="hexpand">True</property>
+        <property name="use_underline">True</property>
+        <property name="draw_indicator">True</property>
+        <signal name="toggled" handler="show_toggled_cb" swapped="no"/>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">1</property>
+      </packing>
     </child>
-    <child type="tab">
-      <object class="GtkLabel" id="GtkLabel2">
+    <child>
+      <object class="GtkComboBox" id="sae_type_combo">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
       </object>
       <packing>
-        <property name="tab_fill">False</property>
+        <property name="left_attach">1</property>
+        <property name="top_attach">2</property>
       </packing>
     </child>
-  </object>
+    <child>
+      <placeholder/>
+    </child>
+  </template>
 </interface>
diff --git a/src/nma-ws/nma-ws-wep-key.c b/src/nma-ws/nma-ws-wep-key.c
index 221bf8da..2ccdbb42 100644
--- a/src/nma-ws/nma-ws-wep-key.c
+++ b/src/nma-ws/nma-ws-wep-key.c
@@ -1,54 +1,79 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * Dan Williams <dcbw redhat com>
- *
  * Copyright 2007 - 2019 Red Hat, Inc.
  */
 
 #include "nm-default.h"
 #include "nma-private.h"
 
+#include <ctype.h>
 #include <string.h>
 
 #include "nma-ws.h"
-#include "utils.h"
-#include "helpers.h"
+#include "nma-ws-private.h"
+#include "nma-ws-wep-key.h"
+#include "nma-ws-helpers.h"
 #include "nma-ui-utils.h"
+#include "utils.h"
+
+typedef struct {
+       GtkGridClass parent;
+} NMAWsWepKeyClass;
 
-struct _NMAWsWEPKey {
-       NMAWs parent;
+struct _NMAWsWepKey {
+       GtkGrid parent;
 
-       gboolean editing_connection;
-       const char *password_flags_name;
+       GtkWidget *auth_method_combo;
+       GtkWidget *auth_method_label;
+       GtkWidget *key_index_combo;
+       GtkWidget *key_index_label;
+       GtkWidget *show_checkbutton_wep;
+       GtkWidget *wep_key_entry;
+       GtkWidget *wep_key_label;
+
+       NMConnection *connection;
+       gboolean secrets_only;
+       NMWepKeyType adhoc_create;
+       NMWepKeyType key_type;
 
-       NMWepKeyType type;
        char keys[4][65];
        guint8 cur_index;
 };
 
+static void nma_ws_interface_init (NMAWsInterface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (NMAWsWepKey, nma_ws_wep_key, GTK_TYPE_GRID,
+                         G_IMPLEMENT_INTERFACE (NMA_TYPE_WS, nma_ws_interface_init))
+
+enum {
+       PROP_0,
+       PROP_CONNECTION,
+       PROP_SECRETS_ONLY,
+       PROP_KEY_TYPE,
+       PROP_ADHOC_CREATE,
+       PROP_LAST
+};
+
 static void
-show_toggled_cb (GtkCheckButton *button, NMAWs *sec)
+show_toggled_cb (GtkCheckButton *button, gpointer user_data)
 {
-       GtkWidget *widget;
+       NMAWsWepKey *sec = NMA_WS_WEP_KEY (user_data);
        gboolean visible;
 
-       widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, "wep_key_entry"));
-       g_assert (widget);
-
        visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
-       gtk_entry_set_visibility (GTK_ENTRY (widget), visible);
+       gtk_entry_set_visibility (GTK_ENTRY (sec->wep_key_entry), visible);
 }
 
 static void
 key_index_combo_changed_cb (GtkWidget *combo, NMAWs *parent)
 {
-       NMAWsWEPKey *sec = (NMAWsWEPKey *) parent;
+       NMAWsWepKey *sec = NMA_WS_WEP_KEY (parent);
        GtkWidget *entry;
        const char *key;
        int key_index;
 
        /* Save WEP key for old key index */
-       entry = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wep_key_entry"));
+       entry = GTK_WIDGET (sec->wep_key_entry);
        key = gtk_editable_get_text (GTK_EDITABLE (entry));
        if (key)
                g_strlcpy (sec->keys[sec->cur_index], key, sizeof (sec->keys[sec->cur_index]));
@@ -66,43 +91,29 @@ key_index_combo_changed_cb (GtkWidget *combo, NMAWs *parent)
        nma_ws_changed_cb (combo, parent);
 }
 
-static void
-destroy (NMAWs *parent)
-{
-       NMAWsWEPKey *sec = (NMAWsWEPKey *) parent;
-       int i;
-
-       for (i = 0; i < 4; i++)
-               memset (sec->keys[i], 0, sizeof (sec->keys[i]));
-}
-
 static gboolean
 validate (NMAWs *parent, GError **error)
 {
-       NMAWsWEPKey *sec = (NMAWsWEPKey *) parent;
+       NMAWsWepKey *sec = NMA_WS_WEP_KEY (parent);
        NMSettingSecretFlags secret_flags;
-       GtkWidget *entry;
        const char *key;
        int i;
 
-       entry = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wep_key_entry"));
-       g_assert (entry);
-
-       secret_flags = nma_utils_menu_to_secret_flags (entry);
-       key = gtk_editable_get_text (GTK_EDITABLE (entry));
+       secret_flags = nma_utils_menu_to_secret_flags (sec->wep_key_entry);
+       key = gtk_editable_get_text (GTK_EDITABLE (sec->wep_key_entry));
 
         if (   secret_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED
             || secret_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED) {
                /* All good. */
        } else if (!key) {
-               widget_set_error (entry);
+               widget_set_error (sec->wep_key_entry);
                g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("missing wep-key"));
                return FALSE;
-       } else if (sec->type == NM_WEP_KEY_TYPE_KEY) {
+       } else if (sec->key_type == NM_WEP_KEY_TYPE_KEY) {
                if ((strlen (key) == 10) || (strlen (key) == 26)) {
                        for (i = 0; i < strlen (key); i++) {
                                if (!g_ascii_isxdigit (key[i])) {
-                                       widget_set_error (entry);
+                                       widget_set_error (sec->wep_key_entry);
                                        g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid wep-key: 
key with a length of %zu must contain only hex-digits"), strlen (key));
                                        return FALSE;
                                }
@@ -110,19 +121,19 @@ validate (NMAWs *parent, GError **error)
                } else if ((strlen (key) == 5) || (strlen (key) == 13)) {
                        for (i = 0; i < strlen (key); i++) {
                                if (!utils_char_is_ascii_print (key[i])) {
-                                       widget_set_error (entry);
+                                       widget_set_error (sec->wep_key_entry);
                                        g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid wep-key: 
key with a length of %zu must contain only ascii characters"), strlen (key));
                                        return FALSE;
                                }
                        }
                } else {
-                       widget_set_error (entry);
+                       widget_set_error (sec->wep_key_entry);
                        g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid wep-key: wrong key 
length %zu. A key must be either of length 5/13 (ascii) or 10/26 (hex)"), strlen (key));
                        return FALSE;
                }
-       } else if (sec->type == NM_WEP_KEY_TYPE_PASSPHRASE) {
+       } else if (sec->key_type == NM_WEP_KEY_TYPE_PASSPHRASE) {
                if (!*key || (strlen (key) > 64)) {
-                       widget_set_error (entry);
+                       widget_set_error (sec->wep_key_entry);
                        if (!*key)
                                g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid wep-key: 
passphrase must be non-empty"));
                        else
@@ -130,7 +141,7 @@ validate (NMAWs *parent, GError **error)
                        return FALSE;
                }
        }
-       widget_unset_error (entry);
+       widget_unset_error (sec->wep_key_entry);
 
        return TRUE;
 }
@@ -138,35 +149,25 @@ validate (NMAWs *parent, GError **error)
 static void
 add_to_size_group (NMAWs *parent, GtkSizeGroup *group)
 {
-       GtkWidget *widget;
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "auth_method_label"));
-       gtk_size_group_add_widget (group, widget);
+       NMAWsWepKey *sec = NMA_WS_WEP_KEY (parent);
 
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wep_key_label"));
-       gtk_size_group_add_widget (group, widget);
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "key_index_label"));
-       gtk_size_group_add_widget (group, widget);
+       gtk_size_group_add_widget (group, sec->auth_method_label);
+       gtk_size_group_add_widget (group, sec->wep_key_label);
+       gtk_size_group_add_widget (group, sec->key_index_label);
 }
 
 static void
 fill_connection (NMAWs *parent, NMConnection *connection)
 {
-       NMAWsWEPKey *sec = (NMAWsWEPKey *) parent;
+       NMAWsWepKey *sec = NMA_WS_WEP_KEY (parent);
        NMSettingWirelessSecurity *s_wsec;
        NMSettingSecretFlags secret_flags;
-       GtkWidget *widget, *passwd_entry;
-       gint auth_alg;
+       int auth_alg;
        const char *key;
        int i;
 
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "auth_method_combo"));
-       auth_alg = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wep_key_entry"));
-       passwd_entry = widget;
-       key = gtk_editable_get_text (GTK_EDITABLE (widget));
+       auth_alg = gtk_combo_box_get_active (GTK_COMBO_BOX (sec->auth_method_combo));
+       key = gtk_editable_get_text (GTK_EDITABLE (sec->wep_key_entry));
        g_strlcpy (sec->keys[sec->cur_index], key, sizeof (sec->keys[sec->cur_index]));
 
        /* Blow away the old security setting by adding a clear one */
@@ -177,7 +178,7 @@ fill_connection (NMAWs *parent, NMConnection *connection)
                      NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "none",
                      NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, sec->cur_index,
                      NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, (auth_alg == 1) ? "shared" : "open",
-                     NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, sec->type,
+                     NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, sec->key_type,
                      NULL);
 
        for (i = 0; i < 4; i++) {
@@ -186,25 +187,27 @@ fill_connection (NMAWs *parent, NMConnection *connection)
        }
 
        /* Save WEP_KEY_FLAGS to the connection */
-       secret_flags = nma_utils_menu_to_secret_flags (passwd_entry);
+       secret_flags = nma_utils_menu_to_secret_flags (sec->wep_key_entry);
        g_object_set (s_wsec, NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS, secret_flags, NULL);
 
        /* Update secret flags and popup when editing the connection */
-       if (sec->editing_connection)
-               nma_utils_update_password_storage (passwd_entry, secret_flags,
-                                                  NM_SETTING (s_wsec), sec->password_flags_name);
+       if (!sec->secrets_only) {
+               nma_utils_update_password_storage (sec->wep_key_entry, secret_flags,
+                                                  NM_SETTING (s_wsec),
+                                                  NM_SETTING_WIRELESS_SECURITY_WEP_KEY0);
+       }
 }
 
 static void
 wep_entry_filter_cb (GtkEditable *editable,
-                     gchar *text,
-                     gint length,
-                     gint *position,
+                     char *text,
+                     int length,
+                     int *position,
                      gpointer data)
 {
-       NMAWsWEPKey *sec = (NMAWsWEPKey *) data;
+       NMAWsWepKey *sec = NMA_WS_WEP_KEY (data);
 
-       if (sec->type == NM_WEP_KEY_TYPE_KEY) {
+       if (sec->key_type == NM_WEP_KEY_TYPE_KEY) {
                utils_filter_editable_on_insert_text (editable,
                                                      text, length, position, data,
                                                      utils_char_is_ascii_print,
@@ -212,12 +215,12 @@ wep_entry_filter_cb (GtkEditable *editable,
        }
 }
 
+
 static void
 update_secrets (NMAWs *parent, NMConnection *connection)
 {
-       NMAWsWEPKey *sec = (NMAWsWEPKey *) parent;
+       NMAWsWepKey *sec = NMA_WS_WEP_KEY (parent);
        NMSettingWirelessSecurity *s_wsec;
-       GtkEditable *entry;
        const char *tmp;
        int i;
 
@@ -228,63 +231,112 @@ update_secrets (NMAWs *parent, NMConnection *connection)
                        g_strlcpy (sec->keys[i], tmp, sizeof (sec->keys[i]));
        }
 
-       entry = GTK_EDITABLE (gtk_builder_get_object (parent->builder, "wep_key_entry"));
-       if (strlen (sec->keys[sec->cur_index]))
-               gtk_editable_set_text (entry, sec->keys[sec->cur_index]);
+       if (strlen (sec->keys[sec->cur_index])) {
+               gtk_editable_set_text (GTK_EDITABLE (sec->wep_key_entry),
+                                      sec->keys[sec->cur_index]);
+       }
 }
 
-NMAWsWEPKey *
-nma_ws_wep_key_new (NMConnection *connection,
-                    NMWepKeyType type,
-                    gboolean adhoc_create,
-                    gboolean secrets_only)
+
+static void
+get_property (GObject *object,
+              guint prop_id,
+              GValue *value,
+              GParamSpec *pspec)
+{
+       NMAWsWepKey *sec = NMA_WS_WEP_KEY (object);
+
+       switch (prop_id) {
+       case PROP_CONNECTION:
+               g_value_set_object (value, sec->connection);
+               break;
+       case PROP_SECRETS_ONLY:
+               g_value_set_boolean (value, sec->secrets_only);
+               break;
+       case PROP_KEY_TYPE:
+               g_value_set_uint (value, sec->key_type);
+               break;
+       case PROP_ADHOC_CREATE:
+               g_value_set_boolean (value, sec->adhoc_create);
+               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)
 {
-       NMAWs *parent;
-       NMAWsWEPKey *sec;
-       GtkWidget *widget;
+       NMAWsWepKey *sec = NMA_WS_WEP_KEY (object);
+
+       switch (prop_id) {
+       case PROP_CONNECTION:
+               sec->connection = g_value_dup_object (value);
+               break;
+       case PROP_SECRETS_ONLY:
+               sec->secrets_only = g_value_get_boolean (value);
+               break;
+       case PROP_KEY_TYPE:
+               sec->key_type = g_value_get_uint (value);
+               break;
+       case PROP_ADHOC_CREATE:
+               sec->adhoc_create = g_value_get_boolean (value);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+nma_ws_wep_key_init (NMAWsWepKey *sec)
+{
+       gtk_widget_init_template (GTK_WIDGET (sec));
+}
+
+static void
+nma_ws_interface_init (NMAWsInterface *iface)
+{
+       iface->validate = validate;
+       iface->add_to_size_group = add_to_size_group;
+       iface->fill_connection = fill_connection;
+       iface->update_secrets = update_secrets;
+       iface->adhoc_compatible = TRUE;
+       iface->hotspot_compatible = TRUE;
+}
+
+static void
+constructed (GObject *object)
+{
+       NMAWsWepKey *sec = NMA_WS_WEP_KEY (object);
        NMSettingWirelessSecurity *s_wsec = NULL;
        NMSetting *setting = NULL;
        guint8 default_key_idx = 0;
-       gboolean is_adhoc = adhoc_create;
+       gboolean is_adhoc = sec->adhoc_create;
        gboolean is_shared_key = FALSE;
 
-       parent = nma_ws_init (sizeof (NMAWsWEPKey),
-                             validate,
-                             add_to_size_group,
-                             fill_connection,
-                             update_secrets,
-                             destroy,
-                             "/org/gnome/libnma/nma-ws-wep-key.ui",
-                             "wep_key_notebook",
-                             "wep_key_entry");
-       if (!parent)
-               return NULL;
-
-       sec = (NMAWsWEPKey *) parent;
-       sec->editing_connection = secrets_only ? FALSE : TRUE;
-       sec->password_flags_name = NM_SETTING_WIRELESS_SECURITY_WEP_KEY0;
-       sec->type = type;
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wep_key_entry"));
-       g_assert (widget);
-       gtk_editable_set_width_chars (GTK_EDITABLE (widget), 28);
 
        /* Create password-storage popup menu for password entry under entry's secondary icon */
-       if (connection)
-               setting = (NMSetting *) nm_connection_get_setting_wireless_security (connection);
-       nma_utils_setup_password_storage (widget, 0, setting, sec->password_flags_name,
-                                         FALSE, secrets_only);
+       if (sec->connection)
+               setting = (NMSetting *) nm_connection_get_setting_wireless_security (sec->connection);
+       nma_utils_setup_password_storage (sec->wep_key_entry, 0, setting,
+                                         NM_SETTING_WIRELESS_SECURITY_WEP_KEY0,
+                                         FALSE, sec->secrets_only);
 
-       if (connection) {
+       if (sec->connection) {
                NMSettingWireless *s_wireless;
                const char *mode, *auth_alg;
 
-               s_wireless = nm_connection_get_setting_wireless (connection);
+               s_wireless = nm_connection_get_setting_wireless (sec->connection);
                mode = s_wireless ? nm_setting_wireless_get_mode (s_wireless) : NULL;
                if (mode && !strcmp (mode, "adhoc"))
                        is_adhoc = TRUE;
 
-               s_wsec = nm_connection_get_setting_wireless_security (connection);
+               s_wsec = nm_connection_get_setting_wireless_security (sec->connection);
                if (s_wsec) {
                        auth_alg = nm_setting_wireless_security_get_auth_alg (s_wsec);
                        if (auth_alg && !strcmp (auth_alg, "shared"))
@@ -292,62 +344,119 @@ nma_ws_wep_key_new (NMConnection *connection,
                }
        }
 
-       g_signal_connect (G_OBJECT (widget), "changed",
-                         (GCallback) nma_ws_changed_cb,
-                         sec);
-       g_signal_connect (G_OBJECT (widget), "insert-text",
-                         (GCallback) wep_entry_filter_cb,
-                         sec);
-       if (sec->type == NM_WEP_KEY_TYPE_KEY)
-               gtk_entry_set_max_length (GTK_ENTRY (widget), 26);
-       else if (sec->type == NM_WEP_KEY_TYPE_PASSPHRASE)
-               gtk_entry_set_max_length (GTK_ENTRY (widget), 64);
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "key_index_combo"));
-       if (connection && s_wsec)
+       if (sec->key_type == NM_WEP_KEY_TYPE_KEY)
+               gtk_entry_set_max_length (GTK_ENTRY (sec->wep_key_entry), 26);
+       else if (sec->key_type == NM_WEP_KEY_TYPE_PASSPHRASE)
+               gtk_entry_set_max_length (GTK_ENTRY (sec->wep_key_entry), 64);
+
+       if (sec->connection && s_wsec)
                default_key_idx = nm_setting_wireless_security_get_wep_tx_keyidx (s_wsec);
 
-       gtk_combo_box_set_active (GTK_COMBO_BOX (widget), default_key_idx);
+       gtk_combo_box_set_active (GTK_COMBO_BOX (sec->key_index_combo), default_key_idx);
        sec->cur_index = default_key_idx;
-       g_signal_connect (G_OBJECT (widget), "changed",
-                         (GCallback) key_index_combo_changed_cb,
-                         sec);
 
        /* Key index is useless with adhoc networks */
-       if (is_adhoc || secrets_only) {
-               gtk_widget_hide (widget);
-               widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "key_index_label"));
-               gtk_widget_hide (widget);
+       if (is_adhoc || sec->secrets_only) {
+               gtk_widget_hide (sec->key_index_combo);
+               gtk_widget_hide (sec->key_index_label);
        }
 
        /* Fill the key entry with the key for that index */
-       if (connection)
-               update_secrets (NMA_WS (sec), connection);
+       if (sec->connection)
+               update_secrets (NMA_WS (sec), sec->connection);
 
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_wep"));
-       g_assert (widget);
-       g_signal_connect (G_OBJECT (widget), "toggled",
-                         (GCallback) show_toggled_cb,
-                         sec);
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "auth_method_combo"));
-       gtk_combo_box_set_active (GTK_COMBO_BOX (widget), is_shared_key ? 1 : 0);
-
-       g_signal_connect (G_OBJECT (widget), "changed",
-                         (GCallback) nma_ws_changed_cb,
-                         sec);
+       gtk_combo_box_set_active (GTK_COMBO_BOX (sec->auth_method_combo),
+                                 is_shared_key ? 1 : 0);
 
        /* Don't show auth method for adhoc (which always uses open-system) or
         * when in "simple" mode.
         */
-       if (is_adhoc || secrets_only) {
+       if (is_adhoc || sec->secrets_only) {
                /* Ad-Hoc connections can't use Shared Key auth */
                if (is_adhoc)
-                       gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
-               gtk_widget_hide (widget);
-               widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "auth_method_label"));
-               gtk_widget_hide (widget);
+                       gtk_combo_box_set_active (GTK_COMBO_BOX (sec->auth_method_combo), 0);
+               gtk_widget_hide (sec->auth_method_combo);
+               gtk_widget_hide (sec->auth_method_label);
        }
 
-       return sec;
+       gtk_widget_grab_focus (sec->wep_key_entry);
+
+       G_OBJECT_CLASS (nma_ws_wep_key_parent_class)->constructed (object);
+}
+
+NMAWsWepKey *
+nma_ws_wep_key_new (NMConnection *connection,
+                    NMWepKeyType key_type,
+                    gboolean adhoc_create,
+                    gboolean secrets_only)
+{
+       return g_object_new (NMA_TYPE_WS_WEP_KEY,
+                            "connection", connection,
+                            "key-type", key_type,
+                            "adhoc-create", adhoc_create,
+                            "secrets-only", secrets_only,
+                            NULL);
+}
+
+static void
+dispose (GObject *object)
+{
+       NMAWsWepKey *sec = NMA_WS_WEP_KEY (object);
+       int i;
+
+       g_clear_object (&sec->connection);
+
+       // XXX if this wasn't useless it would be unsafe
+       for (i = 0; i < 4; i++)
+               memset (sec->keys[i], 0, sizeof (sec->keys[i]));
+}
+
+static void
+nma_ws_wep_key_class_init (NMAWsWepKeyClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+       object_class->get_property = get_property;
+       object_class->set_property = set_property;
+       object_class->constructed = constructed;
+       object_class->dispose = dispose;
+
+       g_object_class_override_property (object_class,
+                                         PROP_CONNECTION, "connection");
+
+       g_object_class_override_property (object_class,
+                                         PROP_SECRETS_ONLY, "secrets-only");
+
+       g_object_class_install_property
+               (object_class, PROP_KEY_TYPE,
+                g_param_spec_uint ("key-type", "", "",
+                                   0, G_MAXUINT, 0,
+                                     G_PARAM_READWRITE
+                                   | G_PARAM_CONSTRUCT
+                                   | G_PARAM_STATIC_STRINGS));
+
+       g_object_class_install_property
+               (object_class, PROP_ADHOC_CREATE,
+               g_param_spec_boolean ("adhoc-create", "", "",
+                                     FALSE,
+                                       G_PARAM_READWRITE
+                                     | G_PARAM_CONSTRUCT
+                                     | G_PARAM_STATIC_STRINGS));
+
+        gtk_widget_class_set_template_from_resource (widget_class,
+                                                     "/org/gnome/libnma/nma-ws-wep-key.ui");
+
+       gtk_widget_class_bind_template_child (widget_class, NMAWsWepKey, auth_method_combo);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsWepKey, auth_method_label);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsWepKey, key_index_combo);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsWepKey, key_index_label);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsWepKey, show_checkbutton_wep);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsWepKey, wep_key_entry);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsWepKey, wep_key_label);
+
+       gtk_widget_class_bind_template_callback (widget_class, key_index_combo_changed_cb);
+       gtk_widget_class_bind_template_callback (widget_class, nma_ws_changed_cb);
+       gtk_widget_class_bind_template_callback (widget_class, show_toggled_cb);
+       gtk_widget_class_bind_template_callback (widget_class, wep_entry_filter_cb);
 }
diff --git a/src/nma-ws/nma-ws-wep-key.h b/src/nma-ws/nma-ws-wep-key.h
index 98ecb111..1fd5e32b 100644
--- a/src/nma-ws/nma-ws-wep-key.h
+++ b/src/nma-ws/nma-ws-wep-key.h
@@ -5,14 +5,23 @@
  * Copyright 2007 - 2019 Red Hat, Inc.
  */
 
-#ifndef WS_WEP_KEY_H
-#define WS_WEP_KEY_H
+#ifndef NMA_WS_WEP_KEY_H
+#define NMA_WS_WEP_KEY_H
 
-typedef struct _NMAWsWEPKey NMAWsWEPKey;
+typedef struct _NMAWsWepKey NMAWsWepKey;
 
-NMAWsWEPKey *nma_ws_wep_key_new (NMConnection *connection,
+#define NMA_TYPE_WS_WEP_KEY            (nma_ws_wep_key_get_type ())
+#define NMA_WS_WEP_KEY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMA_TYPE_WS_WEP_KEY, NMAWsWepKey))
+#define NMA_WS_WEP_KEY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NMA_TYPE_WS_WEP_KEY, 
NMAWsWepKeyClass))
+#define NMA_IS_WS_WEP_KEY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMA_TYPE_WS_WEP_KEY))
+#define NMA_IS_WS_WEP_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NMA_TYPE_WS_WEP_KEY))
+#define NMA_WS_WEP_KEY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NMA_TYPE_WS_WEP_KEY, 
NMAWsWepKeyClass))
+
+GType nma_ws_wep_key_get_type (void);
+
+NMAWsWepKey *nma_ws_wep_key_new (NMConnection *connection,
                                  NMWepKeyType type,
                                  gboolean adhoc_create,
                                  gboolean secrets_only);
 
-#endif /* WS_WEP_KEY_H */
+#endif /* NMA_WS_WEP_KEY_H */
diff --git a/src/nma-ws/nma-ws-wep-key.ui b/src/nma-ws/nma-ws-wep-key.ui
index 44ccd180..f3e627d1 100644
--- a/src/nma-ws/nma-ws-wep-key.ui
+++ b/src/nma-ws/nma-ws-wep-key.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="nm-applet">
   <requires lib="gtk+" version="3.10"/>
   <object class="GtkListStore" id="model3">
@@ -36,137 +36,126 @@
       </row>
     </data>
   </object>
-  <object class="GtkNotebook" id="wep_key_notebook">
+  <template class="NMAWsWepKey" parent="GtkGrid">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="show_tabs">False</property>
-    <property name="show_border">False</property>
+    <property name="row_spacing">6</property>
+    <property name="column_spacing">6</property>
     <child>
-      <object class="GtkGrid" id="table6">
+      <object class="GtkLabel" id="wep_key_label">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="row_spacing">6</property>
-        <property name="column_spacing">6</property>
-        <child>
-          <object class="GtkLabel" id="wep_key_label">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">_Key</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">wep_key_entry</property>
-            <property name="xalign">1</property>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="wep_key_entry">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hexpand">True</property>
-            <property name="max_length">64</property>
-            <property name="visibility">False</property>
-            <property name="activates_default">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkCheckButton" id="show_checkbutton_wep">
-            <property name="label" translatable="yes">Sho_w key</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
-            <property name="hexpand">True</property>
-            <property name="use_underline">True</property>
-            <property name="draw_indicator">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="auth_method_label">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">Au_thentication</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">auth_method_combo</property>
-            <property name="xalign">1</property>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">3</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkComboBox" id="auth_method_combo">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
-            <property name="model">model3</property>
-            <child>
-              <object class="GtkCellRendererText" id="renderer3"/>
-              <attributes>
-                <attribute name="text">0</attribute>
-              </attributes>
-            </child>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">3</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="key_index_label">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">WEP inde_x</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">key_index_combo</property>
-            <property name="xalign">1</property>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkComboBox" id="key_index_combo">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
-            <property name="model">model4</property>
-            <child>
-              <object class="GtkCellRendererText" id="renderer4"/>
-              <attributes>
-                <attribute name="text">0</attribute>
-              </attributes>
-            </child>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
+        <property name="label" translatable="yes">_Key</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">wep_key_entry</property>
+        <property name="xalign">1</property>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkEntry" id="wep_key_entry">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="hexpand">True</property>
+        <property name="max_length">64</property>
+        <property name="visibility">False</property>
+        <property name="activates_default">True</property>
+        <property name="width_chars">28</property>
+        <signal name="changed" handler="nma_ws_changed_cb" swapped="no"/>
+        <signal name="insert-text" handler="wep_entry_filter_cb" swapped="no"/>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="show_checkbutton_wep">
+        <property name="label" translatable="yes">Sho_w key</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="hexpand">True</property>
+        <property name="use_underline">True</property>
+        <property name="draw_indicator">True</property>
+        <signal name="toggled" handler="show_toggled_cb" swapped="no"/>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="auth_method_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Au_thentication</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">auth_method_combo</property>
+        <property name="xalign">1</property>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">3</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkComboBox" id="auth_method_combo">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="model">model3</property>
         <child>
-          <placeholder/>
+          <object class="GtkCellRendererText" id="renderer3"/>
+          <attributes>
+            <attribute name="text">0</attribute>
+          </attributes>
         </child>
+        <signal name="changed" handler="nma_ws_changed_cb" swapped="no"/>
       </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">3</property>
+      </packing>
     </child>
-    <child type="tab">
-      <object class="GtkLabel" id="label23">
+    <child>
+      <object class="GtkLabel" id="key_index_label">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="label" translatable="yes">WEP inde_x</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">key_index_combo</property>
+        <property name="xalign">1</property>
       </object>
       <packing>
-        <property name="tab_fill">False</property>
+        <property name="left_attach">0</property>
+        <property name="top_attach">2</property>
       </packing>
     </child>
-  </object>
+    <child>
+      <object class="GtkComboBox" id="key_index_combo">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="model">model4</property>
+        <child>
+          <object class="GtkCellRendererText" id="renderer4"/>
+          <attributes>
+            <attribute name="text">0</attribute>
+          </attributes>
+        </child>
+        <signal name="changed" handler="key_index_combo_changed_cb" swapped="no"/>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">2</property>
+      </packing>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+  </template>
 </interface>
diff --git a/src/nma-ws/nma-ws-wpa-eap.c b/src/nma-ws/nma-ws-wpa-eap.c
index 81193840..b18a1ef2 100644
--- a/src/nma-ws/nma-ws-wpa-eap.c
+++ b/src/nma-ws/nma-ws-wpa-eap.c
@@ -4,58 +4,34 @@
  *
  * Copyright 2007 - 2019 Red Hat, Inc.
  */
-
 #include "nm-default.h"
-
-#include <ctype.h>
-#include <string.h>
+#include "nma-private.h"
 
 #include "nma-ws.h"
-#include "nma-eap.h"
+#include "nma-ws-private.h"
+#include "nma-ws-802-1x.h"
+#include "nma-ws-802-1x-private.h"
+#include "nma-ws-wpa-eap.h"
 
-struct _NMAWsWPAEAP {
-       NMAWs parent;
+typedef struct {
+       NMAWs8021xClass parent;
+} NMAWsWpaEapClass;
 
-       GtkSizeGroup *size_group;
+struct _NMAWsWpaEap {
+       NMAWs8021x parent;
 };
 
+static void nma_ws_interface_init (NMAWsInterface *iface);
 
-static void
-destroy (NMAWs *parent)
-{
-       NMAWsWPAEAP *sec = (NMAWsWPAEAP *) parent;
-
-       if (sec->size_group)
-               g_object_unref (sec->size_group);
-}
-
-static gboolean
-validate (NMAWs *parent, GError **error)
-{
-       return nma_ws_802_1x_validate (parent, "wpa_eap_auth_combo", error);
-}
-
-static void
-add_to_size_group (NMAWs *parent, GtkSizeGroup *group)
-{
-       NMAWsWPAEAP *sec = (NMAWsWPAEAP *) parent;
-
-       if (sec->size_group)
-               g_object_unref (sec->size_group);
-       sec->size_group = g_object_ref (group);
-
-       nma_ws_802_1x_add_to_size_group (parent,
-                                        sec->size_group,
-                                        "wpa_eap_auth_label",
-                                        "wpa_eap_auth_combo");
-}
+G_DEFINE_TYPE_WITH_CODE (NMAWsWpaEap, nma_ws_wpa_eap, NMA_TYPE_WS_802_1X,
+                         G_IMPLEMENT_INTERFACE (NMA_TYPE_WS, nma_ws_interface_init))
 
 static void
 fill_connection (NMAWs *parent, NMConnection *connection)
 {
        NMSettingWirelessSecurity *s_wireless_sec;
 
-       nma_ws_802_1x_fill_connection (parent, "wpa_eap_auth_combo", connection);
+       nma_ws_802_1x_fill_connection (parent, connection);
 
        s_wireless_sec = nm_connection_get_setting_wireless_security (connection);
        g_assert (s_wireless_sec);
@@ -64,56 +40,28 @@ fill_connection (NMAWs *parent, NMConnection *connection)
 }
 
 static void
-auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
+nma_ws_wpa_eap_init (NMAWsWpaEap *sec)
 {
-       NMAWs *parent = NMA_WS (user_data);
-       NMAWsWPAEAP *sec = (NMAWsWPAEAP *) parent;
-
-       nma_ws_802_1x_auth_combo_changed (combo,
-                                         parent,
-                                         "wpa_nma_eap_vbox",
-                                         sec->size_group);
 }
 
 static void
-update_secrets (NMAWs *parent, NMConnection *connection)
+nma_ws_interface_init (NMAWsInterface *iface)
 {
-       nma_ws_802_1x_update_secrets (parent, "wpa_eap_auth_combo", connection);
+       iface->fill_connection = fill_connection;
 }
 
-NMAWsWPAEAP *
+NMAWsWpaEap *
 nma_ws_wpa_eap_new (NMConnection *connection,
-                    gboolean is_editor,
-                    gboolean secrets_only,
-                    const char *const*secrets_hints)
+                        gboolean is_editor, // XXX
+                        gboolean secrets_only)
 {
-       NMAWs *parent;
-       GtkWidget *widget;
-
-       parent = nma_ws_init (sizeof (NMAWsWPAEAP),
-                             validate,
-                             add_to_size_group,
-                             fill_connection,
-                             update_secrets,
-                             destroy,
-                             "/org/gnome/libnma/nma-ws-wpa-eap.ui",
-                             "wpa_eap_notebook",
-                             NULL);
-       if (!parent)
-               return NULL;
-
-       parent->adhoc_compatible = FALSE;
-       parent->hotspot_compatible = FALSE;
-
-       widget = nma_ws_802_1x_auth_combo_init (parent,
-                                               "wpa_eap_auth_combo",
-                                               "wpa_eap_auth_label",
-                                               (GCallback) auth_combo_changed_cb,
-                                               connection,
-                                               is_editor,
-                                               secrets_only,
-                                               secrets_hints);
-       auth_combo_changed_cb (widget, parent);
+       return g_object_new (NMA_TYPE_WS_WPA_EAP,
+                            "connection", connection,
+                            "secrets-only", secrets_only,
+                            NULL);
+}
 
-       return (NMAWsWPAEAP *) parent;
+static void
+nma_ws_wpa_eap_class_init (NMAWsWpaEapClass *klass)
+{
 }
diff --git a/src/nma-ws/nma-ws-wpa-eap.h b/src/nma-ws/nma-ws-wpa-eap.h
index e3b39beb..0a41f0e7 100644
--- a/src/nma-ws/nma-ws-wpa-eap.h
+++ b/src/nma-ws/nma-ws-wpa-eap.h
@@ -5,14 +5,22 @@
  * Copyright 2007 - 2019 Red Hat, Inc.
  */
 
-#ifndef WS_WPA_EAP_H
-#define WS_WPA_EAP_H
+#ifndef NMA_WS_WPA_EAP_H
+#define NMA_WS_WPA_EAP_H
 
-typedef struct _NMAWsWPAEAP NMAWsWPAEAP;
+typedef struct _NMAWsWpaEap NMAWsWpaEap;
 
-NMAWsWPAEAP *nma_ws_wpa_eap_new (NMConnection *connection,
+#define NMA_TYPE_WS_WPA_EAP            (nma_ws_wpa_eap_get_type ())
+#define NMA_WS_WPA_EAP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMA_TYPE_WS_SAE, NMAWsWpaEap))
+#define NMA_WS_WPA_EAP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NMA_TYPE_WS_SAE, NMAWsWpaEapClass))
+#define NMA_IS_WS_WPA_EAP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMA_TYPE_WS_SAE))
+#define NMA_IS_WS_WPA_EAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NMA_TYPE_WS_SAE))
+#define NMA_WS_WPA_EAP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NMA_TYPE_WS_SAE, NMAWsWpaEapClass))
+
+GType nma_ws_wpa_eap_get_type (void);
+
+NMAWsWpaEap *nma_ws_wpa_eap_new (NMConnection *connection,
                                  gboolean is_editor,
-                                 gboolean secrets_only,
-                                 const char *const*secrets_hints);
+                                 gboolean secrets_only);
 
-#endif /* WS_WPA_EAP_H */
+#endif /* NMA_WS_WPA_EAP_H */
diff --git a/src/nma-ws/nma-ws-wpa-psk.c b/src/nma-ws/nma-ws-wpa-psk.c
index d3a8aab1..372528da 100644
--- a/src/nma-ws/nma-ws-wpa-psk.c
+++ b/src/nma-ws/nma-ws-wpa-psk.c
@@ -12,66 +12,84 @@
 #include <string.h>
 
 #include "nma-ws.h"
-#include "helpers.h"
+#include "nma-ws-private.h"
+#include "nma-ws-wpa-psk.h"
+#include "nma-ws-helpers.h"
 #include "nma-ui-utils.h"
 #include "utils.h"
 
 #define WPA_PMK_LEN 32
 
-struct _NMAWsWPAPSK {
-       NMAWs parent;
+typedef struct {
+       GtkGridClass parent;
+} NMAWsWpaPskClass;
 
-       gboolean editing_connection;
-       const char *password_flags_name;
+struct _NMAWsWpaPsk {
+       GtkGrid parent;
+
+       GtkWidget *wpa_psk_entry;
+       GtkWidget *wpa_psk_label;
+       GtkWidget *wpa_psk_type_combo;
+       GtkWidget *wpa_psk_type_label;
+       GtkWidget *show_checkbutton_wpa;
+
+       NMConnection *connection;
+       gboolean secrets_only;
+};
+
+static void nma_ws_interface_init (NMAWsInterface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (NMAWsWpaPsk, nma_ws_wpa_psk, GTK_TYPE_GRID,
+                         G_IMPLEMENT_INTERFACE (NMA_TYPE_WS, nma_ws_interface_init))
+
+enum {
+       PROP_0,
+       PROP_CONNECTION,
+       PROP_SECRETS_ONLY,
+       PROP_LAST
 };
 
 static void
-show_toggled_cb (GtkCheckButton *button, NMAWs *sec)
+show_toggled_cb (GtkCheckButton *button, gpointer user_data)
 {
-       GtkWidget *widget;
+       NMAWsWpaPsk *sec = NMA_WS_WPA_PSK (user_data);
        gboolean visible;
 
-       widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, "wpa_psk_entry"));
-       g_assert (widget);
-
        visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
-       gtk_entry_set_visibility (GTK_ENTRY (widget), visible);
+       gtk_entry_set_visibility (GTK_ENTRY (sec->wpa_psk_entry), visible);
 }
 
 static gboolean
 validate (NMAWs *parent, GError **error)
 {
-       GtkWidget *entry;
+       NMAWsWpaPsk *sec = NMA_WS_WPA_PSK (parent);
        NMSettingSecretFlags secret_flags;
        const char *key;
        gsize len;
        int i;
 
-       entry = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wpa_psk_entry"));
-       g_assert (entry);
-
-       secret_flags = nma_utils_menu_to_secret_flags (entry);
-       key = gtk_editable_get_text (GTK_EDITABLE (entry));
+       secret_flags = nma_utils_menu_to_secret_flags (sec->wpa_psk_entry);
+       key = gtk_editable_get_text (GTK_EDITABLE (sec->wpa_psk_entry));
        len = key ? strlen (key) : 0;
 
         if (   secret_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED
             || secret_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED) {
                /* All good. */
        } else if ((len < 8) || (len > 64)) {
-               widget_set_error (entry);
+               widget_set_error (sec->wpa_psk_entry);
                g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid wpa-psk: invalid key-length %zu. 
Must be [8,63] bytes or 64 hex digits"), len);
                return FALSE;
        } else if (len == 64) {
                /* Hex PSK */
                for (i = 0; i < len; i++) {
                        if (!isxdigit (key[i])) {
-                               widget_set_error (entry);
+                               widget_set_error (sec->wpa_psk_entry);
                                g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid wpa-psk: 
cannot interpret key with 64 bytes as hex"));
                                return FALSE;
                        }
                }
        }
-       widget_unset_error (entry);
+       widget_unset_error (sec->wpa_psk_entry);
 
        /* passphrase can be between 8 and 63 characters inclusive */
 
@@ -81,20 +99,16 @@ validate (NMAWs *parent, GError **error)
 static void
 add_to_size_group (NMAWs *parent, GtkSizeGroup *group)
 {
-       GtkWidget *widget;
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wpa_psk_type_label"));
-       gtk_size_group_add_widget (group, widget);
+       NMAWsWpaPsk *sec = NMA_WS_WPA_PSK (parent);
 
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wpa_psk_label"));
-       gtk_size_group_add_widget (group, widget);
+       gtk_size_group_add_widget (group, sec->wpa_psk_type_label);
+       gtk_size_group_add_widget (group, sec->wpa_psk_label);
 }
 
 static void
 fill_connection (NMAWs *parent, NMConnection *connection)
 {
-       NMAWsWPAPSK *wpa_psk = (NMAWsWPAPSK *) parent;
-       GtkWidget *widget, *passwd_entry;
+       NMAWsWpaPsk *wpa_psk = (NMAWsWpaPsk *) parent;
        const char *key;
        NMSettingWireless *s_wireless;
        NMSettingWirelessSecurity *s_wireless_sec;
@@ -103,7 +117,7 @@ fill_connection (NMAWs *parent, NMConnection *connection)
        gboolean is_adhoc = FALSE;
 
        s_wireless = nm_connection_get_setting_wireless (connection);
-       g_assert (s_wireless);
+       g_return_if_fail (s_wireless);
 
        mode = nm_setting_wireless_get_mode (s_wireless);
        if (mode && !strcmp (mode, "adhoc"))
@@ -113,20 +127,20 @@ fill_connection (NMAWs *parent, NMConnection *connection)
        s_wireless_sec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
        nm_connection_add_setting (connection, (NMSetting *) s_wireless_sec);
 
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wpa_psk_entry"));
-       passwd_entry = widget;
-       key = gtk_editable_get_text (GTK_EDITABLE (widget));
+       key = gtk_editable_get_text (GTK_EDITABLE (wpa_psk->wpa_psk_entry));
        g_object_set (s_wireless_sec, NM_SETTING_WIRELESS_SECURITY_PSK, key, NULL);
 
        /* Save PSK_FLAGS to the connection */
-       secret_flags = nma_utils_menu_to_secret_flags (passwd_entry);
+       secret_flags = nma_utils_menu_to_secret_flags (wpa_psk->wpa_psk_entry);
        nm_setting_set_secret_flags (NM_SETTING (s_wireless_sec), NM_SETTING_WIRELESS_SECURITY_PSK,
                                     secret_flags, NULL);
 
        /* Update secret flags and popup when editing the connection */
-       if (wpa_psk->editing_connection)
-               nma_utils_update_password_storage (passwd_entry, secret_flags,
-                                                  NM_SETTING (s_wireless_sec), wpa_psk->password_flags_name);
+       if (!wpa_psk->secrets_only) {
+               nma_utils_update_password_storage (wpa_psk->wpa_psk_entry, secret_flags,
+                                                  NM_SETTING (s_wireless_sec),
+                                                  NM_SETTING_WIRELESS_SECURITY_PSK);
+       }
 
        nma_ws_clear_ciphers (connection);
        if (is_adhoc) {
@@ -147,72 +161,143 @@ fill_connection (NMAWs *parent, NMConnection *connection)
 static void
 update_secrets (NMAWs *parent, NMConnection *connection)
 {
-       helper_fill_secret_entry (connection,
-                                 parent->builder,
-                                 "wpa_psk_entry",
-                                 NM_TYPE_SETTING_WIRELESS_SECURITY,
-                                 (HelperSecretFunc) nm_setting_wireless_security_get_psk);
+       NMAWsWpaPsk *sec = NMA_WS_WPA_PSK (parent);
+
+       nma_ws_helper_fill_secret_entry (connection,
+                                        GTK_EDITABLE (sec->wpa_psk_entry),
+                                        NM_TYPE_SETTING_WIRELESS_SECURITY,
+                                        (HelperSecretFunc) nm_setting_wireless_security_get_psk);
 }
 
-NMAWsWPAPSK *
-nma_ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only)
+static void
+get_property (GObject *object,
+              guint prop_id,
+              GValue *value,
+              GParamSpec *pspec)
+{
+       NMAWsWpaPsk *sec = NMA_WS_WPA_PSK (object);
+
+       switch (prop_id) {
+       case PROP_CONNECTION:
+               g_value_set_object (value, sec->connection);
+               break;
+       case PROP_SECRETS_ONLY:
+               g_value_set_boolean (value, sec->secrets_only);
+               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)
+{
+       NMAWsWpaPsk *sec = NMA_WS_WPA_PSK (object);
+
+       switch (prop_id) {
+       case PROP_CONNECTION:
+               sec->connection = g_value_dup_object (value);
+               break;
+       case PROP_SECRETS_ONLY:
+               sec->secrets_only = g_value_get_boolean (value);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+nma_ws_wpa_psk_init (NMAWsWpaPsk *sec)
+{
+       gtk_widget_init_template (GTK_WIDGET (sec));
+}
+
+static void
+nma_ws_interface_init (NMAWsInterface *iface)
+{
+       iface->validate = validate;
+       iface->add_to_size_group = add_to_size_group;
+       iface->fill_connection = fill_connection;
+       iface->update_secrets = update_secrets;
+       iface->adhoc_compatible = TRUE;
+       iface->hotspot_compatible = TRUE;
+}
+
+static void
+constructed (GObject *object)
 {
-       NMAWs *parent;
-       NMAWsWPAPSK *sec;
+       NMAWsWpaPsk *sec = NMA_WS_WPA_PSK (object);
        NMSetting *setting = NULL;
-       GtkWidget *widget;
-
-       parent = nma_ws_init (sizeof (NMAWsWPAPSK),
-                             validate,
-                             add_to_size_group,
-                             fill_connection,
-                             update_secrets,
-                             NULL,
-                             "/org/gnome/libnma/nma-ws-wpa-psk.ui",
-                             "wpa_psk_notebook",
-                             "wpa_psk_entry");
-       if (!parent)
-               return NULL;
-
-       parent->adhoc_compatible = TRUE;
-       sec = (NMAWsWPAPSK *) parent;
-       sec->editing_connection = secrets_only ? FALSE : TRUE;
-       sec->password_flags_name = NM_SETTING_WIRELESS_SECURITY_PSK;
-
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wpa_psk_entry"));
-       g_assert (widget);
-       g_signal_connect (G_OBJECT (widget), "changed",
-                         (GCallback) nma_ws_changed_cb,
-                         sec);
-       gtk_editable_set_width_chars (GTK_EDITABLE (widget), 28);
 
        /* Create password-storage popup menu for password entry under entry's secondary icon */
-       if (connection)
-               setting = (NMSetting *) nm_connection_get_setting_wireless_security (connection);
-       nma_utils_setup_password_storage (widget, 0, setting, sec->password_flags_name,
-                                         FALSE, secrets_only);
+       if (sec->connection)
+               setting = (NMSetting *) nm_connection_get_setting_wireless_security (sec->connection);
+       nma_utils_setup_password_storage (sec->wpa_psk_entry, 0, setting, NM_SETTING_WIRELESS_SECURITY_PSK,
+                                         FALSE, sec->secrets_only);
 
        /* Fill secrets, if any */
-       if (connection)
-               update_secrets (NMA_WS (sec), connection);
+       if (sec->connection)
+               update_secrets (NMA_WS (sec), sec->connection);
 
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_wpa"));
-       g_assert (widget);
-       g_signal_connect (G_OBJECT (widget), "toggled",
-                         (GCallback) show_toggled_cb,
-                         sec);
+       gtk_widget_grab_focus (sec->wpa_psk_entry);
 
        /* Hide WPA/RSN for now since this can be autodetected by NM and the
         * supplicant when connecting to the AP.
         */
+       gtk_widget_hide (sec->wpa_psk_type_combo);
+       gtk_widget_hide (sec->wpa_psk_type_label);
+
+       G_OBJECT_CLASS (nma_ws_wpa_psk_parent_class)->constructed (object);
+}
+
+NMAWsWpaPsk *
+nma_ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only)
+{
+       return g_object_new (NMA_TYPE_WS_WPA_PSK,
+                            "connection", connection,
+                            "secrets-only", secrets_only,
+                            NULL);
+}
+
+static void
+dispose (GObject *object)
+{
+       NMAWsWpaPsk *sec = NMA_WS_WPA_PSK (object);
+
+       g_clear_object (&sec->connection);
+}
+
+static void
+nma_ws_wpa_psk_class_init (NMAWsWpaPskClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+       object_class->get_property = get_property;
+       object_class->set_property = set_property;
+       object_class->constructed = constructed;
+       object_class->dispose = dispose;
+
+       g_object_class_override_property (object_class,
+                                         PROP_CONNECTION, "connection");
+
+       g_object_class_override_property (object_class,
+                                         PROP_SECRETS_ONLY, "secrets-only");
 
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wpa_psk_type_combo"));
-       g_assert (widget);
-       gtk_widget_hide (widget);
+        gtk_widget_class_set_template_from_resource (widget_class,
+                                                     "/org/gnome/libnma/nma-ws-wpa-psk.ui");
 
-       widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wpa_psk_type_label"));
-       g_assert (widget);
-       gtk_widget_hide (widget);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsWpaPsk, wpa_psk_entry);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsWpaPsk, wpa_psk_label);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsWpaPsk, wpa_psk_type_combo);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsWpaPsk, wpa_psk_type_label);
+       gtk_widget_class_bind_template_child (widget_class, NMAWsWpaPsk, show_checkbutton_wpa);
 
-       return sec;
+       gtk_widget_class_bind_template_callback (widget_class, nma_ws_changed_cb);
+       gtk_widget_class_bind_template_callback (widget_class, show_toggled_cb);
 }
diff --git a/src/nma-ws/nma-ws-wpa-psk.h b/src/nma-ws/nma-ws-wpa-psk.h
index 216853dd..b72a57ea 100644
--- a/src/nma-ws/nma-ws-wpa-psk.h
+++ b/src/nma-ws/nma-ws-wpa-psk.h
@@ -5,11 +5,20 @@
  * Copyright 2007 - 2019 Red Hat, Inc.
  */
 
-#ifndef WS_WPA_PSK_H
-#define WS_WPA_PSK_H
+#ifndef NMA_WS_WPA_PSK_H
+#define NMA_WS_WPA_PSK_H
 
-typedef struct _NMAWsWPAPSK NMAWsWPAPSK;
+typedef struct _NMAWsWpaPsk NMAWsWpaPsk;
 
-NMAWsWPAPSK *nma_ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only);
+#define NMA_TYPE_WS_WPA_PSK            (nma_ws_wpa_psk_get_type ())
+#define NMA_WS_WPA_PSK(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMA_TYPE_WS_WPA_PSK, NMAWsWpaPsk))
+#define NMA_WS_WPA_PSK_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NMA_TYPE_WS_WPA_PSK, 
NMAWsWpaPskClass))
+#define NMA_IS_WS_WPA_PSK(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMA_TYPE_WS_WPA_PSK))
+#define NMA_IS_WS_WPA_PSK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NMA_TYPE_WS_WPA_PSK))
+#define NMA_WS_WPA_PSK_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NMA_TYPE_WS_WPA_PSK, 
NMAWsWpaPskClass))
 
-#endif /* WS_WEP_KEY_H */
+GType nma_ws_wpa_psk_get_type (void);
+
+NMAWsWpaPsk *nma_ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only);
+
+#endif /* NMA_WS_WPA_PSK_H */
diff --git a/src/nma-ws/nma-ws-wpa-psk.ui b/src/nma-ws/nma-ws-wpa-psk.ui
index ace15468..17732468 100644
--- a/src/nma-ws/nma-ws-wpa-psk.ui
+++ b/src/nma-ws/nma-ws-wpa-psk.ui
@@ -1,98 +1,83 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="nm-applet">
   <requires lib="gtk+" version="3.10"/>
-  <object class="GtkNotebook" id="wpa_psk_notebook">
+  <template class="NMAWsWpaPsk" parent="GtkGrid">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="show_tabs">False</property>
-    <property name="show_border">False</property>
+    <property name="row_spacing">6</property>
+    <property name="column_spacing">6</property>
     <child>
-      <object class="GtkGrid" id="wpa_psk_table">
+      <object class="GtkLabel" id="wpa_psk_label">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="row_spacing">6</property>
-        <property name="column_spacing">6</property>
-        <child>
-          <object class="GtkLabel" id="wpa_psk_label">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">_Password</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">wpa_psk_entry</property>
-            <property name="xalign">1</property>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkEntry" id="wpa_psk_entry">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hexpand">True</property>
-            <property name="max_length">64</property>
-            <property name="visibility">False</property>
-            <property name="activates_default">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="wpa_psk_type_label">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">_Type</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic_widget">wpa_psk_type_combo</property>
-            <property name="xalign">1</property>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkCheckButton" id="show_checkbutton_wpa">
-            <property name="label" translatable="yes">Sho_w password</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
-            <property name="hexpand">True</property>
-            <property name="use_underline">True</property>
-            <property name="draw_indicator">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkComboBox" id="wpa_psk_type_combo">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-          </object>
-          <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
-          </packing>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
+        <property name="label" translatable="yes">_Password</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">wpa_psk_entry</property>
+        <property name="xalign">1</property>
       </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkEntry" id="wpa_psk_entry">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="hexpand">True</property>
+        <property name="max_length">64</property>
+        <property name="visibility">False</property>
+        <property name="activates_default">True</property>
+        <signal name="changed" handler="nma_ws_changed_cb" swapped="no"/>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="wpa_psk_type_label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Type</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">wpa_psk_type_combo</property>
+        <property name="xalign">1</property>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkCheckButton" id="show_checkbutton_wpa">
+        <property name="label" translatable="yes">Sho_w password</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="hexpand">True</property>
+        <property name="use_underline">True</property>
+        <property name="draw_indicator">True</property>
+        <signal name="toggled" handler="show_toggled_cb" swapped="no"/>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">1</property>
+      </packing>
     </child>
-    <child type="tab">
-      <object class="GtkLabel" id="GtkLabel2">
+    <child>
+      <object class="GtkComboBox" id="wpa_psk_type_combo">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
       </object>
       <packing>
-        <property name="tab_fill">False</property>
+        <property name="left_attach">1</property>
+        <property name="top_attach">2</property>
       </packing>
     </child>
-  </object>
+    <child>
+      <placeholder/>
+    </child>
+  </template>
 </interface>
diff --git a/src/nma-ws/nma-ws.c b/src/nma-ws/nma-ws.c
index 9f0cb94d..41d597b0 100644
--- a/src/nma-ws/nma-ws.c
+++ b/src/nma-ws/nma-ws.c
@@ -10,49 +10,31 @@
 #include <string.h>
 
 #include "nma-ws.h"
+#include "nma-ws-private.h"
 #include "nma-eap.h"
 #include "utils.h"
 
-G_DEFINE_BOXED_TYPE (NMAWs, nma_ws, nma_ws_ref, nma_ws_unref)
-
-GtkWidget *
-nma_ws_get_widget (NMAWs *sec)
-{
-       g_return_val_if_fail (sec != NULL, NULL);
-
-       return sec->ui_widget;
-}
-
-void
-nma_ws_set_changed_notify (NMAWs *sec,
-                           NMAWsChangedFunc func,
-                           gpointer user_data)
-{
-       g_return_if_fail (sec != NULL);
-
-       sec->changed_notify = func;
-       sec->changed_notify_data = user_data;
-}
+G_DEFINE_INTERFACE (NMAWs, nma_ws, G_TYPE_OBJECT)
 
 void
 nma_ws_changed_cb (GtkWidget *ignored, gpointer user_data)
 {
-       NMAWs *sec = NMA_WS (user_data);
-
-       if (sec->changed_notify)
-               (*(sec->changed_notify)) (sec, sec->changed_notify_data);
+       // XXX private
+       g_signal_emit_by_name (user_data, "ws-changed");
 }
 
 gboolean
 nma_ws_validate (NMAWs *sec, GError **error)
 {
+       NMAWsInterface *iface;
        gboolean result;
 
        g_return_val_if_fail (sec != NULL, FALSE);
        g_return_val_if_fail (!error || !*error, FALSE);
 
-       g_assert (sec->validate);
-       result = (*(sec->validate)) (sec, error);
+       iface = NMA_WS_GET_INTERFACE (sec);
+       g_assert (iface->validate);
+       result = (*(iface->validate)) (sec, error);
        if (!result && error && !*error)
                g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Unknown error validating 802.1X 
security"));
        return result;
@@ -61,122 +43,71 @@ nma_ws_validate (NMAWs *sec, GError **error)
 void
 nma_ws_add_to_size_group (NMAWs *sec, GtkSizeGroup *group)
 {
+       NMAWsInterface *iface;
+
        g_return_if_fail (sec != NULL);
        g_return_if_fail (group != NULL);
 
-       g_assert (sec->add_to_size_group);
-       return (*(sec->add_to_size_group)) (sec, group);
+       iface = NMA_WS_GET_INTERFACE (sec);
+       g_assert (iface->add_to_size_group);
+       return (*(iface->add_to_size_group)) (sec, group);
 }
 
 void
 nma_ws_fill_connection (NMAWs *sec,
                         NMConnection *connection)
 {
+       NMAWsInterface *iface;
+
        g_return_if_fail (sec != NULL);
        g_return_if_fail (connection != NULL);
 
-       g_assert (sec->fill_connection);
-       return (*(sec->fill_connection)) (sec, connection);
+       iface = NMA_WS_GET_INTERFACE (sec);
+       g_assert (iface->fill_connection);
+       return (*(iface->fill_connection)) (sec, connection);
 }
 
 void
 nma_ws_update_secrets (NMAWs *sec, NMConnection *connection)
 {
+       NMAWsInterface *iface;
+
        g_return_if_fail (sec != NULL);
        g_return_if_fail (connection != NULL);
 
-       if (sec->update_secrets)
-               sec->update_secrets (sec, connection);
-}
-
-NMAWs *
-nma_ws_ref (NMAWs *sec)
-{
-       g_return_val_if_fail (sec != NULL, NULL);
-       g_return_val_if_fail (sec->refcount > 0, NULL);
-
-       sec->refcount++;
-       return sec;
+       iface = NMA_WS_GET_INTERFACE (sec);
+       if (iface->update_secrets)
+               iface->update_secrets (sec, connection);
 }
 
 void
-nma_ws_unref (NMAWs *sec)
+nma_ws_default_init (NMAWsInterface *iface)
 {
-       g_return_if_fail (sec != NULL);
-       g_return_if_fail (sec->refcount > 0);
-
-       sec->refcount--;
-       if (sec->refcount == 0) {
-               if (sec->destroy)
-                       sec->destroy (sec);
-
-               g_free (sec->username);
-               if (sec->password) {
-                       memset (sec->password, 0, strlen (sec->password));
-                       g_free (sec->password);
-               }
-
-               if (sec->builder)
-                       g_object_unref (sec->builder);
-               if (sec->ui_widget)
-                       g_object_unref (sec->ui_widget);
-               g_slice_free1 (sec->obj_size, sec);
-       }
-}
+       GType iface_type = G_TYPE_FROM_INTERFACE (iface);
 
-NMAWs *
-nma_ws_init (gsize obj_size,
-             NMAWsValidateFunc validate,
-             NMAWsAddToSizeGroupFunc add_to_size_group,
-             NMAWsFillConnectionFunc fill_connection,
-             NMAWsUpdateSecretsFunc update_secrets,
-             NMAWsDestroyFunc destroy,
-             const char *ui_resource,
-             const char *ui_widget_name,
-             const char *default_field)
-{
-       NMAWs *sec;
-       GError *error = NULL;
-
-       g_return_val_if_fail (obj_size > 0, NULL);
-       g_return_val_if_fail (ui_resource != NULL, NULL);
-       g_return_val_if_fail (ui_widget_name != NULL, NULL);
-
-       sec = g_slice_alloc0 (obj_size);
-       g_assert (sec);
-
-       sec->refcount = 1;
-       sec->obj_size = obj_size;
-
-       sec->validate = validate;
-       sec->add_to_size_group = add_to_size_group;
-       sec->fill_connection = fill_connection;
-       sec->update_secrets = update_secrets;
-       sec->default_field = default_field;
-
-       sec->builder = gtk_builder_new ();
-       if (!gtk_builder_add_from_resource (sec->builder, ui_resource, &error)) {
-               g_warning ("Couldn't load UI builder resource %s: %s",
-                          ui_resource, error->message);
-               g_error_free (error);
-               nma_ws_unref (sec);
-               return NULL;
-       }
+       g_signal_new ("ws-changed",
+                     iface_type,
+                     G_SIGNAL_RUN_FIRST,
+                     0, NULL, NULL,
+                     g_cclosure_marshal_VOID__VOID,
+                     G_TYPE_NONE, 0);
 
-       sec->ui_widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, ui_widget_name));
-       if (!sec->ui_widget) {
-               g_warning ("Couldn't load UI widget '%s' from UI file %s",
-                          ui_widget_name, ui_resource);
-               nma_ws_unref (sec);
-               return NULL;
-       }
-       g_object_ref_sink (sec->ui_widget);
+       iface->adhoc_compatible = TRUE;
+       iface->hotspot_compatible = TRUE;
 
-       sec->destroy = destroy;
-       sec->adhoc_compatible = TRUE;
-       sec->hotspot_compatible = TRUE;
+       g_object_interface_install_property (iface,
+               g_param_spec_object ("connection", "", "",
+                                    NM_TYPE_CONNECTION,
+                                      G_PARAM_READWRITE
+                                    | G_PARAM_CONSTRUCT
+                                    | G_PARAM_STATIC_STRINGS));
 
-       return sec;
+       g_object_interface_install_property (iface,
+               g_param_spec_boolean ("secrets-only", "", "",
+                                     FALSE,
+                                       G_PARAM_READWRITE
+                                     | G_PARAM_CONSTRUCT
+                                     | G_PARAM_STATIC_STRINGS));
 }
 
 gboolean
@@ -184,16 +115,19 @@ nma_ws_adhoc_compatible (NMAWs *sec)
 {
        g_return_val_if_fail (sec != NULL, FALSE);
 
-       return sec->adhoc_compatible;
+       return NMA_WS_GET_INTERFACE (sec)->adhoc_compatible;
 }
 
+// unused
+#if 0
 gboolean
 nma_ws_hotspot_compatible (NMAWs *sec)
 {
        g_return_val_if_fail (sec != NULL, FALSE);
 
-       return sec->hotspot_compatible;
+       return NMA_WS_GET_INTERFACE (sec)->hotspot_compatible;
 }
+#endif
 
 void
 nma_ws_set_userpass (NMAWs *sec,
@@ -202,6 +136,7 @@ nma_ws_set_userpass (NMAWs *sec,
                      gboolean always_ask,
                      gboolean show_password)
 {
+#if 0
        g_free (sec->username);
        sec->username = g_strdup (user);
 
@@ -214,6 +149,7 @@ nma_ws_set_userpass (NMAWs *sec,
        if (always_ask != (gboolean) -1)
                sec->always_ask = always_ask;
        sec->show_password = show_password;
+#endif
 }
 
 void
@@ -256,338 +192,3 @@ nma_ws_clear_ciphers (NMConnection *connection)
        nm_setting_wireless_security_clear_pairwise (s_wireless_sec);
        nm_setting_wireless_security_clear_groups (s_wireless_sec);
 }
-
-void
-nma_ws_802_1x_add_to_size_group (NMAWs *sec,
-                                 GtkSizeGroup *size_group,
-                                 const char *label_name,
-                                 const char *combo_name)
-{
-       GtkWidget *widget;
-       GtkTreeModel *model;
-       GtkTreeIter iter;
-       NMAEap *eap;
-
-       widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, label_name));
-       g_assert (widget);
-       gtk_size_group_add_widget (size_group, widget);
-
-       widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, combo_name));
-       g_assert (widget);
-
-       model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
-       gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter);
-       gtk_tree_model_get (model, &iter, AUTH_METHOD_COLUMN, &eap, -1);
-       g_assert (eap);
-       nma_eap_add_to_size_group (eap, size_group);
-       nma_eap_unref (eap);
-}
-
-gboolean
-nma_ws_802_1x_validate (NMAWs *sec, const char *combo_name, GError **error)
-{
-       GtkWidget *widget;
-       GtkTreeModel *model;
-       GtkTreeIter iter;
-       NMAEap *eap = NULL;
-       gboolean valid = FALSE;
-
-       widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, combo_name));
-       g_assert (widget);
-
-       model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
-       gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter);
-       gtk_tree_model_get (model, &iter, AUTH_METHOD_COLUMN, &eap, -1);
-       g_assert (eap);
-       valid = nma_eap_validate (eap, error);
-       nma_eap_unref (eap);
-       return valid;
-}
-
-void
-nma_ws_802_1x_auth_combo_changed (GtkWidget *combo,
-                                  NMAWs *sec,
-                                  const char *vbox_name,
-                                  GtkSizeGroup *size_group)
-{
-       GtkWidget *vbox;
-       NMAEap *eap = NULL;
-       GList *elt, *children;
-       GtkTreeModel *model;
-       GtkTreeIter iter;
-       GtkWidget *eap_widget;
-       GtkWidget *eap_default_widget = NULL;
-
-       vbox = GTK_WIDGET (gtk_builder_get_object (sec->builder, vbox_name));
-       g_assert (vbox);
-
-       /* Remove any previous wireless security widgets */
-       children = gtk_container_get_children (GTK_CONTAINER (vbox));
-       for (elt = children; elt; elt = g_list_next (elt))
-               gtk_container_remove (GTK_CONTAINER (vbox), GTK_WIDGET (elt->data));
-
-       model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
-       gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter);
-       gtk_tree_model_get (model, &iter, AUTH_METHOD_COLUMN, &eap, -1);
-       g_assert (eap);
-
-       eap_widget = nma_eap_get_widget (eap);
-       g_assert (eap_widget);
-       gtk_widget_unparent (eap_widget);
-
-       if (size_group)
-               nma_eap_add_to_size_group (eap, size_group);
-       gtk_container_add (GTK_CONTAINER (vbox), eap_widget);
-
-       /* Refocus the EAP method's default widget */
-       if (eap->default_field) {
-               eap_default_widget = GTK_WIDGET (gtk_builder_get_object (eap->builder, eap->default_field));
-               if (eap_default_widget)
-                       gtk_widget_grab_focus (eap_default_widget);
-       }
-
-       nma_eap_unref (eap);
-
-       nma_ws_changed_cb (combo, NMA_WS (sec));
-}
-
-GtkWidget *
-nma_ws_802_1x_auth_combo_init (NMAWs *sec,
-                               const char *combo_name,
-                               const char *combo_label,
-                               GCallback auth_combo_changed_cb,
-                               NMConnection *connection,
-                               gboolean is_editor,
-                               gboolean secrets_only,
-                               const char *const*secrets_hints)
-{
-       GtkWidget *combo, *widget;
-       GtkListStore *auth_model;
-       GtkTreeIter iter;
-       NMAEapSimple *em_md5;
-       NMAEapTLS *em_tls;
-       NMAEapLEAP *em_leap;
-       NMAEapSimple *em_pwd;
-       NMAEapFAST *em_fast;
-       NMAEapTTLS *em_ttls;
-       NMAEapPEAP *em_peap;
-       const char *default_method = NULL, *ctype = NULL;
-       int active = -1, item = 0;
-       gboolean wired = FALSE;
-       NMAEapSimpleFlags simple_flags = NMA_EAP_SIMPLE_FLAG_NONE;
-
-       /* Grab the default EAP method out of the security object */
-       if (connection) {
-               NMSettingConnection *s_con;
-               NMSetting8021x *s_8021x;
-
-               s_con = nm_connection_get_setting_connection (connection);
-               if (s_con)
-                       ctype = nm_setting_connection_get_connection_type (s_con);
-               if (   (g_strcmp0 (ctype, NM_SETTING_WIRED_SETTING_NAME) == 0)
-                   || nm_connection_get_setting_wired (connection))
-                       wired = TRUE;
-
-               s_8021x = nm_connection_get_setting_802_1x (connection);
-               if (s_8021x && nm_setting_802_1x_get_num_eap_methods (s_8021x))
-                       default_method = nm_setting_802_1x_get_eap_method (s_8021x, 0);
-       }
-
-       /* initialize NMAWs userpass from connection (clear if no connection) */
-       nma_ws_set_userpass_802_1x (sec, connection);
-
-       auth_model = gtk_list_store_new (2, G_TYPE_STRING, nma_eap_get_type ());
-
-       if (is_editor)
-               simple_flags |= NMA_EAP_SIMPLE_FLAG_IS_EDITOR;
-       if (secrets_only)
-               simple_flags |= NMA_EAP_SIMPLE_FLAG_SECRETS_ONLY;
-
-       if (wired) {
-               em_md5 = nma_eap_simple_new (sec, connection, NMA_EAP_SIMPLE_TYPE_MD5, simple_flags, NULL);
-               gtk_list_store_append (auth_model, &iter);
-               gtk_list_store_set (auth_model, &iter,
-                                   AUTH_NAME_COLUMN, _("MD5"),
-                                   AUTH_METHOD_COLUMN, em_md5,
-                                   -1);
-               nma_eap_unref (NMA_EAP (em_md5));
-               if (default_method && (active < 0) && !strcmp (default_method, "md5"))
-                       active = item;
-               item++;
-       }
-
-       em_tls = nma_eap_tls_new (sec, connection, FALSE, secrets_only);
-       gtk_list_store_append (auth_model, &iter);
-       gtk_list_store_set (auth_model, &iter,
-                           AUTH_NAME_COLUMN, _("TLS"),
-                           AUTH_METHOD_COLUMN, em_tls,
-                           -1);
-       nma_eap_unref (NMA_EAP (em_tls));
-       if (default_method && (active < 0) && !strcmp (default_method, "tls"))
-               active = item;
-       item++;
-
-       if (!wired) {
-               em_leap = nma_eap_leap_new (sec, connection, secrets_only);
-               gtk_list_store_append (auth_model, &iter);
-               gtk_list_store_set (auth_model, &iter,
-                                   AUTH_NAME_COLUMN, _("LEAP"),
-                                   AUTH_METHOD_COLUMN, em_leap,
-                                   -1);
-               nma_eap_unref (NMA_EAP (em_leap));
-               if (default_method && (active < 0) && !strcmp (default_method, "leap"))
-                       active = item;
-               item++;
-       }
-
-       em_pwd = nma_eap_simple_new (sec, connection, NMA_EAP_SIMPLE_TYPE_PWD, simple_flags, NULL);
-       gtk_list_store_append (auth_model, &iter);
-       gtk_list_store_set (auth_model, &iter,
-                           AUTH_NAME_COLUMN, _("PWD"),
-                           AUTH_METHOD_COLUMN, em_pwd,
-                           -1);
-       nma_eap_unref (NMA_EAP (em_pwd));
-       if (default_method && (active < 0) && !strcmp (default_method, "pwd"))
-               active = item;
-       item++;
-
-       em_fast = nma_eap_fast_new (sec, connection, is_editor, secrets_only);
-       gtk_list_store_append (auth_model, &iter);
-       gtk_list_store_set (auth_model, &iter,
-                           AUTH_NAME_COLUMN, _("FAST"),
-                           AUTH_METHOD_COLUMN, em_fast,
-                           -1);
-       nma_eap_unref (NMA_EAP (em_fast));
-       if (default_method && (active < 0) && !strcmp (default_method, "fast"))
-               active = item;
-       item++;
-
-       em_ttls = nma_eap_ttls_new (sec, connection, is_editor, secrets_only);
-       gtk_list_store_append (auth_model, &iter);
-       gtk_list_store_set (auth_model, &iter,
-                           AUTH_NAME_COLUMN, _("Tunneled TLS"),
-                           AUTH_METHOD_COLUMN, em_ttls,
-                           -1);
-       nma_eap_unref (NMA_EAP (em_ttls));
-       if (default_method && (active < 0) && !strcmp (default_method, "ttls"))
-               active = item;
-       item++;
-
-       em_peap = nma_eap_peap_new (sec, connection, is_editor, secrets_only);
-       gtk_list_store_append (auth_model, &iter);
-       gtk_list_store_set (auth_model, &iter,
-                           AUTH_NAME_COLUMN, _("Protected EAP (PEAP)"),
-                           AUTH_METHOD_COLUMN, em_peap,
-                           -1);
-       nma_eap_unref (NMA_EAP (em_peap));
-       if (default_method && (active < 0) && !strcmp (default_method, "peap"))
-               active = item;
-       item++;
-
-       if (secrets_hints && secrets_hints[0]) {
-               NMAEapSimple *em_hints;
-
-               em_hints = nma_eap_simple_new (sec, connection, NMA_EAP_SIMPLE_TYPE_UNKNOWN,
-                                                 simple_flags, secrets_hints);
-               gtk_list_store_append (auth_model, &iter);
-               gtk_list_store_set (auth_model, &iter,
-                                   AUTH_NAME_COLUMN, _("Unknown"),
-                                   AUTH_METHOD_COLUMN, em_hints,
-                                   -1);
-               nma_eap_unref (NMA_EAP (em_hints));
-               active = item;
-               item++;
-       } else if (default_method && !strcmp (default_method, "external")) {
-               NMAEapSimple *em_extern;
-               const char *empty_hints[] = { NULL };
-
-               em_extern = nma_eap_simple_new (sec, connection, NMA_EAP_SIMPLE_TYPE_UNKNOWN,
-                                                  simple_flags, empty_hints);
-               gtk_list_store_append (auth_model, &iter);
-               gtk_list_store_set (auth_model, &iter,
-                                   AUTH_NAME_COLUMN, _("Externally configured"),
-                                   AUTH_METHOD_COLUMN, em_extern,
-                                   -1);
-               nma_eap_unref (NMA_EAP (em_extern));
-                       active = item;
-               item++;
-       }
-
-       combo = GTK_WIDGET (gtk_builder_get_object (sec->builder, combo_name));
-       g_assert (combo);
-
-       gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (auth_model));
-       g_object_unref (G_OBJECT (auth_model));
-       gtk_combo_box_set_active (GTK_COMBO_BOX (combo), active < 0 ? 0 : (guint32) active);
-
-       g_signal_connect (G_OBJECT (combo), "changed", auth_combo_changed_cb, sec);
-
-       if (secrets_only) {
-               gtk_widget_hide (combo);
-               widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, combo_label));
-               gtk_widget_hide (widget);
-       }
-
-       return combo;
-}
-
-void
-nma_ws_802_1x_fill_connection (NMAWs *sec,
-                               const char *combo_name,
-                               NMConnection *connection)
-{
-       GtkWidget *widget;
-       NMSettingWirelessSecurity *s_wireless_sec;
-       NMSetting8021x *s_8021x;
-       NMAEap *eap = NULL;
-       GtkTreeModel *model;
-       GtkTreeIter iter;
-
-       /* Get the NMAEap object */
-       widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, combo_name));
-       model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
-       gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter);
-       gtk_tree_model_get (model, &iter, AUTH_METHOD_COLUMN, &eap, -1);
-       g_assert (eap);
-
-       /* Blow away the old wireless security setting by adding a clear one */
-       s_wireless_sec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
-       nm_connection_add_setting (connection, (NMSetting *) s_wireless_sec);
-
-       /* Blow away the old 802.1x setting by adding a clear one */
-       s_8021x = (NMSetting8021x *) nm_setting_802_1x_new ();
-       nm_connection_add_setting (connection, (NMSetting *) s_8021x);
-
-       nma_eap_fill_connection (eap, connection);
-       nma_eap_unref (eap);
-}
-
-void
-nma_ws_802_1x_update_secrets (NMAWs *sec,
-                              const char *combo_name,
-                              NMConnection *connection)
-{
-       GtkWidget *widget;
-       NMAEap *eap = NULL;
-       GtkTreeModel *model;
-       GtkTreeIter iter;
-
-       g_return_if_fail (sec != NULL);
-       g_return_if_fail (combo_name != NULL);
-       g_return_if_fail (connection != NULL);
-
-       widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, combo_name));
-       g_return_if_fail (widget != NULL);
-       model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
-
-       /* Let each EAP method try to update its secrets */
-       if (gtk_tree_model_get_iter_first (model, &iter)) {
-               do {
-                       gtk_tree_model_get (model, &iter, AUTH_METHOD_COLUMN, &eap, -1);
-                       if (eap) {
-                               nma_eap_update_secrets (eap, connection);
-                               nma_eap_unref (eap);
-                       }
-               } while (gtk_tree_model_iter_next (model, &iter));
-       }
-}
diff --git a/src/nma-ws/nma-ws.h b/src/nma-ws/nma-ws.h
index 660bc3b4..bcbbaf51 100644
--- a/src/nma-ws/nma-ws.h
+++ b/src/nma-ws/nma-ws.h
@@ -9,46 +9,13 @@
 #define NMA_WS_H
 
 typedef struct _NMAWs NMAWs;
-GType nma_ws_get_type (void);
-
-#define NMA_TYPE_WS (nma_ws_get_type ())
-#define NMA_WS(x) ((NMAWs *) x)
-
-typedef void (*NMAWsChangedFunc) (NMAWs *sec, gpointer user_data);
-
-typedef void (*NMAWsAddToSizeGroupFunc) (NMAWs *sec, GtkSizeGroup *group);
-typedef void (*NMAWsFillConnectionFunc) (NMAWs *sec, NMConnection *connection);
-typedef void (*NMAWsUpdateSecretsFunc)  (NMAWs *sec, NMConnection *connection);
-typedef void (*NMAWsDestroyFunc)        (NMAWs *sec);
-typedef gboolean (*NMAWsValidateFunc)   (NMAWs *sec, GError **error);
-typedef GtkWidget * (*NMAWsNagUserFunc) (NMAWs *sec);
-
-struct _NMAWs {
-       guint32 refcount;
-       gsize obj_size;
-       GtkBuilder *builder;
-       GtkWidget *ui_widget;
-       NMAWsChangedFunc changed_notify;
-       gpointer changed_notify_data;
-       const char *default_field;
-       gboolean adhoc_compatible;
-       gboolean hotspot_compatible;
-
-       char *username, *password;
-       gboolean always_ask, show_password;
 
-       NMAWsAddToSizeGroupFunc add_to_size_group;
-       NMAWsFillConnectionFunc fill_connection;
-       NMAWsUpdateSecretsFunc update_secrets;
-       NMAWsValidateFunc validate;
-       NMAWsDestroyFunc destroy;
-};
+#define NMA_TYPE_WS                (nma_ws_get_type ())
+#define NMA_WS(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMA_TYPE_WS, NMAWs))
+#define NMA_IS_WS(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMA_TYPE_WS))
+#define NMA_WS_GET_INTERFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NMA_TYPE_WS, NMAWsInterface))
 
-GtkWidget *nma_ws_get_widget (NMAWs *sec);
-
-void nma_ws_set_changed_notify (NMAWs *sec,
-                                NMAWsChangedFunc func,
-                                gpointer user_data);
+GType nma_ws_get_type (void);
 
 gboolean nma_ws_validate (NMAWs *sec, GError **error);
 
@@ -63,7 +30,9 @@ void nma_ws_update_secrets (NMAWs *sec,
 
 gboolean nma_ws_adhoc_compatible (NMAWs *sec);
 
-gboolean nma_ws_hotspot_compatible (NMAWs *sec);
+//gboolean nma_ws_hotspot_compatible (NMAWs *sec);
+
+// XXX
 
 void nma_ws_set_userpass (NMAWs *sec,
                           const char *user,
@@ -73,63 +42,4 @@ void nma_ws_set_userpass (NMAWs *sec,
 void nma_ws_set_userpass_802_1x (NMAWs *sec,
                                  NMConnection *connection);
 
-NMAWs *nma_ws_ref (NMAWs *sec);
-
-void nma_ws_unref (NMAWs *sec);
-
-/* Below for internal use only */
-
-#include "nma-ws-sae.h"
-#include "nma-ws-wep-key.h"
-#include "nma-ws-wpa-psk.h"
-#include "nma-ws-leap.h"
-#include "nma-ws-wpa-eap.h"
-#include "nma-ws-dynamic-wep.h"
-
-NMAWs *nma_ws_init (gsize obj_size,
-                    NMAWsValidateFunc validate,
-                    NMAWsAddToSizeGroupFunc add_to_size_group,
-                    NMAWsFillConnectionFunc fill_connection,
-                    NMAWsUpdateSecretsFunc update_secrets,
-                    NMAWsDestroyFunc destroy,
-                    const char *ui_resource,
-                    const char *ui_widget_name,
-                    const char *default_field);
-
-void nma_ws_changed_cb (GtkWidget *entry, gpointer user_data);
-
-void nma_ws_clear_ciphers (NMConnection *connection);
-
-#define AUTH_NAME_COLUMN   0
-#define AUTH_METHOD_COLUMN 1
-
-GtkWidget *nma_ws_802_1x_auth_combo_init (NMAWs *sec,
-                                          const char *combo_name,
-                                          const char *combo_label,
-                                          GCallback auth_combo_changed_cb,
-                                          NMConnection *connection,
-                                          gboolean is_editor,
-                                          gboolean secrets_only,
-                                          const char *const*secrets_hints);
-
-void nma_ws_802_1x_auth_combo_changed (GtkWidget *combo,
-                                       NMAWs *sec,
-                                       const char *vbox_name,
-                                       GtkSizeGroup *size_group);
-
-gboolean nma_ws_802_1x_validate (NMAWs *sec, const char *combo_name, GError **error);
-
-void nma_ws_802_1x_add_to_size_group (NMAWs *sec,
-                                      GtkSizeGroup *size_group,
-                                      const char *label_name,
-                                      const char *combo_name);
-
-void nma_ws_802_1x_fill_connection (NMAWs *sec,
-                                    const char *combo_name,
-                                    NMConnection *connection);
-
-void nma_ws_802_1x_update_secrets (NMAWs *sec,
-                                   const char *combo_name,
-                                   NMConnection *connection);
-
 #endif /* NMA_WS_H */
diff --git a/src/nma.gresource.xml b/src/nma.gresource.xml
index 569aa275..5c75f112 100644
--- a/src/nma.gresource.xml
+++ b/src/nma.gresource.xml
@@ -7,11 +7,10 @@
                <file preprocess="xml-stripblanks">nma-mobile-wizard.ui</file>
                <file preprocess="xml-stripblanks">nma-vpn-password-dialog.ui</file>
                <file preprocess="xml-stripblanks">nma-bar-code-widget.ui</file>
-                <file preprocess="xml-stripblanks" 
alias="nma-ws-dynamic-wep.ui">nma-ws/nma-ws-dynamic-wep.ui</file>
+                <file preprocess="xml-stripblanks" alias="nma-ws-802-1x.ui">nma-ws/nma-ws-802-1x.ui</file>
                 <file preprocess="xml-stripblanks" alias="nma-ws-leap.ui">nma-ws/nma-ws-leap.ui</file>
                 <file preprocess="xml-stripblanks" alias="nma-ws-sae.ui">nma-ws/nma-ws-sae.ui</file>
                 <file preprocess="xml-stripblanks" alias="nma-ws-wep-key.ui">nma-ws/nma-ws-wep-key.ui</file>
-                <file preprocess="xml-stripblanks" alias="nma-ws-wpa-eap.ui">nma-ws/nma-ws-wpa-eap.ui</file>
                 <file preprocess="xml-stripblanks" alias="nma-ws-wpa-psk.ui">nma-ws/nma-ws-wpa-psk.ui</file>
                 <file preprocess="xml-stripblanks" alias="nma-eap-fast.ui">nma-ws/nma-eap-fast.ui</file>
                 <file preprocess="xml-stripblanks" alias="nma-eap-leap.ui">nma-ws/nma-eap-leap.ui</file>
diff --git a/src/wireless-security/ws-leap.ui b/src/wireless-security/ws-leap.ui
index a93121d6..e772c5a2 100644
--- a/src/wireless-security/ws-leap.ui
+++ b/src/wireless-security/ws-leap.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="nm-applet">
   <requires lib="gtk+" version="3.10"/>
   <object class="GtkNotebook" id="leap_notebook">


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]