[virt-tools-list] [PATCH] app: Don't leave a window opened in case of connection error

Jonathon Jongsma jjongsma at redhat.com
Tue Feb 23 16:08:54 UTC 2016


Acked-by: Jonathon Jongsma <jjongsma at redhat.com>


On Fri, 2016-02-19 at 17:10 +0100, Fabiano Fidêncio wrote:
> 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.
> ---
>  src/virt-viewer-app.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> index 7f7fed3..071fb58 100644
> --- a/src/virt-viewer-app.c
> +++ b/src/virt-viewer-app.c
> @@ -614,7 +614,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));
>  }
>  




More information about the virt-tools-list mailing list