summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabiano FidĂȘncio <fidencio@redhat.com>2016-02-19 17:10:12 +0100
committerFabiano FidĂȘncio <fidencio@redhat.com>2016-02-24 07:21:06 +0100
commit80ac4d5774451c7906bc24acbe061f19258d0a1a (patch)
tree4023a9ea143de5a8cdc298d447dfc30156c6a0af
parent5d98df3ef176b71215a3d2bb9ed3e842b670be2e (diff)
downloadvirt-viewer-80ac4d5774451c7906bc24acbe061f19258d0a1a.tar.gz
virt-viewer-80ac4d5774451c7906bc24acbe061f19258d0a1a.tar.xz
virt-viewer-80ac4d5774451c7906bc24acbe061f19258d0a1a.zip
app: Don't leave a window opened in case of connection error
Since commit ed9b3f3 the main window is not hidden when disconnecting. But it also is not hidden when a connection error occurs, leaving a black display with a not so accurate message to the users in case they try to connect to a non-valid address from the remote-viewer connection window and in this case the main window (display #1) shuldn't be shown. The impetus for this chance is the following: - user runs remote-viewer without any argument - the remote-viewer connection window shows up - user attempts to connect to a non-valid address - a dialog pops up indicating a failure connecting to the graphic server - the main window shows up saying "Connecting to the graphic server" - user clicks 'Ok' - the main window stays there with the same message As a user, I expect the program to not show the main window in connecting failure cases. This patch accomplishes that.
-rw-r--r--src/virt-viewer-app.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index aa5e905..bb2bfa6 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -608,7 +608,10 @@ static void hide_one_window(gpointer value,
gpointer user_data G_GNUC_UNUSED)
{
VirtViewerApp* self = VIRT_VIEWER_APP(user_data);
- if (self->priv->main_window != value)
+ VirtViewerAppPrivate *priv = self->priv;
+ gboolean connect_error = !priv->connected && !priv->cancelled;
+
+ if (connect_error || self->priv->main_window != value)
virt_viewer_window_hide(VIRT_VIEWER_WINDOW(value));
}