diff options
author | Owen Taylor <otaylor@redhat.com> | 2002-09-24 21:03:58 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2002-09-24 21:03:58 +0000 |
commit | 15896b962dfa5c959565ed6be36db6a4f1721273 (patch) | |
tree | 2d1e950f1e05a51d5abd3fc088f75d8aeb86d9cb /gtk/gtkrc.c | |
parent | 73413ba70ec92371772af749f04cd8f9b238e96e (diff) | |
download | gtk+-15896b962dfa5c959565ed6be36db6a4f1721273.tar.gz |
Make icon sizes configurable (#70648, slightly based on a patch from Bill
Tue Sep 24 16:40:14 2002 Owen Taylor <otaylor@redhat.com>
Make icon sizes configurable (#70648, slightly based
on a patch from Bill Haneman, Brian Cameron)
* gtk/gtkiconfactory.[ch]: Add
gtk_icon_size_lookup_for_settings().
* gtk/gtksettings.c: Add gtk-icon-sizes XSETTING
* gtk/gtkiconfactory.c: Make icon sizes per-GtkSettings.
* gtk/gtkstyle.c: Use gtk_icon_size_lookup_for_settings()
* gtk/gtkrc.[ch]: Privately export _gtk_rc_reset_styles()
to force all the widgets to recompute their appearance.
Diffstat (limited to 'gtk/gtkrc.c')
-rw-r--r-- | gtk/gtkrc.c | 80 |
1 files changed, 54 insertions, 26 deletions
diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c index 298bd83a04..4f087fdd0c 100644 --- a/gtk/gtkrc.c +++ b/gtk/gtkrc.c @@ -1269,10 +1269,10 @@ gtk_rc_clear_styles (GtkRcContext *context) * icon sets so they get re-rendered. */ static void -gtk_rc_reset_widgets (GtkRcContext *context) +gtk_rc_reset_widgets (GtkSettings *settings) { GList *list, *toplevels; - + _gtk_icon_set_invalidate_caches (); toplevels = gtk_window_list_toplevels (); @@ -1306,6 +1306,53 @@ gtk_rc_clear_realized_style (gpointer key, g_slist_free (rc_styles); } +/** + * _gtk_rc_reset_styles: + * @settings: a #GtkSettings + * + * This setting resets all of our styles; we use it when the font + * rendering parameters or the icon sizes have changed. It's both less + * and more comprehensive then we actually need: + * + * Less comprehensive: it doesn't affect widgets that have a style + * set on them. + * + * More comprehensive: it resets the styles, but the styles haven't + * changed. The main reason for resetting the styles is becaues + * most widgets will redo all their font stuff when their style + * change. + **/ +void +_gtk_rc_reset_styles (GtkSettings *settings) +{ + GtkRcContext *context; + gboolean reset = FALSE; + + g_return_if_fail (GTK_IS_SETTINGS (settings)); + + context = gtk_rc_context_get (settings); + + if (context->default_style) + { + g_object_unref (G_OBJECT (context->default_style)); + context->default_style = NULL; + reset = TRUE; + } + + /* Clear out styles that have been looked up already + */ + if (realized_style_ht) + { + g_hash_table_foreach (realized_style_ht, gtk_rc_clear_realized_style, NULL); + g_hash_table_destroy (realized_style_ht); + realized_style_ht = NULL; + reset = TRUE; + } + + if (reset) + gtk_rc_reset_widgets (settings); +} + const gchar* _gtk_rc_context_get_default_font_name (GtkSettings *settings) { @@ -1322,29 +1369,10 @@ _gtk_rc_context_get_default_font_name (GtkSettings *settings) if (new_font_name != context->font_name && !(new_font_name && strcmp (context->font_name, new_font_name) == 0)) { - gboolean reset = FALSE; - g_free (context->font_name); - context->font_name = g_strdup (new_font_name); - - if (context->default_style) - { - g_object_unref (G_OBJECT (context->default_style)); - context->default_style = NULL; - reset = TRUE; - } - - /* Clear out styles that have been looked up already - */ - if (realized_style_ht) - { - g_hash_table_foreach (realized_style_ht, gtk_rc_clear_realized_style, NULL); - g_hash_table_destroy (realized_style_ht); - realized_style_ht = NULL; - reset = TRUE; - } - - if (reset) - gtk_rc_reset_widgets (context); + g_free (context->font_name); + context->font_name = g_strdup (new_font_name); + + _gtk_rc_reset_styles (settings); } g_free (new_font_name); @@ -1454,7 +1482,7 @@ gtk_rc_reparse_all_for_settings (GtkSettings *settings, g_object_thaw_notify (G_OBJECT (context->settings)); - gtk_rc_reset_widgets (context); + gtk_rc_reset_widgets (context->settings); } return force_load || mtime_modified; |