[Spice-devel] [PATCH 2/3] Cmdline: Get the preferred-compression property
Christophe Fergeau
cfergeau at redhat.com
Fri Apr 24 05:43:08 PDT 2015
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150424/c9a46b0e/attachment.sig>
More information about the Spice-devel
mailing list