gtk-css-engine r182 - in trunk: . src



Author: robsta
Date: Thu Nov  6 14:03:10 2008
New Revision: 182
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=182&view=rev

Log:
* src/gce-node.c (gce_node_cache_fetch_node), (get_container),
(get_class), (get_pseudo_class), (get_attribute):
Propagate attributes from primitive to widget, for richer matching.



Modified:
   trunk/ChangeLog
   trunk/src/gce-node.c

Modified: trunk/src/gce-node.c
==============================================================================
--- trunk/src/gce-node.c	(original)
+++ trunk/src/gce-node.c	Thu Nov  6 14:03:10 2008
@@ -26,14 +26,15 @@
 struct GceNode_ {
 	ccss_node_t		 parent;
 	GtkWidget		*widget;
-	/* custom attributes { */
-	char const		*class_name;
-	char const		*pseudo_class;
-	char const		*gap;
-	char const		*shadow;
-	char const		*orientation;
-	char const		*edge;
-	char const		*expander_style;
+	struct {
+		char const	*class_name;
+		char const	*pseudo_class;
+		char const	*gap;
+		char const	*shadow;
+		char const	*orientation;
+		char const	*edge;
+		char const	*expander_style;
+	} attribs;
 	enum {
 		UNSET,
 		CONTAINER,
@@ -93,13 +94,13 @@
 	node = fetch_node ();
 
 	node->widget = widget;
-	node->class_name = class_name;
-	node->pseudo_class = pseudo_class;
-	node->gap = gap;
-	node->shadow = shadow;
-	node->orientation = orientation;
-	node->edge = edge;
-	node->expander_style = expander_style;
+	node->attribs.class_name = class_name;
+	node->attribs.pseudo_class = pseudo_class;
+	node->attribs.gap = gap;
+	node->attribs.shadow = shadow;
+	node->attribs.orientation = orientation;
+	node->attribs.edge = edge;
+	node->attribs.expander_style = expander_style;
 	node->flavor = PRIMITIVE;	
 	node->impl.primitive = primitive;
 
@@ -165,6 +166,8 @@
 		container_node = fetch_node ();
 		container_node->widget = (GtkWidget *) g_object_ref (G_OBJECT (node->widget));
 		container_node->flavor = UNSET;
+		/* Properties propagate to the primitive's widget. */
+		/* TODO container_node->attribs = node->attribs; */
 		break;
 	case TYPE:
 		g_assert_not_reached ();
@@ -274,7 +277,7 @@
 {
 	g_return_val_if_fail (node, NULL);
 
-	return node->class_name;
+	return node->attribs.class_name;
 }
 
 static char const *
@@ -282,7 +285,7 @@
 {
 	g_return_val_if_fail (node, NULL);
 
-	return node->pseudo_class;
+	return node->attribs.pseudo_class;
 }
 
 static char *
@@ -339,15 +342,15 @@
 
 	/* Attributes provided in the drawing function take precedence. */
 	if (0 == strcmp ("shadow", name)) {
-		return g_strdup (node->shadow);
+		return g_strdup (node->attribs.shadow);
 	} else if (0 == strcmp ("orientation", name)) {
-		return g_strdup (node->orientation);
+		return g_strdup (node->attribs.orientation);
 	} else if (0 == strcmp ("edge", name)) {
-		return g_strdup (node->edge);
+		return g_strdup (node->attribs.edge);
 	} else if (0 == strcmp ("expander-style", name)) {
-		return g_strdup (node->expander_style);
+		return g_strdup (node->attribs.expander_style);
 	} else if (0 == strcmp ("gap", name)) {
-		return g_strdup (node->gap);
+		return g_strdup (node->attribs.gap);
 	}
 
 	/* Now try to find an apropriate style property. */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]