On Fri, Apr 17, 2015 at 12:40:23PM +0200, Javier Celaya wrote: > Also, depend on the spice-common commit that introduces the > SpiceImageCompress enum. > --- > gtk/spice-session.c | 26 ++++++++++++++++++++++++++ > spice-common | 2 +- > 2 files changed, 27 insertions(+), 1 deletion(-) > > diff --git a/gtk/spice-session.c b/gtk/spice-session.c > index 020a70e..c83d239 100644 > --- a/gtk/spice-session.c > +++ b/gtk/spice-session.c > @@ -117,6 +117,7 @@ struct _SpiceSessionPrivate { > uint32_t n_display_channels; > guint8 uuid[16]; > gchar *name; > + int preferred_compression; > > /* associated objects */ > SpiceAudio *audio_manager; > @@ -203,6 +204,7 @@ enum { > PROP_SHARE_DIR_RO, > PROP_USERNAME, > PROP_UNIX_PATH, > + PROP_PREF_COMPRESS, > }; > > /* signals */ > @@ -658,6 +660,9 @@ static void spice_session_get_property(GObject *gobject, > case PROP_SHARE_DIR_RO: > g_value_set_boolean(value, s->share_dir_ro); > break; > + case PROP_PREF_COMPRESS: > + g_value_set_int(value, s->preferred_compression); > + break; > default: > G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); > break; > @@ -794,6 +799,9 @@ static void spice_session_set_property(GObject *gobject, > case PROP_SHARE_DIR_RO: > s->share_dir_ro = g_value_get_boolean(value); > break; > + case PROP_PREF_COMPRESS: > + s->preferred_compression = g_value_get_int(value); > + break; > default: > G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); > break; > @@ -1403,6 +1411,24 @@ static void spice_session_class_init(SpiceSessionClass *klass) > G_PARAM_CONSTRUCT | > G_PARAM_STATIC_STRINGS)); > > + /** > + * SpiceSession:preferred-compression: > + * > + * The image compression algorithm the client prefers to use. It is > + * reported to the server. > + * > + * Since: 0.29 > + **/ > + g_object_class_install_property > + (gobject_class, PROP_PREF_COMPRESS, > + g_param_spec_int("preferred-compression", > + "Preferred image compression algorithm", > + "Preferred image compression algorithm", > + SPICE_IMAGE_COMPRESS_INVALID, SPICE_IMAGE_COMPRESS_ENUM_END - 1, > + SPICE_IMAGE_COMPRESS_INVALID, > + G_PARAM_READWRITE | > + G_PARAM_STATIC_STRINGS)); I'd prefer if we used a g_param_spec_enum here, however this means doing the registration by hand (see how it's done in gtk/spice-glib-enums.c) as glib-mkenums does not like the generated enums.h (because of enum name in typedef enum Foo {};) This would look like: #define SPICE_TYPE_CHANNEL_EVENT spice_channel_event_get_type() GType spice_channel_event_get_type (void); static const GEnumValue _spice_channel_event_values[] = { { SPICE_CHANNEL_NONE, "SPICE_CHANNEL_NONE", "none" }, { SPICE_CHANNEL_OPENED, "SPICE_CHANNEL_OPENED", "opened" }, { SPICE_CHANNEL_SWITCHING, "SPICE_CHANNEL_SWITCHING", "switching" }, { SPICE_CHANNEL_CLOSED, "SPICE_CHANNEL_CLOSED", "closed" }, { SPICE_CHANNEL_ERROR_CONNECT, "SPICE_CHANNEL_ERROR_CONNECT", "error-connect" }, { SPICE_CHANNEL_ERROR_TLS, "SPICE_CHANNEL_ERROR_TLS", "error-tls" }, { SPICE_CHANNEL_ERROR_LINK, "SPICE_CHANNEL_ERROR_LINK", "error-link" }, { SPICE_CHANNEL_ERROR_AUTH, "SPICE_CHANNEL_ERROR_AUTH", "error-auth" }, { SPICE_CHANNEL_ERROR_IO, "SPICE_CHANNEL_ERROR_IO", "error-io" }, { 0, NULL, NULL } }; G_STATIC_ASSERT(G_N_ELEMENTS(_spice_channel_event_values) == SPICE_IMAGE_COMPRESS_ENUM_END - 1); GType spice_channel_event_get_type (void) { static GType type = 0; static volatile gsize type_volatile = 0; if (g_once_init_enter(&type_volatile)) { type = g_enum_register_static ("SpiceChannelEvent", _spice_channel_event_values); g_once_init_leave(&type_volatile, type); } return type; } Christophe
Attachment:
pgphkfPyzsR9Q.pgp
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel