gtk-css-engine r24 - in bzr-playground: . libccd/ccd
- From: robsta svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk-css-engine r24 - in bzr-playground: . libccd/ccd
- Date: Mon, 18 Aug 2008 13:51:05 +0000 (UTC)
Author: robsta
Date: Mon Aug 18 13:51:04 2008
New Revision: 24
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=24&view=rev
Log:
Parse the `background' property.
Removed:
bzr-playground/libccd/ccd/ccd-utils.h
Modified:
bzr-playground/ (props changed)
bzr-playground/libccd/ccd/Makefile.am
bzr-playground/libccd/ccd/ccd-background.c
bzr-playground/libccd/ccd/ccd-border.c
bzr-playground/libccd/ccd/ccd-color.c
bzr-playground/libccd/ccd/ccd-color.h
bzr-playground/libccd/ccd/ccd-image.c
bzr-playground/libccd/ccd/ccd-image.h
bzr-playground/libccd/ccd/ccd-property.c
bzr-playground/libccd/ccd/ccd-property.h
Modified: bzr-playground/libccd/ccd/Makefile.am
==============================================================================
--- bzr-playground/libccd/ccd/Makefile.am (original)
+++ bzr-playground/libccd/ccd/Makefile.am Mon Aug 18 13:51:04 2008
@@ -36,8 +36,7 @@
ccd-style.c \
ccd-style.h \
ccd-stylesheet.c \
- ccd-stylesheet.h \
- ccd-utils.h
+ ccd-stylesheet.h
if CCD_WITH_GTK
libccd_la_SOURCES += \
Modified: bzr-playground/libccd/ccd/ccd-background.c
==============================================================================
--- bzr-playground/libccd/ccd/ccd-background.c (original)
+++ bzr-playground/libccd/ccd/ccd-background.c Mon Aug 18 13:51:04 2008
@@ -32,45 +32,54 @@
g_free (self);
}
-/*
static bool
-bg_color_parse (ccd_background_color_t *self,
- CRTerm const *values)
+bg_color_parse (ccd_background_color_t *self,
+ CRTerm const **values)
{
- ccd_property_spec_t spec;
-
- spec = ccd_color_parse (self->color, values);
- if (CCD_PROPERTY_SPEC_UNSET == spec) {
-
+ if (!*values) {
+ return false;
}
+
+ self->spec = ccd_color_parse (&self->color, values);
+ return self->spec == CCD_PROPERTY_SPEC_SET;
}
static bool
-bg_image_parse (ccd_background_image_t *self,
- CRTerm const *values)
+bg_image_parse (ccd_background_image_t *self,
+ CRTerm const **values)
{
+ if (!*values) {
+ return false;
+ }
+ self->spec = ccd_image_parse (&self->image, values);
+ return self->spec == CCD_PROPERTY_SPEC_SET;
}
-*/
bool
ccd_background_parse (ccd_background_t *self,
char const *property,
CRTerm const *values)
{
- ccd_property_spec_t spec;
+ bool ret;
+
+ ret = false;
+
+ if (0 == strcmp ("background", property)) {
+
+ ret |= bg_color_parse (&self->bg_color, &values);
+ ret |= bg_image_parse (&self->bg_image, &values);
+ return ret;
+ }
- spec = CCD_PROPERTY_SPEC_UNSET;
if (0 == strcmp ("background-color", property)) {
- spec = ccd_color_parse (&self->bg_color.color, values);
- g_return_val_if_fail (spec != CCD_PROPERTY_SPEC_UNSET, false);
- self->bg_color.spec = spec;
- return true;
- } else if (0 == strcmp ("background-image", property)) {
- spec = ccd_image_parse (&self->bg_image.image, values);
- g_return_val_if_fail (spec != CCD_PROPERTY_SPEC_UNSET, false);
- self->bg_image.spec = spec;
- return true;
+
+ return bg_color_parse (&self->bg_color, &values);
+ }
+
+ if (0 == strcmp ("background-image", property)) {
+
+ return bg_image_parse (&self->bg_image, &values);
}
return false;
@@ -125,11 +134,11 @@
void
ccd_background_dump (ccd_background_t const *self)
{
- printf (" background-color: ");
+ printf (CCD_PROPERTY_DUMP_PREFIX "background-color: ");
ccd_background_color_dump (&self->bg_color);
printf (";\n");
- printf (" background-image: ");
+ printf (CCD_PROPERTY_DUMP_PREFIX "background-image: ");
ccd_background_image_dump (&self->bg_image);
printf (";\n");
}
Modified: bzr-playground/libccd/ccd/ccd-border.c
==============================================================================
--- bzr-playground/libccd/ccd/ccd-border.c (original)
+++ bzr-playground/libccd/ccd/ccd-border.c Mon Aug 18 13:51:04 2008
@@ -20,7 +20,6 @@
#include <stdio.h>
#include <string.h>
#include "ccd-border.h"
-#include "ccd-utils.h"
#define SET_COMMON_WIDTH(spec_, border_, val_) \
if (CCD_PROPERTY_SPEC_SET == spec_ && \
@@ -167,7 +166,7 @@
iter = values;
width = 0; /* prevent warning */
- width_spec = ccd_property_parse_spec (iter);
+ width_spec = ccd_property_parse_spec (&iter);
if (CCD_PROPERTY_SPEC_SET == width_spec &&
iter &&
TERM_NUMBER == iter->type) {
@@ -177,7 +176,7 @@
width_spec = CCD_PROPERTY_SPEC_SET;
}
- style_spec = ccd_property_parse_spec (iter);
+ style_spec = ccd_property_parse_spec (&iter);
style = CCD_BORDER_STYLE_SOLID; /* prevent warning */
if (CCD_PROPERTY_SPEC_SET == style_spec &&
iter &&
@@ -188,13 +187,13 @@
style_spec = CCD_PROPERTY_SPEC_SET;
}
- color_spec = ccd_property_parse_spec (iter);
+ color_spec = ccd_property_parse_spec (&iter);
color.red = color.green = color.blue = 0; /* prevent warning */
if (CCD_PROPERTY_SPEC_SET == color_spec &&
iter &&
- ccd_color_parse (&color, iter)) {
+ ccd_color_parse (&color, &iter)) {
/* color */
- iter = iter->next;
+ /* iter is advanced by ccd_color_parse() */
color_spec = CCD_PROPERTY_SPEC_SET;
}
Modified: bzr-playground/libccd/ccd/ccd-color.c
==============================================================================
--- bzr-playground/libccd/ccd/ccd-color.c (original)
+++ bzr-playground/libccd/ccd/ccd-color.c Mon Aug 18 13:51:04 2008
@@ -255,33 +255,44 @@
}
ccd_property_spec_t
-ccd_color_parse (ccd_color_t *self,
- CRTerm const *value)
+ccd_color_parse (ccd_color_t *self,
+ CRTerm const **value)
{
ccd_property_spec_t type;
char const *str;
+ bool ret;
- g_return_val_if_fail (self && value, false);
+ g_return_val_if_fail (self, CCD_PROPERTY_SPEC_UNSET);
- switch (value->type) {
+ if (!*value) {
+ return CCD_PROPERTY_SPEC_UNSET;
+ }
+
+ switch ((*value)->type) {
case TERM_IDENT:
type = ccd_property_parse_spec (value);
if (type != CCD_PROPERTY_SPEC_SET) {
return type;
}
- str = cr_string_peek_raw_str (value->content.str);
- return parse_name (self, str) ?
- CCD_PROPERTY_SPEC_SET :
- CCD_PROPERTY_SPEC_UNSET;
+ str = cr_string_peek_raw_str ((*value)->content.str);
+ ret = parse_name (self, str);
+ if (ret) {
+ *value = (*value)->next;
+ return CCD_PROPERTY_SPEC_SET;
+ }
+ return CCD_PROPERTY_SPEC_UNSET;
case TERM_HASH:
- str = cr_string_peek_raw_str (value->content.str);
- return parse_hex (self, str) ?
- CCD_PROPERTY_SPEC_SET :
- CCD_PROPERTY_SPEC_UNSET;
+ str = cr_string_peek_raw_str ((*value)->content.str);
+ ret = parse_hex (self, str);
+ if (ret) {
+ *value = (*value)->next;
+ return CCD_PROPERTY_SPEC_SET;
+ }
+ return CCD_PROPERTY_SPEC_UNSET;
case TERM_RGB:
- self->red = value->content.rgb->red;
- self->green = value->content.rgb->green;
- self->blue = value->content.rgb->blue;
+ self->red = (*value)->content.rgb->red;
+ self->green = (*value)->content.rgb->green;
+ self->blue = (*value)->content.rgb->blue;
return CCD_PROPERTY_SPEC_SET;
/* fall thru for all other enum values to prevent compiler warnings */
case TERM_NO_TYPE:
Modified: bzr-playground/libccd/ccd/ccd-color.h
==============================================================================
--- bzr-playground/libccd/ccd/ccd-color.h (original)
+++ bzr-playground/libccd/ccd/ccd-color.h Mon Aug 18 13:51:04 2008
@@ -34,7 +34,7 @@
double blue;
} ccd_color_t;
-ccd_property_spec_t ccd_color_parse (ccd_color_t *self, CRTerm const *value);
+ccd_property_spec_t ccd_color_parse (ccd_color_t *self, CRTerm const **value);
void ccd_color_dump (ccd_color_t const *self);
Modified: bzr-playground/libccd/ccd/ccd-image.c
==============================================================================
--- bzr-playground/libccd/ccd/ccd-image.c (original)
+++ bzr-playground/libccd/ccd/ccd-image.c Mon Aug 18 13:51:04 2008
@@ -141,14 +141,15 @@
}
ccd_property_spec_t
-ccd_image_parse (ccd_image_t *self,
- CRTerm const *value)
+ccd_image_parse (ccd_image_t *self,
+ CRTerm const **value)
{
- switch (value->type) {
+ switch ((*value)->type) {
case TERM_IDENT:
return ccd_property_parse_spec (value);
case TERM_URI:
- self->uri = ccd_function_invoke ("url", value);
+ self->uri = ccd_function_invoke ("url", *value);
+ *value = (*value)->next;
return load_image (self) ?
CCD_PROPERTY_SPEC_SET :
CCD_PROPERTY_SPEC_UNSET;
Modified: bzr-playground/libccd/ccd/ccd-image.h
==============================================================================
--- bzr-playground/libccd/ccd/ccd-image.h (original)
+++ bzr-playground/libccd/ccd/ccd-image.h Mon Aug 18 13:51:04 2008
@@ -33,7 +33,7 @@
cairo_surface_t *surface;
} ccd_image_t;
-ccd_property_spec_t ccd_image_parse (ccd_image_t *self, CRTerm const *value);
+ccd_property_spec_t ccd_image_parse (ccd_image_t *self, CRTerm const **value);
void ccd_image_discard (ccd_image_t *self);
Modified: bzr-playground/libccd/ccd/ccd-property.c
==============================================================================
--- bzr-playground/libccd/ccd/ccd-property.c (original)
+++ bzr-playground/libccd/ccd/ccd-property.c Mon Aug 18 13:51:04 2008
@@ -22,18 +22,20 @@
#include "ccd-property.h"
ccd_property_spec_t
-ccd_property_parse_spec (CRTerm const *value)
+ccd_property_parse_spec (CRTerm const **value)
{
char const *str;
- if (!value) {
+ if (!*value) {
return CCD_PROPERTY_SPEC_UNSET;
- } else if (TERM_IDENT == value->type) {
- str = cr_string_peek_raw_str (value->content.str);
+ } else if (TERM_IDENT == (*value)->type) {
+ str = cr_string_peek_raw_str ((*value)->content.str);
if (0 == strcmp ("none", str)) {
+ *value = (*value)->next;
return CCD_PROPERTY_SPEC_NONE;
} else if (0 == strcmp ("inherit", str)) {
g_warning ("Property `inherit' not supported yet.");
+ *value = (*value)->next;
return CCD_PROPERTY_SPEC_INHERIT;
}
}
Modified: bzr-playground/libccd/ccd/ccd-property.h
==============================================================================
--- bzr-playground/libccd/ccd/ccd-property.h (original)
+++ bzr-playground/libccd/ccd/ccd-property.h Mon Aug 18 13:51:04 2008
@@ -26,6 +26,8 @@
G_BEGIN_DECLS
+#define CCD_PROPERTY_DUMP_PREFIX " "
+
typedef enum {
CCD_PROPERTY_SPEC_UNSET = 0,
CCD_PROPERTY_SPEC_NONE,
@@ -33,7 +35,7 @@
CCD_PROPERTY_SPEC_SET
} ccd_property_spec_t;
-ccd_property_spec_t ccd_property_parse_spec (CRTerm const *value);
+ccd_property_spec_t ccd_property_parse_spec (CRTerm const **value);
void ccd_property_spec_dump (ccd_property_spec_t const spec);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]