[virt-tools-list] [remote-viewer v2] remote-viewer-connect: Keep the 'dialog' window on top

Victor Toso victortoso at redhat.com
Fri Jun 9 16:07:08 UTC 2017


From: Victor Toso <me at victortoso.com>

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 at 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 4850d7e..b132214 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -1118,7 +1118,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"));
-- 
2.13.0




More information about the virt-tools-list mailing list