Blob Blame History Raw
From 40b92b6b4fa4eb81c2b746365a6a056b3666ee81 Mon Sep 17 00:00:00 2001
From: Victor Toso <me@victortoso.com>
Date: Fri, 9 Jun 2017 17:27:32 +0200
Subject: [PATCH] remote-viewer-connect: Keep the 'dialog' window on top

Otherwise, in kiosk mode, it'll be hidden from user.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1459800

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
---
 src/remote-viewer-connect.c | 3 ++-
 src/remote-viewer-connect.h | 2 +-
 src/remote-viewer.c         | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/remote-viewer-connect.c b/src/remote-viewer-connect.c
index 2fbc5ff..14594ac 100644
--- a/src/remote-viewer-connect.c
+++ b/src/remote-viewer-connect.c
@@ -172,7 +172,7 @@ make_label_small(GtkLabel* label)
 * @return FALSE if Cancel is pressed or dialog is closed
 */
 gboolean
-remote_viewer_connect_dialog(gchar **uri)
+remote_viewer_connect_dialog(GtkWindow *main_window, gchar **uri)
 {
     GtkWidget *window, *label, *entry, *recent, *connect_button, *cancel_button;
     GtkRecentFilter *rfilter;
@@ -192,6 +192,7 @@ remote_viewer_connect_dialog(gchar **uri)
     g_return_val_if_fail(builder != NULL, GTK_RESPONSE_NONE);
 
     window = GTK_WIDGET(gtk_builder_get_object(builder, "remote-viewer-connection-window"));
+    gtk_window_set_transient_for(GTK_WINDOW(window), main_window);
     connect_button = GTK_WIDGET(gtk_builder_get_object(builder, "connect-button"));
     cancel_button = GTK_WIDGET(gtk_builder_get_object(builder, "cancel-button"));
     label = GTK_WIDGET(gtk_builder_get_object(builder, "example-label"));
diff --git a/src/remote-viewer-connect.h b/src/remote-viewer-connect.h
index f00581e..99779ef 100644
--- a/src/remote-viewer-connect.h
+++ b/src/remote-viewer-connect.h
@@ -23,7 +23,7 @@
 
 #include <gtk/gtk.h>
 
-gboolean remote_viewer_connect_dialog(gchar **uri);
+gboolean remote_viewer_connect_dialog(GtkWindow *main_window, gchar **uri);
 
 #endif /* REMOTE_VIEWER_CONNECT_H */
 
diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index d927f8a..7834dac 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -1122,7 +1122,8 @@ remote_viewer_start(VirtViewerApp *app, GError **err)
 #endif
 retry_dialog:
         if (priv->open_recent_dialog) {
-            if (!remote_viewer_connect_dialog(&guri)) {
+            VirtViewerWindow *main_window = virt_viewer_app_get_main_window(app);
+            if (!remote_viewer_connect_dialog(virt_viewer_window_get_window(main_window), &guri)) {
                 g_set_error_literal(&error,
                             VIRT_VIEWER_ERROR, VIRT_VIEWER_ERROR_CANCELLED,
                             _("No connection was chosen"));