Re: [PATCH 2/3] Cmdline: Get the preferred-compression property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 17, 2015 at 12:40:24PM +0200, Javier Celaya wrote:
> ---
>  gtk/spice-cmdline.c | 43 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
> 
> diff --git a/gtk/spice-cmdline.c b/gtk/spice-cmdline.c
> index 8619b57..dd64264 100644
> --- a/gtk/spice-cmdline.c
> +++ b/gtk/spice-cmdline.c
> @@ -27,6 +27,34 @@ static char *port;
>  static char *tls_port;
>  static char *password;
>  static char *uri;
> +static int preferred_compression;
> +
> +static gboolean parse_preferred_compression(const gchar *option_name, const gchar *value,
> +                                            gpointer data, GError **error) {
> +    if (!strcmp(value, "auto-glz")) {
> +        preferred_compression = SPICE_IMAGE_COMPRESS_AUTO_GLZ;
> +    } else if (!strcmp(value, "auto-lz")) {
> +        preferred_compression = SPICE_IMAGE_COMPRESS_AUTO_LZ;
> +    } else if (!strcmp(value, "quic")) {
> +        preferred_compression = SPICE_IMAGE_COMPRESS_QUIC;
> +    } else if (!strcmp(value, "glz")) {
> +        preferred_compression = SPICE_IMAGE_COMPRESS_GLZ;
> +    } else if (!strcmp(value, "lz")) {
> +        preferred_compression = SPICE_IMAGE_COMPRESS_LZ;
> +#ifdef USE_LZ4
> +    } else if (!strcmp(value, "lz4")) {
> +        preferred_compression = SPICE_IMAGE_COMPRESS_LZ4;
> +#endif
> +    } else if (!strcmp(value, "off")) {
> +        preferred_compression = SPICE_IMAGE_COMPRESS_OFF;
> +    } else {
> +        preferred_compression = SPICE_IMAGE_COMPRESS_INVALID;
> +        g_set_error(error, g_quark_from_static_string("spice-cmdline"), G_OPTION_ERROR_FAILED,

The g_quark_from_static_string() call is usually wrapped in a small
GQuark foo_error_quark(void) helper, see how it's used in spice-gtk.

> +                    "Image compression algorithm %s not supported", value);

I assume this should be translatable ? _("Image compression ... %s"), value);


Christophe

Attachment: pgpOKEMOqgzXv.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]