small bug with gtk-styles
Christian Krause
chkr@plauener.de
16 Oct 2002 01:37:21 +0200
Hi,
I found a bug in src/gnome-utils/dialog-utils.c: gnc_set_label_color(..).
I noticed, that even if I set the correct locale via LANG=... all text
is displayed correctly (EUR-Signs, ...) except the information _under_ the
icon bar ("Net Assets"). I tracked down the problem to
gnc_set_label_color, where you do a
- gtk_widget_get_style to get a style
- modify the style with setting a new color
- gtk_widget_set_style
I commented out all lines except the get_style and set_style, but the
text was always in the incorrect locale. When I commented out _all_
lines, the locale was displayed correct.
So the problem must be in getting and setting the style.
I inserted a "gtk_widget_ensure_style(GTK_WIDGET(label));" before
getting the style, and the problem gone away.
It seems, that in some circumstances the style isn't already set correctly
before calling gtk_widget_get_style, so this little patch is necessary:
-------------------------------------------------------------------------
diff -u -r1.8 dialog-utils.c
--- src/gnome-utils/dialog-utils.c 6 Oct 2002 09:41:50 -0000 1.8
+++ src/gnome-utils/dialog-utils.c 11 Oct 2002 13:28:15 -0000
@@ -381,6 +381,7 @@
return;
cm = gtk_widget_get_colormap(GTK_WIDGET(label));
+ gtk_widget_ensure_style(GTK_WIDGET(label));
style = gtk_widget_get_style(GTK_WIDGET(label));
style = gtk_style_copy(style);
-------------------------------------------------------------------------
regards,
christian