A bit hackish, mainly because spice_channel_set_capability is exported, but well.. My main comment will be on the changelog ;) "Learn to disable specific capability by their name Allows to run spice-gtk with SPICE_FOO_CAP_BAR=0 disable channel FOO capability BAR." I'd change this to something like "Allow to disable specific capabilities at runtime Capability BAR for channel FOO can be disabled at runtime by setting the SPICE_FOO_CAP_BAR environment variable to '0' Disabling capabilities is useful for [to be filled because it's not very obvious to me - debugging/testing I guess?]" Naming the variable SPICE_FOO_CAP_BAR_DISABLE and testing that it's non-NULL may be slightly nicer. ACK with the changelog improved. Christophe On Fri, Jun 08, 2012 at 12:13:26PM +0200, Marc-André Lureau wrote: > Allows to run spice-gtk with SPICE_FOO_CAP_BAR=0 disable channel FOO > capability BAR. > --- > gtk/spice-channel-priv.h | 8 ++++++-- > gtk/spice-channel.c | 12 +++++++----- > 2 files changed, 13 insertions(+), 7 deletions(-) > > diff --git a/gtk/spice-channel-priv.h b/gtk/spice-channel-priv.h > index ac8bece..4f094d8 100644 > --- a/gtk/spice-channel-priv.h > +++ b/gtk/spice-channel-priv.h > @@ -174,11 +174,15 @@ void spice_channel_handle_migrate(SpiceChannel *channel, SpiceMsgIn *in); > gint spice_channel_get_channel_id(SpiceChannel *channel); > gint spice_channel_get_channel_type(SpiceChannel *channel); > void spice_channel_swap(SpiceChannel *channel, SpiceChannel *swap); > -void spice_channel_set_common_capability(SpiceChannel *channel, guint32 cap); > gboolean spice_channel_get_read_only(SpiceChannel *channel); > - > void spice_channel_reset(SpiceChannel *channel, gboolean migrating); > > +void spice_caps_set(GArray *caps, guint32 cap, const gchar *desc); > +#define spice_channel_set_common_capability(channel, cap) \ > + spice_caps_set(SPICE_CHANNEL(channel)->priv->common_caps, cap, #cap) > +#define spice_channel_set_capability(channel, cap) \ > + spice_caps_set(SPICE_CHANNEL(channel)->priv->caps, cap, #cap) > + > /* coroutine context */ > #define emit_main_context(object, event, args...) \ > G_STMT_START { \ > diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c > index 3cd047d..75b171b 100644 > --- a/gtk/spice-channel.c > +++ b/gtk/spice-channel.c > @@ -2538,6 +2538,7 @@ static void set_capability(GArray *caps, guint32 cap) > * > * Enable specific channel-kind capability. > **/ > +#undef spice_channel_set_capability > /* FIXME: we may want to make caps read only from outside */ > void spice_channel_set_capability(SpiceChannel *channel, guint32 cap) > { > @@ -2550,14 +2551,15 @@ void spice_channel_set_capability(SpiceChannel *channel, guint32 cap) > } > > G_GNUC_INTERNAL > -void spice_channel_set_common_capability(SpiceChannel *channel, guint32 cap) > +void spice_caps_set(GArray *caps, guint32 cap, const gchar *desc) > { > - SpiceChannelPrivate *c; > + g_return_if_fail(caps != NULL); > + g_return_if_fail(desc != NULL); > > - g_return_if_fail(SPICE_IS_CHANNEL(channel)); > + if (g_strcmp0(g_getenv(desc), "0") == 0) > + return; > > - c = channel->priv; > - set_capability(c->common_caps, cap); > + set_capability(caps, cap); > } > > G_GNUC_INTERNAL > -- > 1.7.10.2 > > _______________________________________________ > Spice-devel mailing list > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/spice-devel
Attachment:
pgp2KH9fQ2CpA.pgp
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel