[virt-tools-list] [virt-viewer][PATCH 4/7 v3] virt-viewer: Avoid simple_message_dialog() when errors can be propagated

Christophe Fergeau cfergeau at redhat.com
Fri Mar 27 09:37:14 UTC 2015


On Thu, Mar 26, 2015 at 11:26:57PM +0100, Fabiano Fidêncio wrote:
> Remove all the dialogs used to report errors on extract_connect_info()
> and just propagate the errors we got from the it.

"from it"

> The only exception is virt_viewer_domain_event(), that is a callback
> that doesn't have GError as argument. In this specific case, we show the
> error dialog instead of propagate it.

"instead of propagating it"

> 
> Related: rhbz#1085216
> ---
>  src/virt-viewer.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/src/virt-viewer.c b/src/virt-viewer.c
> index d30b523..15770f3 100644
> --- a/src/virt-viewer.c
> +++ b/src/virt-viewer.c
> @@ -415,9 +415,6 @@ virt_viewer_extract_connect_info(VirtViewer *self,
>                      VIRT_VIEWER_ERROR, VIRT_VIEWER_ERROR_FAILED,
>                      _("Cannot determine the graphic type for the guest %s"), priv->domkey);
>  
> -        virt_viewer_app_simple_message_dialog(app, _("Cannot determine the graphic type for the guest %s"),
> -                                              priv->domkey);
> -
>          goto cleanup;
>      }
>  
> @@ -457,9 +454,6 @@ virt_viewer_extract_connect_info(VirtViewer *self,
>                      VIRT_VIEWER_ERROR, VIRT_VIEWER_ERROR_FAILED,
>                      _("Cannot determine the host for the guest %s"), priv->domkey);
>  
> -        virt_viewer_app_simple_message_dialog(app, _("Cannot determine the host for the guest %s"),
> -                                              priv->domkey);
> -
>          goto cleanup;
>      }
>  
> @@ -491,9 +485,6 @@ virt_viewer_extract_connect_info(VirtViewer *self,
>          g_debug("graphics listen '%s' is not reachable from this machine",
>                  ghost ? ghost : "");
>  
> -        virt_viewer_app_simple_message_dialog(app, _("Guest '%s' is not reachable"),
> -                                              priv->domkey);
> -
>          goto cleanup;
>      }
>  
> @@ -612,8 +603,10 @@ virt_viewer_domain_event(virConnectPtr conn G_GNUC_UNUSED,
>  
>      case VIR_DOMAIN_EVENT_STARTED:
>          virt_viewer_update_display(self, dom, &error);
> -        if (error)
> +        if (error) {
> +            virt_viewer_app_simple_message_dialog(app, error->message);
>              g_clear_error(&error);
> +        }

This is where the if (error) {
    g_clear_error(&error);
}
block I mentioned previously gets useful, so I'd add the block in that
commit, and just pass "NULL" instead of &error in the previous commit.

Christophe


>  
>          virt_viewer_app_activate(app, &error);
>          if (error) {
> -- 
> 2.3.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/20150327/0bb36c36/attachment.sig>


More information about the virt-tools-list mailing list