[network-manager-applet/nma-1-2] wifi-dialog: enable "Cancel" button if secrets are not available



commit 6522c2dcd3309b3688cec593af905f0a8aa7a1e4
Author: Beniamino Galvani <bgalvani redhat com>
Date:   Wed May 25 10:53:24 2016 +0200

    wifi-dialog: enable "Cancel" button if secrets are not available
    
    When the request for secrets fails we don't enable the "Connect"
    button, but the "Cancel" one should become enabled.
    
    (cherry picked from commit 4e9d6800ab838ad2e7aab093a90a49371f1ee8d2)

 src/libnma/nma-wifi-dialog.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/src/libnma/nma-wifi-dialog.c b/src/libnma/nma-wifi-dialog.c
index 19f550f..557cf65 100644
--- a/src/libnma/nma-wifi-dialog.c
+++ b/src/libnma/nma-wifi-dialog.c
@@ -760,10 +760,22 @@ get_secrets_cb (GObject *object,
        GtkTreeModel *model;
        GtkTreeIter iter;
        GError *error = NULL;
+       gboolean current_secrets = FALSE;
 
        if (info->canceled)
                goto out;
 
+       priv = NMA_WIFI_DIALOG_GET_PRIVATE (info->self);
+       if (priv->secrets_info == info) {
+               priv->secrets_info = NULL;
+
+               /* Buttons should only be re-enabled if this secrets response is the
+                * in-progress one.
+                */
+               _set_response_sensitive (info->self, GTK_RESPONSE_CANCEL, TRUE);
+               current_secrets = TRUE;
+       }
+
        secrets = nm_remote_connection_get_secrets_finish (connection, result, &error);
        if (error) {
                g_warning ("%s: error getting connection secrets: (%d) %s",
@@ -773,16 +785,8 @@ get_secrets_cb (GObject *object,
                goto out;
        }
 
-       priv = NMA_WIFI_DIALOG_GET_PRIVATE (info->self);
-       if (priv->secrets_info == info) {
-               priv->secrets_info = NULL;
-
-               /* Buttons should only be re-enabled if this secrets response is the
-                * in-progress one.
-                */
-               _set_response_sensitive (info->self, GTK_RESPONSE_CANCEL, TRUE);
+       if (current_secrets)
                _set_response_sensitive (info->self, GTK_RESPONSE_OK, TRUE);
-       }
 
        /* User might have changed the connection while the secrets call was in
         * progress, so don't try to update the wrong connection with the secrets


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