[network-manager-applet/thaller/ca-cert-ignore-save-load: 1/3] editor: fix enabling the Apply button for EAP-PEAP and EAP-TTLS.



commit 99b875201ce1cf70d7d77d4324eec78c23bc8e1f
Author: Thomas Haller <thaller redhat com>
Date:   Wed Sep 11 11:24:29 2013 +0200

    editor: fix enabling the Apply button for EAP-PEAP and EAP-TTLS.
    
    The commit 3cae06120a4dd9bebd5f2e57e181ea95e87c8ac4 fixed the issue of
    loading the username/password when editing a connection with EAP-PEAP or
    EAP-TTLS (using EAPMethodSimple) or EAP-LEAP (using EAPMethodLEAP).
    
    There was a small issue when you edited such a connection: when opening
    the configuration dialog, the 'Apply' button was disabled until you switched
    to the security tab.
    
    The problem was, that in order to enable the 'Apply' button, 'validate' of
    the security dialog will be called. 'validate' looks at the content of the UI
    fields whether username and password are set. Due to a bug, they were
    unset until 'widget_realize' was called, i.e. not before you switched to the
    security tab the first time.
    
    Related to:
    https://bugzilla.redhat.com/show_bug.cgi?id=1000564
    
    Signed-off-by: Thomas Haller <thaller redhat com>

 src/wireless-security/eap-method-leap.c   |   17 ++++++++++++++++-
 src/wireless-security/eap-method-simple.c |   17 ++++++++++++++++-
 2 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/src/wireless-security/eap-method-leap.c b/src/wireless-security/eap-method-leap.c
index 8315c94..7915ff6 100644
--- a/src/wireless-security/eap-method-leap.c
+++ b/src/wireless-security/eap-method-leap.c
@@ -113,8 +113,10 @@ update_secrets (EAPMethod *parent, NMConnection *connection)
                                  (HelperSecretFunc) nm_setting_802_1x_get_password);
 }
 
+/* Set the UI fields for user, password and show_password to the
+ * values as provided by method->ws_parent->x */
 static void
-widgets_realized (GtkWidget *widget, EAPMethodLEAP *method)
+set_userpass_ui (EAPMethodLEAP *method)
 {
        if (method->ws_parent->username)
                gtk_entry_set_text (method->username_entry, method->ws_parent->username);
@@ -130,6 +132,12 @@ widgets_realized (GtkWidget *widget, EAPMethodLEAP *method)
 }
 
 static void
+widgets_realized (GtkWidget *widget, EAPMethodLEAP *method)
+{
+       set_userpass_ui (method);
+}
+
+static void
 widgets_unrealized (GtkWidget *widget, EAPMethodLEAP *method)
 {
        wireless_security_set_userpass (method->ws_parent,
@@ -220,6 +228,13 @@ eap_method_leap_new (WirelessSecurity *ws_parent,
                          (GCallback) show_toggled_cb,
                          parent);
 
+       /* Initialize the UI fields with the security settings from method->ws_parent->x
+        * This will be also done later in widget_realized. It must be done here as well,
+        * because the dialog will ask to validate the connection before the security tab
+        * is shown/realized (to enable the Apply button).
+        * Validation accesses the contents of the UI files, so we must initialize it now. */
+       set_userpass_ui (method);
+
        return method;
 }
 
diff --git a/src/wireless-security/eap-method-simple.c b/src/wireless-security/eap-method-simple.c
index 60bd11f..567d334 100644
--- a/src/wireless-security/eap-method-simple.c
+++ b/src/wireless-security/eap-method-simple.c
@@ -213,8 +213,10 @@ password_always_ask_changed (GtkToggleButton *button, EAPMethodSimple *method)
        gtk_widget_set_sensitive (GTK_WIDGET (method->show_password), !always_ask);
 }
 
+/* Set the UI fields for user, password, always_ask and show_password to the
+ * values as provided by method->ws_parent->x */
 static void
-widgets_realized (GtkWidget *widget, EAPMethodSimple *method)
+set_userpass_ui (EAPMethodSimple *method)
 {
        if (method->ws_parent->username)
                gtk_entry_set_text (method->username_entry, method->ws_parent->username);
@@ -231,6 +233,12 @@ widgets_realized (GtkWidget *widget, EAPMethodSimple *method)
 }
 
 static void
+widgets_realized (GtkWidget *widget, EAPMethodSimple *method)
+{
+       set_userpass_ui (method);
+}
+
+static void
 widgets_unrealized (GtkWidget *widget, EAPMethodSimple *method)
 {
        wireless_security_set_userpass (method->ws_parent,
@@ -350,6 +358,13 @@ eap_method_simple_new (WirelessSecurity *ws_parent,
                          (GCallback) show_toggled_cb,
                          method);
 
+       /* Initialize the UI fields with the security settings from method->ws_parent->x
+        * This will be also done later in widget_realized. It must be done here as well,
+        * because the dialog will ask to validate the connection before the security tab
+        * is shown/realized (to enable the Apply button).
+        * Validation accesses the contents of the UI files, so we must initialize it now. */
+       set_userpass_ui (method);
+
        return method;
 }
 


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