gtk-css-engine r189 - in trunk: . conf src



Author: robsta
Date: Tue Nov 11 12:17:11 2008
New Revision: 189
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=189&view=rev

Log:
* conf/Makefile.am: 
* configure.in:
* src/Makefile.am:
* src/gce-rc-style.c (parse):
Install and use the user-agent CSS.

* src/gce-node.c (_to_string), (get_viewport): handle GtkPositionType, viewport query on containers.

* src/gce-style.c (class_init): fix intendation.


Added:
   trunk/conf/Makefile.am
Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/src/Makefile.am
   trunk/src/gce-node.c
   trunk/src/gce-rc-style.c
   trunk/src/gce-style.c

Added: trunk/conf/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/conf/Makefile.am	Tue Nov 11 12:17:11 2008
@@ -0,0 +1,9 @@
+
+uastylesheetdir = $(sysconfdir)/gtk-css-engine
+
+uastylesheet_DATA = \
+	 user-agent.css
+
+EXTRA_DIST = \
+	$(uastylesheet_DATA)
+

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Tue Nov 11 12:17:11 2008
@@ -148,6 +148,7 @@
 
 AC_CONFIG_FILES([
   Makefile
+  conf/Makefile
   doc/Makefile
   src/Makefile
   themes/Makefile

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Tue Nov 11 12:17:11 2008
@@ -3,7 +3,8 @@
 # http://www.gnu.org/software/libtool/manual/automake/Libtool-Issues.html
 
 _cppflags = \
-	$(GCE_CFLAGS)
+	$(GCE_CFLAGS) \
+	-DGCE_UA_STYLESHEET=\"$(sysconfdir)/gtk-css-engine/user-agent.css\"
 
 enginedir = $(libdir)/gtk-2.0/$(GTK_VERSION)/engines
 

Modified: trunk/src/gce-node.c
==============================================================================
--- trunk/src/gce-node.c	(original)
+++ trunk/src/gce-node.c	Tue Nov 11 12:17:11 2008
@@ -19,6 +19,7 @@
 
 #include <string.h>
 #include <ccss-gtk/ccss-gtk.h>
+#include "gce-maps.h"
 #include "gce-node.h"
 
 struct GceNode_ {
@@ -289,7 +290,12 @@
 static char *
 _to_string (GValue const *value)
 {
-	switch (G_VALUE_TYPE (value)) {
+	GType	type;
+	gint	enum_value;
+
+	type = G_VALUE_TYPE (value);
+
+	switch (type) {
 	case G_TYPE_BOOLEAN:
 		return g_value_get_boolean (value) ?
 				g_strdup ("true") : 
@@ -319,9 +325,18 @@
 	case G_TYPE_STRING:
 		return g_strdup (g_value_get_string (value));
 	default:
-		g_assert_not_reached ();
-		return NULL;
+		/* Fall thru. Need some dummy code. */
+		enum_value = 0;
 	}
+
+	/* Non-fundamental types can not be handled using `switch'. */
+	if (GTK_TYPE_POSITION_TYPE == type) {
+		enum_value = g_value_get_enum (value);
+		return g_strdup (gce_maps_get_position ((GtkPositionType) enum_value));
+	}
+
+	g_warning ("Could not convert `%s'", g_type_name (type));
+	return NULL;
 }
 
 static char *
@@ -384,16 +399,14 @@
 	switch (node->flavor) {
 	case UNSET:
 	case PRIMITIVE:
-	case TYPE:
 		*x = node->widget->allocation.x;
 		*y = node->widget->allocation.y;
 		*width = node->widget->allocation.width;
 		*height = node->widget->allocation.height;
 		break;
+	case TYPE:
 	case CONTAINER:
-	default:
-		g_warning ("Unknown flavor %d\n", node->flavor);
-		g_assert_not_reached ();
+		/* Viewport is not valid. */
 		return FALSE;
 	}
 

Modified: trunk/src/gce-rc-style.c
==============================================================================
--- trunk/src/gce-rc-style.c	(original)
+++ trunk/src/gce-rc-style.c	Tue Nov 11 12:17:11 2008
@@ -82,8 +82,19 @@
 		g_assert (_stylesheet == NULL);
 		gce_file = gtk_rc_find_pixmap_in_path (gtk_settings_get_default (), 
 				scanner, scanner->value.v_string);
-		/* TODO also load user agent stylesheet. */
-		_stylesheet = ccss_stylesheet_new_from_file (gce_file);
+
+		/* User-agent stylesheet */
+		_stylesheet = ccss_stylesheet_add_from_file (NULL,
+							     GCE_UA_STYLESHEET,
+							     CCSS_STYLESHEET_USER_AGENT);
+
+		if (!_stylesheet) {
+			g_critical ("Could not add user-agent stylesheet `%s'",
+				    GCE_UA_STYLESHEET);
+		}
+
+		ccss_stylesheet_add_from_file (_stylesheet, gce_file,
+					       CCSS_STYLESHEET_AUTHOR);
 #ifdef GCE_RAPID_DEVELOPMENT
 		G_STMT_START
 		char *rc_string;

Modified: trunk/src/gce-style.c
==============================================================================
--- trunk/src/gce-style.c	(original)
+++ trunk/src/gce-style.c	Tue Nov 11 12:17:11 2008
@@ -800,9 +800,9 @@
 	style_class->draw_slider = draw_slider;
 	style_class->draw_handle = draw_handle;
 	style_class->draw_expander = draw_expander;
-/*
-draw_layout
-*/
+	/*
+	draw_layout
+	*/
 	style_class->draw_resize_grip = draw_resize_grip;
 }
 



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