[virt-tools-list] [PATCH virt-viewer 3/4] Don't hide the main window when disconnecting

Jonathon Jongsma jjongsma at redhat.com
Mon Feb 3 22:14:20 UTC 2014


The main window (display #1) is treated a bit differently from other windows,
since it is opened at app start and displays status messages while we attempt to
connect to the remote guest.  As such, it should really stay open as long as the
app is running.

The impetus for this change is the following:
- user attempts to connect to a remote VNC display with a password
- user types the wrong password
- A dialog pops up indicating that authentication failed and asking if the user
  would like to try to re-connect.
- User clicks 'Yes'
- Because the connection was disconnected, all windows are closed
- remote-viewer tries to reconnect again, at which point a new display window is
  opened, and the window gets placed by the window manager (possibly on another
  monitor altogether).

As a user, I expect the program to simply re-use the existing window when trying
to re-authenticate, instead of having the window disappear and then re-appear at
a different location.  This patch accomplishes that.
---
 src/virt-viewer-app.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index d9e6a60..c63dcad 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -455,13 +455,15 @@ static void hide_one_window(gpointer key G_GNUC_UNUSED,
                             gpointer value,
                             gpointer user_data G_GNUC_UNUSED)
 {
-    virt_viewer_window_hide(VIRT_VIEWER_WINDOW(value));
+    VirtViewerApp* self = VIRT_VIEWER_APP(user_data);
+    if (self->priv->main_window != value)
+        virt_viewer_window_hide(VIRT_VIEWER_WINDOW(value));
 }
 
 static void
 virt_viewer_app_hide_all_windows(VirtViewerApp *app)
 {
-    g_hash_table_foreach(app->priv->windows, hide_one_window, NULL);
+    g_hash_table_foreach(app->priv->windows, hide_one_window, app);
 }
 
 G_MODULE_EXPORT void
-- 
1.8.5.3




More information about the virt-tools-list mailing list