[virt-tools-list] [PATCH virt-viewer 7/9] Report error in dialog

Christophe Fergeau cfergeau at redhat.com
Fri Nov 14 11:09:39 UTC 2014


On Thu, Nov 13, 2014 at 06:20:43PM +0100, Marc-André Lureau wrote:
> Use a UI dialog to inform of connection error.


ACK

> ---
>  src/virt-viewer.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/src/virt-viewer.c b/src/virt-viewer.c
> index c1d2765..517aab8 100644
> --- a/src/virt-viewer.c
> +++ b/src/virt-viewer.c
> @@ -839,9 +839,17 @@ virt_viewer_connect(VirtViewerApp *app)
>      }
>  
>      if (!virt_viewer_app_initial_connect(app, &error)) {
> -        if (error != NULL)
> -            g_warning("%s", error->message);
> -        g_clear_error(&error);
> +        if (error != NULL) {
> +            GtkWidget *dialog = gtk_message_dialog_new(NULL,
> +                                                       GTK_DIALOG_DESTROY_WITH_PARENT,
> +                                                       GTK_MESSAGE_ERROR,
> +                                                       GTK_BUTTONS_CLOSE,
> +                                                       "Failed to connect: %s",
> +                                                       error->message);
> +            gtk_dialog_run(GTK_DIALOG(dialog));
> +            gtk_widget_destroy(GTK_WIDGET(dialog));
> +            g_clear_error(&error);
> +        }
>          return -1;
>      }
>  
> -- 
> 1.9.3
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20141114/1893fd94/attachment.sig>


More information about the virt-tools-list mailing list