[virt-tools-list] [PATCH virt-viewer v2 6/7] Automatically retry auth failures for VNC

Jonathon Jongsma jjongsma at redhat.com
Thu Jun 18 20:15:29 UTC 2015


There's no reason that we need to ask if the user wants to retry auth
failures for VNC sessions but not ask for spice sessions. If the user
doesn't want to retry, she can simply click 'cancel' when the auth
dialog pops up, just as they do with spice.
---
 src/virt-viewer-app.c | 32 ++++++--------------------------
 1 file changed, 6 insertions(+), 26 deletions(-)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 3643fec..daa225e 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -1492,35 +1492,15 @@ static void virt_viewer_app_auth_refused(VirtViewerSession *session,
                                          const char *msg,
                                          VirtViewerApp *self)
 {
-    GtkWidget *dialog;
-    int ret;
     VirtViewerAppPrivate *priv = self->priv;
 
-    if (virt_viewer_session_can_retry_auth(session)) {
-        virt_viewer_app_simple_message_dialog(self,
-                                              _("Unable to authenticate with remote desktop server: %s"),
-                                              msg);
-    } else {
-        /* if the session implementation cannot retry auth automatically, the
-         * VirtViewerApp needs to schedule a new connection to retry */
-        dialog = gtk_message_dialog_new(virt_viewer_window_get_window(priv->main_window),
-                                        GTK_DIALOG_MODAL |
-                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                        GTK_MESSAGE_ERROR,
-                                        GTK_BUTTONS_YES_NO,
-                                        _("Unable to authenticate with remote desktop server at %s: %s\n"
-                                          "Retry connection again?"),
-                                        priv->pretty_address, msg);
-
-        ret = gtk_dialog_run(GTK_DIALOG(dialog));
-
-        gtk_widget_destroy(dialog);
+    virt_viewer_app_simple_message_dialog(self,
+                                          _("Unable to authenticate with remote desktop server: %s"),
+                                          msg);
 
-        if (ret == GTK_RESPONSE_YES)
-            priv->authretry = TRUE;
-        else
-            priv->authretry = FALSE;
-    }
+    /* if the session implementation cannot retry auth automatically, the
+     * VirtViewerApp needs to schedule a new connection to retry */
+    priv->authretry = !virt_viewer_session_can_retry_auth(session);
 }
 
 static void virt_viewer_app_auth_unsupported(VirtViewerSession *session G_GNUC_UNUSED,
-- 
2.1.0




More information about the virt-tools-list mailing list