[gtk+/wip/css: 10/143] styleproperties: Add a hacky function to redirect color lookups
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/css: 10/143] styleproperties: Add a hacky function to redirect color lookups
- Date: Fri, 6 Jan 2012 14:47:02 +0000 (UTC)
commit 8531d9920aaba969c2ead38bd59a52d65f1c8c76
Author: Benjamin Otte <otte redhat com>
Date: Wed Dec 28 22:05:35 2011 +0100
styleproperties: Add a hacky function to redirect color lookups
This will soon be necessary.
FIXME: Make sure this gets removed again.
gtk/gtkstyleproperties.c | 21 +++++++++++++++++++++
gtk/gtkstylepropertiesprivate.h | 3 +++
2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkstyleproperties.c b/gtk/gtkstyleproperties.c
index 906ded7..5470bf5 100644
--- a/gtk/gtkstyleproperties.c
+++ b/gtk/gtkstyleproperties.c
@@ -379,6 +379,23 @@ gtk_style_properties_new (void)
return g_object_new (GTK_TYPE_STYLE_PROPERTIES, NULL);
}
+void
+_gtk_style_properties_set_color_lookup_func (GtkStyleProperties *props,
+ GtkSymbolicColorLookupFunc func,
+ gpointer data)
+{
+ GtkStylePropertiesPrivate *priv;
+
+ g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
+ g_return_if_fail (func != NULL);
+
+ priv = props->priv;
+ g_return_if_fail (priv->color_map == NULL);
+
+ priv->color_lookup_func = func;
+ priv->color_lookup_data = data;
+}
+
/**
* gtk_style_properties_map_color:
* @props: a #GtkStyleProperties
@@ -402,6 +419,7 @@ gtk_style_properties_map_color (GtkStyleProperties *props,
g_return_if_fail (color != NULL);
priv = props->priv;
+ g_return_if_fail (priv->color_lookup_func == NULL);
if (G_UNLIKELY (!priv->color_map))
priv->color_map = g_hash_table_new_full (g_str_hash,
@@ -437,6 +455,9 @@ gtk_style_properties_lookup_color (GtkStyleProperties *props,
priv = props->priv;
+ if (priv->color_lookup_func)
+ return priv->color_lookup_func (priv->color_lookup_data, name);
+
if (!priv->color_map)
return NULL;
diff --git a/gtk/gtkstylepropertiesprivate.h b/gtk/gtkstylepropertiesprivate.h
index b7242c0..3465270 100644
--- a/gtk/gtkstylepropertiesprivate.h
+++ b/gtk/gtkstylepropertiesprivate.h
@@ -30,6 +30,9 @@ void _gtk_style_properties_get (GtkStylePropertie
GtkStateFlags state,
GtkStylePropertyContext *context,
...);
+void _gtk_style_properties_set_color_lookup_func (GtkStyleProperties *props,
+ GtkSymbolicColorLookupFunc func,
+ gpointer data);
void _gtk_style_properties_get_valist (GtkStyleProperties *props,
GtkStateFlags state,
GtkStylePropertyContext *context,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]