[virt-tools-list] [RFC virt-viewer 12/12] vv-file: Show 'newer-version-url' when version check fails

Jonathon Jongsma jjongsma at redhat.com
Wed Jun 3 15:07:23 UTC 2015


On Tue, 2015-06-02 at 16:29 +0200, Christophe Fergeau wrote:
> We currently display a generic error message when the current binary is
> older than the minimum version specified in the vv file. The previous
> commit added a 'newer-version-url' field to these .vv file. This commit
> adds that URL to the error message if it's set.
> ---
>  src/virt-viewer-file.c | 22 +++++++++++++++++-----
>  1 file changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/src/virt-viewer-file.c b/src/virt-viewer-file.c
> index 2a5b06a..b6bb54c 100644
> --- a/src/virt-viewer-file.c
> +++ b/src/virt-viewer-file.c
> @@ -816,11 +816,23 @@ virt_viewer_file_check_min_version(VirtViewerFile *self, GError **error)
>      version_cmp = virt_viewer_compare_buildid(min_version, PACKAGE_VERSION BUILDID);
>  
>      if (version_cmp > 0) {
> -        g_set_error(error,
> -                    VIRT_VIEWER_ERROR,
> -                    VIRT_VIEWER_ERROR_FAILED,
> -                    _("At least %s version %s is required to setup this connection"),
> -                    g_get_application_name(), min_version);
> +        gchar *url;
> +        url = virt_viewer_file_get_version_url(self);
> +        if (url != NULL) {
> +            g_set_error(error,
> +                        VIRT_VIEWER_ERROR,
> +                        VIRT_VIEWER_ERROR_FAILED,
> +                        _("At least %s version %s is required to setup this"
> +                          " connection, see %s for details"),
> +                        g_get_application_name(), min_version, url);
> +            g_free(url);
> +        } else {
> +            g_set_error(error,
> +                        VIRT_VIEWER_ERROR,
> +                        VIRT_VIEWER_ERROR_FAILED,
> +                        _("At least %s version %s is required to setup this connection"),
> +                        g_get_application_name(), min_version);
> +        }
>          g_free(min_version);
>          return FALSE;
>      }

So, while I was testing these patches I noticed that the URL was shown
in plain text. It would be nice if it were clickable, but the fact that
we're simply displaying the text straight from a GError means that this
is not really feasible. It might be nice to re-factor things in the
future so that this is possible, but I'm not sure how much work that
would be. It would require at minimum adding a new error type
(VIRT_VIEWER_ERROR_MINIMUM_VERSION?) and exposing the minimum version to
the calling function.

But even if we did decide to do that, it could be done as a future
commit. ACK




More information about the virt-tools-list mailing list