X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtkstyleproperties.c;h=9788006b1612f5dec65c947af8bdea3d25edf9dd;hb=02e915273845b21af223e7e5e2425569afcf1b83;hp=cd325ae76c91ac62cf9c5d714aabe2e0b24da5a3;hpb=4383701e258fcda37d980d5bd3114f028e567550;p=~andy%2Fgtk
diff --git a/gtk/gtkstyleproperties.c b/gtk/gtkstyleproperties.c
index cd325ae76..9788006b1 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"
@@ -26,12 +24,9 @@
#include
#include "gtkstyleprovider.h"
-#include "gtksymboliccolor.h"
#include "gtkthemingengine.h"
-#include "gtkanimationdescription.h"
-#include "gtkgradient.h"
-#include "gtkshadowprivate.h"
#include "gtkcssshorthandpropertyprivate.h"
+#include "gtkcsstypedvalueprivate.h"
#include "gtkcsstypesprivate.h"
#include "gtkborderimageprivate.h"
@@ -39,9 +34,11 @@
#include "gtkstylepropertyprivate.h"
#include "gtkstyleproviderprivate.h"
#include "gtkintl.h"
-
#include "gtkwin32themeprivate.h"
+#include "deprecated/gtkgradient.h"
+#include "deprecated/gtksymboliccolorprivate.h"
+
/**
* SECTION:gtkstyleproperties
* @Short_description: Store for style property information
@@ -67,7 +64,7 @@ typedef struct ValueData ValueData;
struct ValueData
{
GtkStateFlags state;
- GValue value;
+ GtkCssValue *value;
};
struct PropertyData
@@ -79,8 +76,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);
@@ -126,8 +121,8 @@ property_data_remove_values (PropertyData *data)
value_data = &g_array_index (data->values, ValueData, i);
- if (G_IS_VALUE (&value_data->value))
- g_value_unset (&value_data->value);
+ _gtk_css_value_unref (value_data->value);
+ value_data->value = NULL;
}
if (data->values->len > 0)
@@ -192,11 +187,10 @@ property_data_find_position (PropertyData *data,
return found;
}
-static GValue *
+static ValueData *
property_data_get_value (PropertyData *data,
GtkStateFlags state)
{
- ValueData *val_data;
guint pos;
if (!property_data_find_position (data, state, &pos))
@@ -207,12 +201,10 @@ property_data_get_value (PropertyData *data,
g_array_insert_val (data->values, pos, new);
}
- val_data = &g_array_index (data->values, ValueData, pos);
-
- return &val_data->value;
+ return &g_array_index (data->values, ValueData, pos);
}
-static GValue *
+static GtkCssValue *
property_data_match_state (PropertyData *data,
GtkStateFlags state)
{
@@ -225,7 +217,7 @@ property_data_match_state (PropertyData *data,
/* Exact match */
val_data = &g_array_index (data->values, ValueData, pos);
- return &val_data->value;
+ return val_data->value;
}
if (pos >= data->values->len)
@@ -252,7 +244,7 @@ property_data_match_state (PropertyData *data,
if (val_data->state == 0 ||
((val_data->state & state) != 0 &&
(val_data->state & ~state) == 0))
- return &val_data->value;
+ return val_data->value;
}
return NULL;
@@ -287,31 +279,31 @@ gtk_style_properties_finalize (GObject *object)
G_OBJECT_CLASS (gtk_style_properties_parent_class)->finalize (object);
}
-GtkStyleProperties *
-gtk_style_properties_get_style (GtkStyleProvider *provider,
- GtkWidgetPath *path)
-{
- /* Return style set itself */
- return g_object_ref (provider);
-}
-
static void
gtk_style_properties_provider_init (GtkStyleProviderIface *iface)
{
- iface->get_style = gtk_style_properties_get_style;
}
-static GtkSymbolicColor *
+static GtkCssValue *
gtk_style_properties_provider_get_color (GtkStyleProviderPrivate *provider,
const char *name)
{
- return gtk_style_properties_lookup_color (GTK_STYLE_PROPERTIES (provider), name);
+ GtkSymbolicColor *symbolic;
+
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
+ symbolic = gtk_style_properties_lookup_color (GTK_STYLE_PROPERTIES (provider), name);
+ if (symbolic == NULL)
+ return NULL;
+
+ return _gtk_symbolic_color_get_css_value (symbolic);
+
+ G_GNUC_END_IGNORE_DEPRECATIONS;
}
static void
gtk_style_properties_provider_lookup (GtkStyleProviderPrivate *provider,
- GtkWidgetPath *path,
- GtkStateFlags state,
+ const GtkCssMatcher *matcher,
GtkCssLookup *lookup)
{
GtkStyleProperties *props;
@@ -327,97 +319,37 @@ gtk_style_properties_provider_lookup (GtkStyleProviderPrivate *provider,
while (g_hash_table_iter_next (&iter, &key, &value))
{
- GtkStyleProperty *prop = key;
+ GtkCssStyleProperty *prop = key;
PropertyData *data = value;
- const GValue *value;
+ GtkCssValue *value;
guint id;
- id = _gtk_style_property_get_id (prop);
+ id = _gtk_css_style_property_get_id (prop);
if (!_gtk_css_lookup_is_missing (lookup, id))
continue;
- value = property_data_match_state (data, state);
+ value = property_data_match_state (data, _gtk_css_matcher_get_state (matcher));
if (value == NULL)
continue;
- _gtk_css_lookup_set (lookup, id, value);
+ _gtk_css_lookup_set_computed (lookup, id, NULL, value);
}
}
+static GtkCssChange
+gtk_style_properties_provider_get_change (GtkStyleProviderPrivate *provider,
+ const GtkCssMatcher *matcher)
+{
+ return GTK_CSS_CHANGE_STATE;
+}
+
static void
gtk_style_properties_provider_private_init (GtkStyleProviderPrivateInterface *iface)
{
iface->get_color = gtk_style_properties_provider_get_color;
iface->lookup = gtk_style_properties_provider_lookup;
-}
-
-/* Property registration functions */
-
-/**
- * gtk_style_properties_register_property: (skip)
- * @parse_func: parsing function to use, or %NULL
- * @pspec: the #GParamSpec for the new property
- *
- * Registers a property so it can be used in the CSS file format.
- * This function is the low-level equivalent of
- * gtk_theming_engine_register_property(), if you are implementing
- * a theming engine, you want to use that function instead.
- *
- * Since: 3.0
- **/
-void
-gtk_style_properties_register_property (GtkStylePropertyParser parse_func,
- GParamSpec *pspec)
-{
- g_return_if_fail (G_IS_PARAM_SPEC (pspec));
-
- _gtk_style_property_register (pspec,
- 0,
- parse_func,
- NULL,
- NULL,
- NULL);
-}
-
-/**
- * gtk_style_properties_lookup_property: (skip)
- * @property_name: property name to look up
- * @parse_func: (out): return location for the parse function
- * @pspec: (out) (transfer none): return location for the #GParamSpec
- *
- * Returns %TRUE if a property has been registered, if @pspec or
- * @parse_func are not %NULL, the #GParamSpec and parsing function
- * will be respectively returned.
- *
- * Returns: %TRUE if the property is registered, %FALSE otherwise
- *
- * Since: 3.0
- **/
-gboolean
-gtk_style_properties_lookup_property (const gchar *property_name,
- GtkStylePropertyParser *parse_func,
- GParamSpec **pspec)
-{
- GtkStyleProperty *node;
- gboolean found = FALSE;
-
- g_return_val_if_fail (property_name != NULL, FALSE);
-
- node = _gtk_style_property_lookup (property_name);
-
- if (node)
- {
- if (pspec)
- *pspec = node->pspec;
-
- if (parse_func)
- *parse_func = node->property_parse_func;
-
- found = TRUE;
- }
-
- return found;
+ iface->get_change = gtk_style_properties_provider_get_change;
}
/* GtkStyleProperties methods */
@@ -435,23 +367,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
@@ -462,6 +377,8 @@ _gtk_style_properties_set_color_lookup_func (GtkStyleProperties *props,
* gtk_style_properties_lookup_color()
*
* Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
**/
void
gtk_style_properties_map_color (GtkStyleProperties *props,
@@ -475,7 +392,8 @@ 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);
+
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (G_UNLIKELY (!priv->color_map))
priv->color_map = g_hash_table_new_full (g_str_hash,
@@ -486,6 +404,10 @@ gtk_style_properties_map_color (GtkStyleProperties *props,
g_hash_table_replace (priv->color_map,
g_strdup (name),
gtk_symbolic_color_ref (color));
+
+ G_GNUC_END_IGNORE_DEPRECATIONS;
+
+ _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props));
}
/**
@@ -499,6 +421,8 @@ gtk_style_properties_map_color (GtkStyleProperties *props,
* Returns: (transfer none): The mapped color
*
* Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
**/
GtkSymbolicColor *
gtk_style_properties_lookup_color (GtkStyleProperties *props,
@@ -511,9 +435,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;
@@ -521,60 +442,14 @@ gtk_style_properties_lookup_color (GtkStyleProperties *props,
}
void
-_gtk_style_properties_set_property_by_property (GtkStyleProperties *props,
- GtkStyleProperty *style_prop,
- GtkStateFlags state,
- const GValue *value)
+_gtk_style_properties_set_property_by_property (GtkStyleProperties *props,
+ GtkCssStyleProperty *style_prop,
+ GtkStateFlags state,
+ GtkCssValue *value)
{
GtkStylePropertiesPrivate *priv;
PropertyData *prop;
- GType value_type;
- GValue *val;
-
- value_type = G_VALUE_TYPE (value);
-
- if (style_prop->pspec->value_type == GDK_TYPE_RGBA ||
- style_prop->pspec->value_type == GDK_TYPE_COLOR)
- {
- /* Allow GtkSymbolicColor and special values as well */
- g_return_if_fail (value_type == GDK_TYPE_RGBA ||
- value_type == GDK_TYPE_COLOR ||
- value_type == GTK_TYPE_CSS_SPECIAL_VALUE ||
- value_type == GTK_TYPE_SYMBOLIC_COLOR);
- }
- else if (style_prop->pspec->value_type == CAIRO_GOBJECT_TYPE_PATTERN)
- {
- /* Allow GtkGradient and theme part as a substitute */
- g_return_if_fail (value_type == CAIRO_GOBJECT_TYPE_PATTERN ||
- value_type == GTK_TYPE_GRADIENT ||
- value_type == GTK_TYPE_WIN32_THEME_PART);
- }
- else if (style_prop->pspec->value_type == G_TYPE_INT)
- {
- g_return_if_fail (value_type == G_TYPE_INT ||
- value_type == GTK_TYPE_CSS_BORDER_RADIUS);
- }
- else
- g_return_if_fail (style_prop->pspec->value_type == value_type);
-
- if (GTK_IS_CSS_SHORTHAND_PROPERTY (style_prop))
- {
- GParameter *parameters;
- guint i, n_parameters;
-
- parameters = _gtk_style_property_unpack (style_prop, value, &n_parameters);
-
- for (i = 0; i < n_parameters; i++)
- {
- gtk_style_properties_set_property (props,
- parameters[i].name,
- state,
- ¶meters[i].value);
- g_value_unset (¶meters[i].value);
- }
- g_free (parameters);
- return;
- }
+ ValueData *val;
priv = props->priv;
prop = g_hash_table_lookup (priv->properties, style_prop);
@@ -587,19 +462,10 @@ _gtk_style_properties_set_property_by_property (GtkStyleProperties *props,
val = property_data_get_value (prop, state);
- if (G_VALUE_TYPE (val) == value_type)
- g_value_reset (val);
- else
- {
- if (G_IS_VALUE (val))
- g_value_unset (val);
-
- g_value_init (val, value_type);
- }
+ _gtk_css_value_unref (val->value);
+ val->value = _gtk_css_value_ref (value);
- g_value_copy (value, val);
- if (style_prop->pspec->value_type == value_type)
- g_param_value_validate (style_prop->pspec, val);
+ _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props));
}
/**
@@ -632,11 +498,13 @@ gtk_style_properties_set_property (GtkStyleProperties *props,
g_warning ("Style property \"%s\" is not registered", property);
return;
}
-
- _gtk_style_properties_set_property_by_property (props,
- node,
- state,
- value);
+ if (_gtk_style_property_get_value_type (node) == G_TYPE_NONE)
+ {
+ g_warning ("Style property \"%s\" is not settable", property);
+ return;
+ }
+
+ _gtk_style_property_assign (node, props, state, value);
}
/**
@@ -664,6 +532,7 @@ gtk_style_properties_set_valist (GtkStyleProperties *props,
{
GtkStyleProperty *node;
gchar *error = NULL;
+ GType val_type;
GValue val = G_VALUE_INIT;
node = _gtk_style_property_lookup (property_name);
@@ -674,7 +543,14 @@ gtk_style_properties_set_valist (GtkStyleProperties *props,
break;
}
- G_VALUE_COLLECT_INIT (&val, node->pspec->value_type,
+ val_type = _gtk_style_property_get_value_type (node);
+ if (val_type == G_TYPE_NONE)
+ {
+ g_warning ("Style property \"%s\" is not settable", property_name);
+ break;
+ }
+
+ G_VALUE_COLLECT_INIT (&val, _gtk_style_property_get_value_type (node),
args, 0, &error);
if (error)
{
@@ -684,7 +560,7 @@ gtk_style_properties_set_valist (GtkStyleProperties *props,
break;
}
- _gtk_style_properties_set_property_by_property (props, node, state, &val);
+ _gtk_style_property_assign (node, props, state, &val);
g_value_unset (&val);
property_name = va_arg (args, const gchar *);
@@ -715,10 +591,10 @@ gtk_style_properties_set (GtkStyleProperties *props,
va_end (args);
}
-const GValue *
-_gtk_style_properties_peek_property (GtkStyleProperties *props,
- GtkStyleProperty *property,
- GtkStateFlags state)
+GtkCssValue *
+_gtk_style_properties_peek_property (GtkStyleProperties *props,
+ GtkCssStyleProperty *property,
+ GtkStateFlags state)
{
GtkStylePropertiesPrivate *priv;
PropertyData *prop;
@@ -734,28 +610,20 @@ _gtk_style_properties_peek_property (GtkStyleProperties *props,
return property_data_match_state (prop, state);
}
-gboolean
-_gtk_style_properties_get_property (GtkStyleProperties *props,
- const gchar *property,
- GtkStateFlags state,
- GtkStylePropertyContext *context,
- GValue *value)
-{
- GtkStyleProperty *node;
-
- g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE);
- g_return_val_if_fail (property != NULL, FALSE);
- g_return_val_if_fail (value != NULL, FALSE);
+typedef struct {
+ GtkStyleProperties *props;
+ GtkStateFlags state;
+} StyleQueryData;
- node = _gtk_style_property_lookup (property);
- if (!node)
- {
- g_warning ("Style property \"%s\" is not registered", property);
- return FALSE;
- }
+static GtkCssValue *
+style_query_func (guint id,
+ gpointer data)
+{
+ StyleQueryData *query = data;
- _gtk_style_property_query (node, props, state, context, value);
- return TRUE;
+ return _gtk_style_properties_peek_property (query->props,
+ _gtk_css_style_property_lookup_by_id (id),
+ query->state);
}
/**
@@ -778,22 +646,47 @@ gtk_style_properties_get_property (GtkStyleProperties *props,
GtkStateFlags state,
GValue *value)
{
- GtkStylePropertyContext context = { 100, 100};
+ StyleQueryData query = { props, state };
+ GtkStyleProperty *node;
g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE);
g_return_val_if_fail (property != NULL, FALSE);
g_return_val_if_fail (value != NULL, FALSE);
- return _gtk_style_properties_get_property (props,
- property,
- state, &context, value);
+ node = _gtk_style_property_lookup (property);
+ if (!node)
+ {
+ g_warning ("Style property \"%s\" is not registered", property);
+ return FALSE;
+ }
+ if (_gtk_style_property_get_value_type (node) == G_TYPE_NONE)
+ {
+ g_warning ("Style property \"%s\" is not gettable", property);
+ return FALSE;
+ }
+
+ _gtk_style_property_query (node,
+ value,
+ style_query_func,
+ &query);
+
+ return TRUE;
}
+/**
+ * gtk_style_properties_get_valist:
+ * @props: a #GtkStyleProperties
+ * @state: state to retrieve the property values for
+ * @args: va_list of property name/return location pairs, followed by %NULL
+ *
+ * Retrieves several style property values from @props for a given state.
+ *
+ * Since: 3.0
+ **/
void
-_gtk_style_properties_get_valist (GtkStyleProperties *props,
- GtkStateFlags state,
- GtkStylePropertyContext *context,
- va_list args)
+gtk_style_properties_get_valist (GtkStyleProperties *props,
+ GtkStateFlags state,
+ va_list args)
{
const gchar *property_name;
@@ -806,11 +699,10 @@ _gtk_style_properties_get_valist (GtkStyleProperties *props,
gchar *error = NULL;
GValue value = G_VALUE_INIT;
- if (!_gtk_style_properties_get_property (props,
- property_name,
- state,
- context,
- &value))
+ if (!gtk_style_properties_get_property (props,
+ property_name,
+ state,
+ &value))
break;
G_VALUE_LCOPY (&value, args, 0, &error);
@@ -827,41 +719,6 @@ _gtk_style_properties_get_valist (GtkStyleProperties *props,
}
}
-/**
- * gtk_style_properties_get_valist:
- * @props: a #GtkStyleProperties
- * @state: state to retrieve the property values for
- * @args: va_list of property name/return location pairs, followed by %NULL
- *
- * Retrieves several style property values from @props for a given state.
- *
- * Since: 3.0
- **/
-void
-gtk_style_properties_get_valist (GtkStyleProperties *props,
- GtkStateFlags state,
- va_list args)
-{
- GtkStylePropertyContext context = { 100, 100};
-
- return _gtk_style_properties_get_valist (props, state, &context, args);
-}
-
-void
-_gtk_style_properties_get (GtkStyleProperties *props,
- GtkStateFlags state,
- GtkStylePropertyContext *context,
- ...)
-{
- va_list args;
-
- g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
-
- va_start (args, context);
- _gtk_style_properties_get_valist (props, state, context, args);
- va_end (args);
-}
-
/**
* gtk_style_properties_get:
* @props: a #GtkStyleProperties
@@ -917,10 +774,23 @@ gtk_style_properties_unset_property (GtkStyleProperties *props,
g_warning ("Style property \"%s\" is not registered", property);
return;
}
+ if (_gtk_style_property_get_value_type (node) == G_TYPE_NONE)
+ {
+ g_warning ("Style property \"%s\" is not settable", property);
+ return;
+ }
- if (node->unset_func)
+ if (GTK_IS_CSS_SHORTHAND_PROPERTY (node))
{
- node->unset_func (props, state);
+ GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (node);
+
+ for (pos = 0; pos < _gtk_css_shorthand_property_get_n_subproperties (shorthand); pos++)
+ {
+ GtkCssStyleProperty *sub = _gtk_css_shorthand_property_get_subproperty (shorthand, pos);
+ gtk_style_properties_unset_property (props,
+ _gtk_style_property_get_name (GTK_STYLE_PROPERTY (sub)),
+ state);
+ }
return;
}
@@ -936,10 +806,12 @@ gtk_style_properties_unset_property (GtkStyleProperties *props,
data = &g_array_index (prop->values, ValueData, pos);
- if (G_IS_VALUE (&data->value))
- g_value_unset (&data->value);
+ _gtk_css_value_unref (data->value);
+ data->value = NULL;
g_array_remove_index (prop->values, pos);
+
+ _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props));
}
}
@@ -958,6 +830,8 @@ gtk_style_properties_clear (GtkStyleProperties *props)
priv = props->priv;
g_hash_table_remove_all (priv->properties);
+
+ _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props));
}
/**
@@ -1005,7 +879,9 @@ gtk_style_properties_merge (GtkStyleProperties *props,
g_hash_table_lookup (priv->color_map, name))
continue;
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gtk_style_properties_map_color (props, name, color);
+ G_GNUC_END_IGNORE_DEPRECATIONS;
}
}
@@ -1029,12 +905,12 @@ gtk_style_properties_merge (GtkStyleProperties *props,
for (i = 0; i < prop_to_merge->values->len; i++)
{
ValueData *data;
- GValue *value;
+ ValueData *value;
data = &g_array_index (prop_to_merge->values, ValueData, i);
if (replace && data->state == GTK_STATE_FLAG_NORMAL &&
- G_VALUE_TYPE (&data->value) != PANGO_TYPE_FONT_DESCRIPTION)
+ _gtk_is_css_typed_value_of_type (data->value, PANGO_TYPE_FONT_DESCRIPTION))
{
/* Let normal state override all states
* previously set in the original set
@@ -1044,20 +920,20 @@ gtk_style_properties_merge (GtkStyleProperties *props,
value = property_data_get_value (prop, data->state);
- if (G_VALUE_TYPE (&data->value) == PANGO_TYPE_FONT_DESCRIPTION &&
- G_IS_VALUE (value))
+ if (_gtk_is_css_typed_value_of_type (data->value, PANGO_TYPE_FONT_DESCRIPTION) &&
+ value->value != NULL)
{
PangoFontDescription *font_desc;
PangoFontDescription *font_desc_to_merge;
/* Handle merging of font descriptions */
- font_desc = g_value_get_boxed (value);
- font_desc_to_merge = g_value_get_boxed (&data->value);
+ font_desc = g_value_get_boxed (_gtk_css_typed_value_get (value->value));
+ font_desc_to_merge = g_value_get_boxed (_gtk_css_typed_value_get (data->value));
pango_font_description_merge (font_desc, font_desc_to_merge, replace);
}
- else if (G_VALUE_TYPE (&data->value) == G_TYPE_PTR_ARRAY &&
- G_IS_VALUE (value))
+ else if (_gtk_is_css_typed_value_of_type (data->value, G_TYPE_PTR_ARRAY) &&
+ value->value != NULL)
{
GPtrArray *array, *array_to_merge;
gint i;
@@ -1065,24 +941,19 @@ gtk_style_properties_merge (GtkStyleProperties *props,
/* Append the array, mainly thought
* for the gtk-key-bindings property
*/
- array = g_value_get_boxed (value);
- array_to_merge = g_value_get_boxed (&data->value);
+ array = g_value_get_boxed (_gtk_css_typed_value_get (value->value));
+ array_to_merge = g_value_get_boxed (_gtk_css_typed_value_get (data->value));
for (i = 0; i < array_to_merge->len; i++)
g_ptr_array_add (array, g_ptr_array_index (array_to_merge, i));
}
- else if (replace || !G_IS_VALUE (value))
+ else if (replace || value->value == NULL)
{
- if (!G_IS_VALUE (value))
- g_value_init (value, G_VALUE_TYPE (&data->value));
- else if (G_VALUE_TYPE (value) != G_VALUE_TYPE (&data->value))
- {
- g_value_unset (value);
- g_value_init (value, G_VALUE_TYPE (&data->value));
- }
-
- g_value_copy (&data->value, value);
+ _gtk_css_value_unref (value->value);
+ value->value = _gtk_css_value_ref (data->value);
}
}
}
+
+ _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props));
}