? DefaultKeys ? EmacsKeys ? gtkrc.DefaultKeys ? gtkrc.EmacsKeys ? gtkrc.c.newer ? russian.xkm Index: gtkrc.c =================================================================== RCS file: /cvs/gnome/gtk+/gtk/gtkrc.c,v retrieving revision 1.117 diff -u -p -r1.117 gtkrc.c --- gtkrc.c 2002/02/19 05:33:34 1.117 +++ gtkrc.c 2002/02/23 01:09:52 @@ -96,6 +96,7 @@ struct _GtkRcContext gchar *theme_name; gchar *key_theme_name; + gchar *font_name; gchar *pixmap_path[GTK_RC_MAX_PIXMAP_PATHS]; @@ -512,6 +513,14 @@ gtk_rc_settings_changed (GtkSettings *s g_free (new_key_theme_name); } +static void +gtk_rc_font_name_changed (GtkSettings *settings, + GParamSpec *pspec, + GtkRcContext *context) +{ + _gtk_rc_context_get_default_font_name (settings); +} + static GtkRcContext * gtk_rc_context_get (GtkSettings *settings) { @@ -529,6 +538,7 @@ gtk_rc_context_get (GtkSettings *setting g_object_get (settings, "gtk-theme-name", &context->theme_name, "gtk-key-theme-name", &context->key_theme_name, + "gtk-font-name", &context->font_name, NULL); g_signal_connect (settings, @@ -539,6 +549,11 @@ gtk_rc_context_get (GtkSettings *setting "notify::gtk-key-theme-name", G_CALLBACK (gtk_rc_settings_changed), context); + g_signal_connect (settings, + "notify::gtk-font-name", + G_CALLBACK (gtk_rc_font_name_changed), + context); + context->pixmap_path[0] = NULL; @@ -1234,6 +1249,62 @@ gtk_rc_reset_widgets (GtkRcContext *cont g_list_free (toplevels); } +void +gtk_rc_clear_realized_style (gpointer key, + gpointer value, + gpointer data) +{ + GSList *rc_styles = key; + GSList *tmp_list = rc_styles; + + while (tmp_list) + { + GtkRcStyle *rc_style = tmp_list->data; + + rc_style->rc_style_lists = g_slist_remove_all (rc_style->rc_style_lists, + rc_styles); + tmp_list = tmp_list->next; + } + + g_slist_free (rc_styles); +} + +const gchar* +_gtk_rc_context_get_default_font_name (GtkSettings *settings) +{ + GtkRcContext *context; + gchar *new_font_name; + + g_return_val_if_fail (GTK_IS_SETTINGS (settings), NULL); + + context = gtk_rc_context_get (settings); + + g_object_get (context->settings, + "gtk-font-name", &new_font_name, + NULL); + + if (new_font_name != context->font_name && !(new_font_name && strcmp (context->font_name, new_font_name) == 0)) + { + g_free (context->font_name); + context->font_name = g_strdup (new_font_name); + + /* 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; + + gtk_rc_reset_widgets (context); + } + } + + g_free (new_font_name); + + return context->font_name; +} + /** * gtk_rc_reparse_all_for_settings: * @settings: a #GtkSettings @@ -1321,6 +1392,7 @@ gtk_rc_reparse_all_for_settings (GtkSett g_free (context->theme_name); g_free (context->key_theme_name); + g_object_get (context->settings, "gtk-theme-name", &context->theme_name, "gtk-key-theme-name", &context->key_theme_name, @@ -3278,7 +3350,7 @@ gtk_rc_parse_module_path (GScanner *scan return G_TOKEN_STRING; g_warning ("module_path directive is now ignored\n"); - + return G_TOKEN_NONE; } Index: gtkrc.h =================================================================== RCS file: /cvs/gnome/gtk+/gtk/gtkrc.h,v retrieving revision 1.34 diff -u -p -r1.34 gtkrc.h --- gtkrc.h 2002/02/02 16:37:23 1.34 +++ gtkrc.h 2002/02/23 01:09:52 @@ -230,6 +230,7 @@ const GtkRcProperty* _gtk_rc_style_looku gchar* gtk_win32_get_installation_directory (void); #endif +const gchar* _gtk_rc_context_get_default_font_name (GtkSettings *settings); #ifdef __cplusplus } Index: gtksettings.c =================================================================== RCS file: /cvs/gnome/gtk+/gtk/gtksettings.c,v retrieving revision 1.24 diff -u -p -r1.24 gtksettings.c --- gtksettings.c 2002/01/31 20:14:18 1.24 +++ gtksettings.c 2002/02/23 01:09:52 @@ -30,7 +30,8 @@ enum { PROP_THEME_NAME, PROP_KEY_THEME_NAME, PROP_MENU_BAR_ACCEL, - PROP_DND_DRAG_THRESHOLD + PROP_DND_DRAG_THRESHOLD, + PROP_FONT_NAME }; @@ -208,7 +209,16 @@ gtk_settings_class_init (GtkSettingsClas G_PARAM_READWRITE), NULL); g_assert (result == PROP_DND_DRAG_THRESHOLD); - + + result = settings_install_property_parser (class, + g_param_spec_string ("gtk-font-name", + _("Font Name"), + _("Name of default font to use"), + "Sans 10", + G_PARAM_READWRITE), + NULL); + g_assert (result == PROP_FONT_NAME); + } static void Index: gtkstyle.c =================================================================== RCS file: /cvs/gnome/gtk+/gtk/gtkstyle.c,v retrieving revision 1.109 diff -u -p -r1.109 gtkstyle.c --- gtkstyle.c 2002/02/22 17:16:59 1.109 +++ gtkstyle.c 2002/02/23 01:09:52 @@ -485,8 +485,9 @@ static void gtk_style_init (GtkStyle *style) { gint i; + const gchar *font_name = _gtk_rc_context_get_default_font_name (gtk_settings_get_default ()); - style->font_desc = pango_font_description_from_string ("Sans 10"); + style->font_desc = pango_font_description_from_string (font_name); style->attach_count = 0; style->colormap = NULL; @@ -2339,7 +2340,7 @@ gtk_default_draw_shadow (GtkStyle * return; } if (widget && GTK_IS_SPIN_BUTTON (widget) && - detail && strcmp (detail, "spinbutton") == 0) + detail && strcmp (detail, "spinbutton") == 0) { draw_spinbutton_shadow (style, window, state_type, gtk_widget_get_direction (widget), area, x, y, width, height);