X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtkstyleproperties.c;h=362f384fdf5f673789855022baab73df8a106a3e;hb=9d0febc9a64a5bfb0fcfc3a88de4757f6c1ff090;hp=46d537412a3bce2ed3a8f8a715b0de8a08383cef;hpb=9181282d8812e2404400f0a5cdbac582037bdce2;p=~andy%2Fgtk diff --git a/gtk/gtkstyleproperties.c b/gtk/gtkstyleproperties.c index 46d537412..362f384fd 100644 --- a/gtk/gtkstyleproperties.c +++ b/gtk/gtkstyleproperties.c @@ -12,9 +12,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * License along with this library. If not, see . */ #include "config.h" @@ -79,8 +77,6 @@ struct _GtkStylePropertiesPrivate { GHashTable *color_map; GHashTable *properties; - GtkSymbolicColorLookupFunc color_lookup_func; - gpointer color_lookup_data; }; static void gtk_style_properties_provider_init (GtkStyleProviderIface *iface); @@ -341,7 +337,7 @@ gtk_style_properties_provider_lookup (GtkStyleProviderPrivate *provider, if (value == NULL) continue; - _gtk_css_lookup_set (lookup, id, NULL, value); + _gtk_css_lookup_set_computed (lookup, id, NULL, value); } } @@ -367,23 +363,6 @@ 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 @@ -407,7 +386,6 @@ 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, @@ -443,9 +421,6 @@ 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; @@ -462,6 +437,8 @@ _gtk_style_properties_set_property_by_property (GtkStyleProperties *props, PropertyData *prop; GValue *val; + g_return_if_fail (G_VALUE_TYPE (value) == _gtk_css_style_property_get_computed_type (style_prop)); + priv = props->priv; prop = g_hash_table_lookup (priv->properties, style_prop); @@ -628,6 +605,22 @@ _gtk_style_properties_peek_property (GtkStyleProperties *props, return property_data_match_state (prop, state); } +typedef struct { + GtkStyleProperties *props; + GtkStateFlags state; +} StyleQueryData; + +static const GValue * +style_query_func (guint id, + gpointer data) +{ + StyleQueryData *query = data; + + return _gtk_style_properties_peek_property (query->props, + _gtk_css_style_property_lookup_by_id (id), + query->state); +} + /** * gtk_style_properties_get_property: * @props: a #GtkStyleProperties @@ -648,6 +641,7 @@ gtk_style_properties_get_property (GtkStyleProperties *props, GtkStateFlags state, GValue *value) { + StyleQueryData query = { props, state }; GtkStyleProperty *node; g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE); @@ -666,7 +660,10 @@ gtk_style_properties_get_property (GtkStyleProperties *props, return FALSE; } - _gtk_style_property_query (node, props, state, value); + _gtk_style_property_query (node, + value, + style_query_func, + &query); return TRUE; }