Fix problems with setting symbolic colors from rc files. (#338345,

2006-04-30  Matthias Clasen  <mclasen@localhost.localdomain>

	Fix problems with setting symbolic colors from rc files.
	(#338345, Benjamin Berg)

	* gtk/gtkrc.c (gtk_rc_settings_changed, gtk_rc_font_name_changed)
	(gtk_rc_color_hash_changed, gtk_rc_reparse_all_for_settings): Don't
	freeze notification for settings changes while parsing; instead
	manually avoid recursion, and update the color hashes.
This commit is contained in:
Matthias Clasen
2006-04-30 06:10:37 +00:00
committed by Matthias Clasen
parent bf937f76e5
commit a5f63de17b
4 changed files with 40 additions and 7 deletions

View File

@ -1,5 +1,18 @@
2006-04-30 Matthias Clasen <mclasen@localhost.localdomain> 2006-04-30 Matthias Clasen <mclasen@localhost.localdomain>
Fix problems with setting symbolic colors from rc files.
(#338345, Benjamin Berg)
* gtk/gtkrc.c (gtk_rc_settings_changed, gtk_rc_font_name_changed)
(gtk_rc_color_hash_changed, gtk_rc_reparse_all_for_settings): Don't
freeze notification for settings changes while parsing; instead
manually avoid recursion, and update the color hashes.
2006-04-30 Matthias Clasen <mclasen@localhost.localdomain>
* gtk/gtksettings.c (gtk_settings_class_init): Change the default
value of the gtk-color-scheme setting to "".
* gtk/gtkprinteroption.c: * gtk/gtkprinteroption.c:
* gtk/gtkprinteroptionwidget.c: * gtk/gtkprinteroptionwidget.c:
* gtk/gtkprintunixdialog.c: Improve the print dialog layout, * gtk/gtkprintunixdialog.c: Improve the print dialog layout,

View File

@ -1,5 +1,18 @@
2006-04-30 Matthias Clasen <mclasen@localhost.localdomain> 2006-04-30 Matthias Clasen <mclasen@localhost.localdomain>
Fix problems with setting symbolic colors from rc files.
(#338345, Benjamin Berg)
* gtk/gtkrc.c (gtk_rc_settings_changed, gtk_rc_font_name_changed)
(gtk_rc_color_hash_changed, gtk_rc_reparse_all_for_settings): Don't
freeze notification for settings changes while parsing; instead
manually avoid recursion, and update the color hashes.
2006-04-30 Matthias Clasen <mclasen@localhost.localdomain>
* gtk/gtksettings.c (gtk_settings_class_init): Change the default
value of the gtk-color-scheme setting to "".
* gtk/gtkprinteroption.c: * gtk/gtkprinteroption.c:
* gtk/gtkprinteroptionwidget.c: * gtk/gtkprinteroptionwidget.c:
* gtk/gtkprintunixdialog.c: Improve the print dialog layout, * gtk/gtkprintunixdialog.c: Improve the print dialog layout,

View File

@ -127,6 +127,8 @@ struct _GtkRcContext
GtkStyle *default_style; GtkStyle *default_style;
GHashTable *color_hash; GHashTable *color_hash;
guint reloading : 1;
}; };
#define GTK_RC_STYLE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_RC_STYLE, GtkRcStylePrivate)) #define GTK_RC_STYLE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_RC_STYLE, GtkRcStylePrivate))
@ -618,6 +620,9 @@ gtk_rc_settings_changed (GtkSettings *settings,
gchar *new_theme_name; gchar *new_theme_name;
gchar *new_key_theme_name; gchar *new_key_theme_name;
if (context->reloading)
return;
g_object_get (settings, g_object_get (settings,
"gtk-theme-name", &new_theme_name, "gtk-theme-name", &new_theme_name,
"gtk-key-theme-name", &new_key_theme_name, "gtk-key-theme-name", &new_key_theme_name,
@ -640,6 +645,7 @@ gtk_rc_font_name_changed (GtkSettings *settings,
GParamSpec *pspec, GParamSpec *pspec,
GtkRcContext *context) GtkRcContext *context)
{ {
if (!context->reloading)
_gtk_rc_context_get_default_font_name (settings); _gtk_rc_context_get_default_font_name (settings);
} }
@ -656,6 +662,7 @@ gtk_rc_color_hash_changed (GtkSettings *settings,
if (context->color_hash) if (context->color_hash)
g_hash_table_ref (context->color_hash); g_hash_table_ref (context->color_hash);
if (!context->reloading)
gtk_rc_reparse_all_for_settings (settings, TRUE); gtk_rc_reparse_all_for_settings (settings, TRUE);
} }
@ -1597,7 +1604,7 @@ gtk_rc_reparse_all_for_settings (GtkSettings *settings,
{ {
_gtk_binding_reset_parsed (); _gtk_binding_reset_parsed ();
gtk_rc_clear_styles (context); gtk_rc_clear_styles (context);
g_object_freeze_notify (G_OBJECT (context->settings)); context->reloading = TRUE;
_gtk_settings_reset_rc_values (context->settings); _gtk_settings_reset_rc_values (context->settings);
tmp_list = context->rc_files; tmp_list = context->rc_files;
@ -1645,7 +1652,7 @@ gtk_rc_reparse_all_for_settings (GtkSettings *settings,
if (context->key_theme_name && context->key_theme_name[0]) if (context->key_theme_name && context->key_theme_name[0])
gtk_rc_parse_named (context, context->key_theme_name, "key"); gtk_rc_parse_named (context, context->key_theme_name, "key");
g_object_thaw_notify (G_OBJECT (context->settings)); context->reloading = FALSE;
gtk_rc_reset_widgets (context->settings); gtk_rc_reset_widgets (context->settings);
} }

View File

@ -488,7 +488,7 @@ gtk_settings_class_init (GtkSettingsClass *class)
g_param_spec_string ("gtk-color-scheme", g_param_spec_string ("gtk-color-scheme",
P_("Color scheme"), P_("Color scheme"),
P_("A palette of named colors for use in themes"), P_("A palette of named colors for use in themes"),
"foreground:black\nbackground:gray", "",
GTK_PARAM_READWRITE), GTK_PARAM_READWRITE),
NULL); NULL);