diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2010-11-29 15:35:16 +0100 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2010-11-29 15:35:16 +0100 |
commit | 89ba4079a12062a0cf17797d399c3e9bda5f67b4 (patch) | |
tree | dbba4befed9f906fa5f795727189d2cf962806d1 | |
parent | f6f0f6388d3793bb21203dcf5a655f6c9d982649 (diff) |
gtk: add channel.set_capability()
-rw-r--r-- | gtk/spice-channel.c | 23 | ||||
-rw-r--r-- | gtk/spice-channel.h | 1 | ||||
-rw-r--r-- | gtk/spice-client-gtk.defs | 9 |
3 files changed, 33 insertions, 0 deletions
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index 90cf21d..560d08d 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -1066,3 +1066,26 @@ gboolean spice_channel_test_capability(SpiceChannel *self, guint32 cap) c = SPICE_CHANNEL_GET_PRIVATE(self); return test_capability(c->remote_caps, cap); } + +static void set_capability(GArray *caps, guint32 cap) +{ + guint word_index = cap / 32; + + g_return_if_fail(caps != NULL); + + if (caps->len <= word_index) + g_array_set_size(caps, word_index + 1); + + g_array_index(caps, guint32, word_index) = + g_array_index(caps, guint32, word_index) | (1 << (cap % 32)); +} + +void spice_channel_set_capability(SpiceChannel *self, guint32 cap) +{ + spice_channel *c; + + g_return_if_fail(SPICE_IS_CHANNEL(self)); + + c = SPICE_CHANNEL_GET_PRIVATE(self); + set_capability(c->caps, cap); +} diff --git a/gtk/spice-channel.h b/gtk/spice-channel.h index 61115b5..37881b5 100644 --- a/gtk/spice-channel.h +++ b/gtk/spice-channel.h @@ -80,6 +80,7 @@ void spice_channel_destroy(SpiceChannel *channel); gboolean spice_channel_connect(SpiceChannel *channel); void spice_channel_disconnect(SpiceChannel *channel, SpiceChannelEvent event); gboolean spice_channel_test_capability(SpiceChannel *channel, guint32 cap); +void spice_channel_set_capability(SpiceChannel *self, guint32 cap); G_END_DECLS diff --git a/gtk/spice-client-gtk.defs b/gtk/spice-client-gtk.defs index 8c632fe..c89f6a4 100644 --- a/gtk/spice-client-gtk.defs +++ b/gtk/spice-client-gtk.defs @@ -343,6 +343,15 @@ ) ) +(define-method set_capability + (of-object "SpiceChannel") + (c-name "spice_channel_set_capability") + (return-type "none") + (parameters + '("guint32" "cap") + ) +) + ;; From spice-channel-enums.h |