Blame SOURCES/0040-vnc-do-not-show-error-on-cancel-close-of-auth-dialog.patch

48c875
From 98de755b5be6e76570782755ff026061310bec19 Mon Sep 17 00:00:00 2001
48c875
From: Victor Toso <me@victortoso.com>
48c875
Date: Tue, 6 Jun 2017 14:05:32 +0200
48c875
Subject: [PATCH] vnc: do not show error on cancel/close of auth dialog
48c875
48c875
Mainly a kiosk mode issue, similar to the spice fix in 6480e52f62b.
48c875
48c875
This patch saves the cancel/close state of auth dialog from
48c875
virt_viewer_auth_collect_credentials() in order to avoid an error
48c875
dialog to pop up to user in kiosk mode.
48c875
48c875
This happens due the fact that we call virt_viewer_app_disconnected()
48c875
twice:
48c875
- One with "session-cancelled" which is correct and well handled;
48c875
- The other with "session-disconnected" which is misleading as there
48c875
  was no connection at this time. This will trigger the error dialog
48c875
  with "Unable to connect to the graphic server %s".
48c875
48c875
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1446161
48c875
48c875
Signed-off-by: Victor Toso <victortoso@redhat.com>
48c875
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
48c875
(cherry picked from commit fb14a8b300ed89a40938302a37679f902b3dab40)
48c875
---
48c875
 src/virt-viewer-session-vnc.c | 6 ++++++
48c875
 1 file changed, 6 insertions(+)
48c875
48c875
diff --git a/src/virt-viewer-session-vnc.c b/src/virt-viewer-session-vnc.c
48c875
index 26fb405..c79b63c 100644
48c875
--- a/src/virt-viewer-session-vnc.c
48c875
+++ b/src/virt-viewer-session-vnc.c
48c875
@@ -40,6 +40,7 @@ struct _VirtViewerSessionVncPrivate {
48c875
     GtkWindow *main_window;
48c875
     /* XXX we should really just have a VncConnection */
48c875
     VncDisplay *vnc;
48c875
+    gboolean auth_dialog_cancelled;
48c875
 };
48c875
 
48c875
 #define VIRT_VIEWER_SESSION_VNC_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_SESSION_VNC, VirtViewerSessionVncPrivate))
48c875
@@ -104,6 +105,8 @@ virt_viewer_session_vnc_connected(VncDisplay *vnc G_GNUC_UNUSED,
48c875
     GtkWidget *display = virt_viewer_display_vnc_new(session, session->priv->vnc);
48c875
     VirtViewerApp *app = virt_viewer_session_get_app(VIRT_VIEWER_SESSION(session));
48c875
 
48c875
+    session->priv->auth_dialog_cancelled = FALSE;
48c875
+
48c875
     virt_viewer_window_set_display(virt_viewer_app_get_main_window(app),
48c875
                                    VIRT_VIEWER_DISPLAY(display));
48c875
 
48c875
@@ -117,6 +120,8 @@ virt_viewer_session_vnc_disconnected(VncDisplay *vnc G_GNUC_UNUSED,
48c875
                                      VirtViewerSessionVnc *session)
48c875
 {
48c875
     GtkWidget *display;
48c875
+    if (session->priv->auth_dialog_cancelled)
48c875
+        return;
48c875
 
48c875
     virt_viewer_session_clear_displays(VIRT_VIEWER_SESSION(session));
48c875
     display = virt_viewer_display_vnc_new(session, session->priv->vnc);
48c875
@@ -314,6 +319,7 @@ virt_viewer_session_vnc_auth_credential(GtkWidget *src G_GNUC_UNUSED,
48c875
 
48c875
         if (!ret) {
48c875
             vnc_display_close(self->priv->vnc);
48c875
+            self->priv->auth_dialog_cancelled = TRUE;
48c875
             g_signal_emit_by_name(self, "session-cancelled");
48c875
             goto cleanup;
48c875
         }
48c875
-- 
48c875
2.13.0
48c875