Make the gtk-color-scheme setting work.

2005-12-12  Matthias Clasen  <mclasen@redhat.com>

	Make the gtk-color-scheme setting work.

	* gtk/gtksettings.h:
	* gtk/gtksettings.c (_gtk_settings_get_color_hash): Add a getter
	that takes care of initializing the color hash if it is not
	already there.

	* gtk/gtkrc.c (gtk_rc_color_scheme_changed, gtk_rc_context_get):
	And use it here.
This commit is contained in:
Matthias Clasen 2005-12-12 15:48:43 +00:00 committed by Matthias Clasen
parent 34291ddf05
commit 128bc9f3ea
5 changed files with 50 additions and 10 deletions

View File

@ -1,3 +1,15 @@
2005-12-12 Matthias Clasen <mclasen@redhat.com>
Make the gtk-color-scheme setting work.
* gtk/gtksettings.h:
* gtk/gtksettings.c (_gtk_settings_get_color_hash): Add a getter
that takes care of initializing the color hash if it is not
already there.
* gtk/gtkrc.c (gtk_rc_color_scheme_changed, gtk_rc_context_get):
And use it here.
2005-12-10 Matthias Clasen <mclasen@redhat.com>
* gdk/gdk.c (gdk_parse_args): Warn if parsing fails,

View File

@ -1,3 +1,15 @@
2005-12-12 Matthias Clasen <mclasen@redhat.com>
Make the gtk-color-scheme setting work.
* gtk/gtksettings.h:
* gtk/gtksettings.c (_gtk_settings_get_color_hash): Add a getter
that takes care of initializing the color hash if it is not
already there.
* gtk/gtkrc.c (gtk_rc_color_scheme_changed, gtk_rc_context_get):
And use it here.
2005-12-10 Matthias Clasen <mclasen@redhat.com>
* gdk/gdk.c (gdk_parse_args): Warn if parsing fails,

View File

@ -596,8 +596,7 @@ gtk_rc_color_scheme_changed (GtkSettings *settings,
if (context->color_hash)
g_hash_table_unref (context->color_hash);
context->color_hash = g_object_get_data (G_OBJECT (settings),
"gtk-color-scheme");
context->color_hash = _gtk_settings_get_color_hash (settings);
if (context->color_hash)
g_hash_table_ref (context->color_hash);
@ -629,8 +628,7 @@ gtk_rc_context_get (GtkSettings *settings)
"gtk-color-scheme", &context->colors,
NULL);
context->color_hash = g_object_get_data (G_OBJECT (settings),
"gtk-color-scheme");
context->color_hash = _gtk_settings_get_color_hash (settings);
if (context->color_hash)
g_hash_table_ref (context->color_hash);

View File

@ -1590,12 +1590,17 @@ gtk_color_table_from_string (const gchar *str)
while (*p == ' ')
p++;
s = strchr (p, '\n');
if (s)
{
*s = '\0';
s++;
}
s = p;
while (*s)
{
if (*s == '\n')
{
*s = '\0';
s++;
break;
}
s++;
}
if (!gdk_color_parse (p, &color))
{
@ -1633,5 +1638,17 @@ settings_update_color_scheme (GtkSettings *settings)
g_free (colors);
}
GHashTable *
_gtk_settings_get_color_hash (GtkSettings *settings)
{
if (g_object_get_data (G_OBJECT (settings),
"gtk-color-scheme") == NULL)
settings_update_color_scheme (settings);
return (GHashTable *) g_object_get_data (G_OBJECT (settings),
"gtk-color-scheme");
}
#define __GTK_SETTINGS_C__
#include "gtkaliasdef.c"

View File

@ -126,6 +126,7 @@ gboolean _gtk_settings_parse_convert (GtkRcPropertyParser parser,
const GValue *src_value,
GParamSpec *pspec,
GValue *dest_value);
GHashTable* _gtk_settings_get_color_hash (GtkSettings *settings);
G_END_DECLS