mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
gtk/gtksettings.c gtk/gtkstyle.c: Patch from Richard Hestilow to add a
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.
This commit is contained in:
parent
d21ebc724c
commit
82b76bbee3
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -201,6 +201,11 @@ GtkSettings
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkSettings:gtk-font-name ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkSettings:gtk-color-palette ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -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
|
||||
|
74
gtk/gtkrc.c
74
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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user