summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Staudinger <robsta@gnome.org>2009-06-22 15:20:06 +0200
committerRobert Staudinger <robsta@gnome.org>2009-06-22 15:20:06 +0200
commit46bf1e9ace28e1c28ebb638f07dcf3a153104cb5 (patch)
tree272ceade0d68b9589ccd7ab60d1601f28acdcc0b
parent4a07cea07453e5a0520a2a14ccce8bd5e44e541f (diff)
[color] Set property state to 'set' if parsing successful.
Callers of ccss_color_parse() needed to do that themselves before, doing it once for all is more future proof.
-rw-r--r--ccss/ccss-color-parser.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/ccss/ccss-color-parser.c b/ccss/ccss-color-parser.c
index ab04568..70c66aa 100644
--- a/ccss/ccss-color-parser.c
+++ b/ccss/ccss-color-parser.c
@@ -494,6 +494,7 @@ ccss_color_parse (ccss_color_t *self,
case CCSS_PROPERTY_STATE_INHERIT:
return true;
case CCSS_PROPERTY_STATE_SET:
+ /* Process this. */
break;
case CCSS_PROPERTY_STATE_INVALID:
default:
@@ -502,6 +503,7 @@ ccss_color_parse (ccss_color_t *self,
str = cr_string_peek_raw_str ((*value)->content.str);
ret = parse_name (self, str);
if (ret) {
+ self->base.state = CCSS_PROPERTY_STATE_SET;
*value = (*value)->next;
return true;
}
@@ -510,6 +512,7 @@ ccss_color_parse (ccss_color_t *self,
str = cr_string_peek_raw_str ((*value)->content.str);
ret = parse_hex (self, str);
if (ret) {
+ self->base.state = CCSS_PROPERTY_STATE_SET;
*value = (*value)->next;
return true;
}
@@ -531,6 +534,7 @@ ccss_color_parse (ccss_color_t *self,
0., 255.) / 255.;
}
self->alpha = 1.;
+ self->base.state = CCSS_PROPERTY_STATE_SET;
*value = (*value)->next;
return true;
case TERM_FUNCTION:
@@ -556,15 +560,16 @@ ccss_color_parse (ccss_color_t *self,
&self->green,
&self->blue,
&self->alpha);
+ g_free (rgba);
if (matches == 4) {
+ self->base.state = CCSS_PROPERTY_STATE_SET;
*value = (*value)->next;
- g_free (rgba);
return true;
+ } else {
+ g_warning ("%s: Invalid color '%s'",
+ G_STRLOC,
+ rgba);
}
- g_warning ("%s: Invalid color '%s'",
- G_STRLOC,
- rgba);
- g_free (rgba);
}
g_warning (G_STRLOC " '%s' not recognised.", str);
break;