ack On Fri, Aug 10, 2012 at 5:31 PM, Christophe Fergeau <cfergeau@xxxxxxxxxx> wrote: > When --spice-disable-effects is used, error out unless this is > the name of one of the effects we can disable. > --- > gtk/spice-option.c | 25 ++++++++++++++++++++++++- > 1 file changed, 24 insertions(+), 1 deletion(-) > > diff --git a/gtk/spice-option.c b/gtk/spice-option.c > index c65397a..715e84a 100644 > --- a/gtk/spice-option.c > +++ b/gtk/spice-option.c > @@ -79,6 +79,29 @@ error: > return FALSE; > } > > +static gboolean parse_disable_effects(const gchar *option_name, const gchar *value, > + gpointer data, GError **error) > +{ > + > + if ((g_strcmp0(value, "wallpaper") != 0) > + && (g_strcmp0(value, "font-smooth") != 0) > + && (g_strcmp0(value, "animation") != 0) > + && (g_strcmp0(value, "all") != 0)) { > + /* Translators: do not translate 'wallpaper', 'font-smooth', > + * 'animation', 'all' as the user must use these values with the > + * --spice-disable-effects command line option > + */ > + g_set_error(error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED, > + _("invalid effect name (%s), must be 'wallpaper', 'font-smooth', 'animation' or 'all'"), value); > + return FALSE; > + } > + > + disable_effects = g_strdup(value); > + > + return TRUE; > +} > + > + > /** > * spice_get_option_group: > * > @@ -90,7 +113,7 @@ error: > GOptionGroup* spice_get_option_group(void) > { > const GOptionEntry entries[] = { > - { "spice-disable-effects", '\0', 0, G_OPTION_ARG_STRING, &disable_effects, > + { "spice-disable-effects", '\0', 0, G_OPTION_ARG_CALLBACK, parse_disable_effects, > N_("Disable guest display effects"), N_("<wallpaper,font-smooth,animation,all>") }, > { "spice-color-depth", '\0', 0, G_OPTION_ARG_CALLBACK, parse_color_depth, > N_("Guest display color depth"), N_("<16,32>") }, > -- > 1.7.11.2 > > _______________________________________________ > Spice-devel mailing list > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/spice-devel -- Marc-André Lureau _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel