summaryrefslogtreecommitdiff
path: root/gtk/gtkstyleproperty.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2012-01-02 00:14:23 +0100
committerBenjamin Otte <otte@redhat.com>2012-01-09 18:37:53 +0100
commit389531d15d467474f545102ad9895c2501165d9c (patch)
treebe9b559c62fa059e5a1a3e1a43eae45b3babbf72 /gtk/gtkstyleproperty.c
parent30eb26087c8b8ac3562c9370a07d3a389cd7a8e1 (diff)
downloadgtk+-389531d15d467474f545102ad9895c2501165d9c.tar.gz
styleproperty: require property in _gtk_style_property_parse_value()
Other code uses _gtk_css_style_parse_value() instead now.
Diffstat (limited to 'gtk/gtkstyleproperty.c')
-rw-r--r--gtk/gtkstyleproperty.c87
1 files changed, 42 insertions, 45 deletions
diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c
index 1c638b3ba3..b444cf104a 100644
--- a/gtk/gtkstyleproperty.c
+++ b/gtk/gtkstyleproperty.c
@@ -385,56 +385,53 @@ _gtk_style_property_parse_value (GtkStyleProperty *property,
GtkCssParser *parser,
GFile *base)
{
+ g_return_val_if_fail (GTK_IS_STYLE_PROPERTY (property), FALSE);
g_return_val_if_fail (value != NULL, FALSE);
g_return_val_if_fail (parser != NULL, FALSE);
- if (property)
+ if (_gtk_css_parser_try (parser, "initial", TRUE))
{
- if (_gtk_css_parser_try (parser, "initial", TRUE))
- {
- /* the initial value can be explicitly specified with the
- * ‘initial’ keyword which all properties accept.
- */
- g_value_unset (value);
- g_value_init (value, GTK_TYPE_CSS_SPECIAL_VALUE);
- g_value_set_enum (value, GTK_CSS_INITIAL);
- return TRUE;
- }
- else if (_gtk_css_parser_try (parser, "inherit", TRUE))
- {
- /* All properties accept the ‘inherit’ value which
- * explicitly specifies that the value will be determined
- * by inheritance. The ‘inherit’ value can be used to
- * strengthen inherited values in the cascade, and it can
- * also be used on properties that are not normally inherited.
- */
- g_value_unset (value);
- g_value_init (value, GTK_TYPE_CSS_SPECIAL_VALUE);
- g_value_set_enum (value, GTK_CSS_INHERIT);
- return TRUE;
- }
- else if (property->property_parse_func)
- {
- GError *error = NULL;
- char *value_str;
- gboolean success;
-
- value_str = _gtk_css_parser_read_value (parser);
- if (value_str == NULL)
- return FALSE;
-
- success = (*property->property_parse_func) (value_str, value, &error);
-
- g_free (value_str);
-
- return success;
- }
-
- if (property->parse_func)
- return (* property->parse_func) (parser, base, value);
+ /* the initial value can be explicitly specified with the
+ * ‘initial’ keyword which all properties accept.
+ */
+ g_value_unset (value);
+ g_value_init (value, GTK_TYPE_CSS_SPECIAL_VALUE);
+ g_value_set_enum (value, GTK_CSS_INITIAL);
+ return TRUE;
}
-
- return _gtk_css_style_parse_value (value, parser, base);
+ else if (_gtk_css_parser_try (parser, "inherit", TRUE))
+ {
+ /* All properties accept the ‘inherit’ value which
+ * explicitly specifies that the value will be determined
+ * by inheritance. The ‘inherit’ value can be used to
+ * strengthen inherited values in the cascade, and it can
+ * also be used on properties that are not normally inherited.
+ */
+ g_value_unset (value);
+ g_value_init (value, GTK_TYPE_CSS_SPECIAL_VALUE);
+ g_value_set_enum (value, GTK_CSS_INHERIT);
+ return TRUE;
+ }
+ else if (property->property_parse_func)
+ {
+ GError *error = NULL;
+ char *value_str;
+ gboolean success;
+
+ value_str = _gtk_css_parser_read_value (parser);
+ if (value_str == NULL)
+ return FALSE;
+
+ success = (*property->property_parse_func) (value_str, value, &error);
+
+ g_free (value_str);
+
+ return success;
+ }
+ else if (property->parse_func)
+ return (* property->parse_func) (parser, base, value);
+ else
+ return _gtk_css_style_parse_value (value, parser, base);
}
GParameter *