/* demo-Gtk-conf.c --- implements the dynamic configuration dialogs.
- * xscreensaver, Copyright (c) 2001, 2003 Jamie Zawinski <jwz@jwz.org>
+ * xscreensaver, Copyright (c) 2001, 2003, 2004 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
{
GList *p;
parameter *match = 0;
- int which = -1;
- int index = 0;
+ gint which = -1;
+ gint index = 0;
for (p = parms; p; p = p->next)
{
break;
case BOOLEAN:
if (which != 0 && which != 1) abort();
- parameter_set_switch (match, (gpointer) which);
+ parameter_set_switch (match, GINT_TO_POINTER(which));
break;
case SELECT_OPTION:
if (which != 1) abort();
- parameter_set_switch (parent, (gpointer) index);
+ parameter_set_switch (parent, GINT_TO_POINTER(index));
break;
default:
break;
case BOOLEAN:
{
GtkToggleButton *b = GTK_TOGGLE_BUTTON (p->widget);
- gtk_toggle_button_set_active (b, (int) value);
+ gtk_toggle_button_set_active (b, GPOINTER_TO_INT(value));
break;
}
case SELECT:
{
gtk_option_menu_set_history (GTK_OPTION_MENU (p->widget),
- (int) value);
+ GPOINTER_TO_INT(value));
break;
}
default:
*/
static char *
-get_description (GList *parms)
+get_description (GList *parms, gboolean verbose_p)
{
parameter *doc = 0;
for (; parms; parms = parms->next)
{
char *d = strdup ((char *) doc->string);
char *s;
+ char *p;
for (s = d; *s; s++)
if (s[0] == '\n')
{
d[--L] = 0;
}
- return _(d);
+ /* strip off duplicated whitespaces */
+ for (s = d; *s; s++)
+ if (s[0] == ' ')
+ {
+ p = s+1;
+ while (*s == ' ')
+ s++;
+ if (*p && (s != p))
+ memmove (p, s, strlen(s)+1);
+ }
+
+#if 0
+ if (verbose_p)
+ {
+ fprintf (stderr, "%s: text read is \"%s\"\n", blurb(),doc->string);
+ fprintf (stderr, "%s: description is \"%s\"\n", blurb(), d);
+ fprintf (stderr, "%s: translation is \"%s\"\n", blurb(), _(d));
+ }
+#endif /* 0 */
+
+ return (d);
}
}
data->widget = table;
data->parameters = parms;
- data->description = get_description (parms);
+ data->description = get_description (parms, verbose_p);
}
else
{