diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 7 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 7 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 7 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 7 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 7 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 7 | ||||
-rw-r--r-- | docs/reference/gtk/tmpl/gtksettings.sgml | 5 | ||||
-rw-r--r-- | gdk/x11/gdkevents-x11.c | 5 | ||||
-rw-r--r-- | gtk/gtkrc.c | 74 | ||||
-rw-r--r-- | gtk/gtkrc.h | 1 | ||||
-rw-r--r-- | gtk/gtksettings.c | 14 | ||||
-rw-r--r-- | gtk/gtkstyle.c | 5 |
13 files changed, 146 insertions, 7 deletions
@@ -1,3 +1,10 @@ +Sat Feb 23 20:59:05 2002 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkstyle.c gtk/gtkrc.[ch]: gtk/gtksettings.c gtk/gtkstyle.c: + Patch from Richard Hestilow to add a gtk-font-name GtkSetting. + + * gdk/x11/gdkevents-x11.c: Add Gtk/FontName XSETTING. + 2002-02-24 Tor Lillqvist <tml@iki.fi> * gtk/gtkfilesel.c: Move inclusion of <windows.h> before inclusion diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index ded1b1d65e..59259f0903 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,10 @@ +Sat Feb 23 20:59:05 2002 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkstyle.c gtk/gtkrc.[ch]: gtk/gtksettings.c gtk/gtkstyle.c: + Patch from Richard Hestilow to add a gtk-font-name GtkSetting. + + * gdk/x11/gdkevents-x11.c: Add Gtk/FontName XSETTING. + 2002-02-24 Tor Lillqvist <tml@iki.fi> * gtk/gtkfilesel.c: Move inclusion of <windows.h> before inclusion diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index ded1b1d65e..59259f0903 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Sat Feb 23 20:59:05 2002 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkstyle.c gtk/gtkrc.[ch]: gtk/gtksettings.c gtk/gtkstyle.c: + Patch from Richard Hestilow to add a gtk-font-name GtkSetting. + + * gdk/x11/gdkevents-x11.c: Add Gtk/FontName XSETTING. + 2002-02-24 Tor Lillqvist <tml@iki.fi> * gtk/gtkfilesel.c: Move inclusion of <windows.h> before inclusion diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index ded1b1d65e..59259f0903 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +Sat Feb 23 20:59:05 2002 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkstyle.c gtk/gtkrc.[ch]: gtk/gtksettings.c gtk/gtkstyle.c: + Patch from Richard Hestilow to add a gtk-font-name GtkSetting. + + * gdk/x11/gdkevents-x11.c: Add Gtk/FontName XSETTING. + 2002-02-24 Tor Lillqvist <tml@iki.fi> * gtk/gtkfilesel.c: Move inclusion of <windows.h> before inclusion diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index ded1b1d65e..59259f0903 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Sat Feb 23 20:59:05 2002 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkstyle.c gtk/gtkrc.[ch]: gtk/gtksettings.c gtk/gtkstyle.c: + Patch from Richard Hestilow to add a gtk-font-name GtkSetting. + + * gdk/x11/gdkevents-x11.c: Add Gtk/FontName XSETTING. + 2002-02-24 Tor Lillqvist <tml@iki.fi> * gtk/gtkfilesel.c: Move inclusion of <windows.h> before inclusion diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index ded1b1d65e..59259f0903 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Sat Feb 23 20:59:05 2002 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkstyle.c gtk/gtkrc.[ch]: gtk/gtksettings.c gtk/gtkstyle.c: + Patch from Richard Hestilow to add a gtk-font-name GtkSetting. + + * gdk/x11/gdkevents-x11.c: Add Gtk/FontName XSETTING. + 2002-02-24 Tor Lillqvist <tml@iki.fi> * gtk/gtkfilesel.c: Move inclusion of <windows.h> before inclusion diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index ded1b1d65e..59259f0903 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Sat Feb 23 20:59:05 2002 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkstyle.c gtk/gtkrc.[ch]: gtk/gtksettings.c gtk/gtkstyle.c: + Patch from Richard Hestilow to add a gtk-font-name GtkSetting. + + * gdk/x11/gdkevents-x11.c: Add Gtk/FontName XSETTING. + 2002-02-24 Tor Lillqvist <tml@iki.fi> * gtk/gtkfilesel.c: Move inclusion of <windows.h> before inclusion diff --git a/docs/reference/gtk/tmpl/gtksettings.sgml b/docs/reference/gtk/tmpl/gtksettings.sgml index 6c557f0a26..6a40a5e3b1 100644 --- a/docs/reference/gtk/tmpl/gtksettings.sgml +++ b/docs/reference/gtk/tmpl/gtksettings.sgml @@ -201,6 +201,11 @@ GtkSettings </para> +<!-- ##### ARG GtkSettings:gtk-font-name ##### --> +<para> + +</para> + <!-- ##### ARG GtkSettings:gtk-color-palette ##### --> <para> diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c index 2c66046207..2d1e14bd58 100644 --- a/gdk/x11/gdkevents-x11.c +++ b/gdk/x11/gdkevents-x11.c @@ -2051,12 +2051,13 @@ static struct { "Net/DndDragThreshold", "gtk-dnd-drag-threshold" }, { "Gtk/CanChangeAccels", "gtk-can-change-accels" }, { "Gtk/ColorPalette", "gtk-color-palette" }, + { "Gtk/FontName", "gtk-font-name" }, + { "Gtk/KeyThemeName", "gtk-key-theme-name" }, { "Gtk/ToolbarStyle", "gtk-toolbar-style" }, { "Gtk/ToolbarIconSize", "gtk-toolbar-icon-size" }, { "Net/CursorBlink", "gtk-cursor-blink" }, { "Net/CursorBlinkTime", "gtk-cursor-blink-time" }, - { "Net/ThemeName", "gtk-theme-name" }, - { "Gtk/KeyThemeName", "gtk-key-theme-name" } + { "Net/ThemeName", "gtk-theme-name" } }; static void diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c index 1aa56683a0..28ef67912f 100644 --- a/gtk/gtkrc.c +++ b/gtk/gtkrc.c @@ -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 *settings, 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 *settings) 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 *settings) "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 *context) 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 (GtkSettings *settings, 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 *scanner) return G_TOKEN_STRING; g_warning ("module_path directive is now ignored\n"); - + return G_TOKEN_NONE; } diff --git a/gtk/gtkrc.h b/gtk/gtkrc.h index 5bdf57b38e..8a95e12065 100644 --- a/gtk/gtkrc.h +++ b/gtk/gtkrc.h @@ -236,6 +236,7 @@ const GtkRcProperty* _gtk_rc_style_lookup_rc_property (GtkRcStyle *rc_style, gchar* gtk_win32_get_installation_directory (void); #endif +const gchar* _gtk_rc_context_get_default_font_name (GtkSettings *settings); #ifdef __cplusplus } diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c index 14f44f1cac..1547f6a529 100644 --- a/gtk/gtksettings.c +++ b/gtk/gtksettings.c @@ -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 (GtkSettingsClass *class) 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 diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index bfee98bf31..608f5aed6a 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -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 *style, 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); |