gtk-css-engine r203 - in trunk: . src themes/Thorwil/gtk-2.0



Author: robsta
Date: Mon Dec  1 16:36:26 2008
New Revision: 203
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=203&view=rev

Log:
* src/css2gtkrc.c (main):
* src/gce-properties.c (gce_gtk_border_new):
* src/gce-rc-style.c (parse), (finalize):
* src/gce-serialize.c (accumulate_state):
* src/gce-style.c (rectangle), (gap), (line):
* src/gce-theme.c (theme_init), (theme_exit):
Fix after ccss API changes (introduction of ccss_grammar_t).



Modified:
   trunk/ChangeLog
   trunk/src/css2gtkrc.c
   trunk/src/gce-properties.c
   trunk/src/gce-rc-style.c
   trunk/src/gce-serialize.c
   trunk/src/gce-style.c
   trunk/src/gce-theme.c
   trunk/themes/Thorwil/gtk-2.0/theme.svg

Modified: trunk/src/css2gtkrc.c
==============================================================================
--- trunk/src/css2gtkrc.c	(original)
+++ trunk/src/css2gtkrc.c	Mon Dec  1 16:36:26 2008
@@ -28,8 +28,8 @@
 main (int	  argc,
       char	**argv)
 {
+	ccss_grammar_t			*grammar;
 	ccss_stylesheet_t		*stylesheet;
-	ccss_property_class_t const	*properties;
 	char				*gtkrc;
 
 	if (argc <= 1) {
@@ -37,16 +37,17 @@
 		return EXIT_FAILURE;
 	}
 
-	ccss_init ();
+	ccss_cairo_init ();
 
-	properties = gce_properties_get_ptable ();
-	ccss_add_properties (properties);
+	grammar = ccss_cairo_grammar_create ();
+	ccss_grammar_add_properties (grammar, gce_properties_get_ptable ());
 
-	stylesheet = ccss_stylesheet_new_from_file (argv[1]);
+	stylesheet = ccss_grammar_create_stylesheet_from_file (grammar, argv[1]);
 	g_assert (stylesheet);
 
 	gtkrc = gce_serialize (stylesheet);
-	ccss_stylesheet_free (stylesheet), stylesheet = NULL;
+	ccss_stylesheet_destroy (stylesheet), stylesheet = NULL;
+	ccss_grammar_destroy (grammar), grammar = NULL;
 
 	if (NULL == gtkrc) {
 		fprintf (stderr, "Conversion failed.\n");
@@ -58,7 +59,7 @@
 
 	g_free (gtkrc), gtkrc = NULL;
 
-	ccss_shutdown ();
+	ccss_cairo_shutdown ();
 
 	return EXIT_SUCCESS;
 }

Modified: trunk/src/gce-properties.c
==============================================================================
--- trunk/src/gce-properties.c	(original)
+++ trunk/src/gce-properties.c	Mon Dec  1 16:36:26 2008
@@ -27,7 +27,8 @@
 } GceGtkBorder;
 
 static GceGtkBorder *
-gce_gtk_border_new (CRTerm const *values)
+gce_gtk_border_new (ccss_grammar_t const	*grammar,
+		    CRTerm const		*values)
 {
 	GceGtkBorder	*border;
 	gint		*border_widths[4];
@@ -76,14 +77,11 @@
 ccss_property_class_t const _ptable[] = {
     {
 	.name = "gtk-default-border",
-	.property_new = (ccss_property_new_f) gce_gtk_border_new,
-	.property_free = (ccss_property_free_f) g_free,
+	.property_create = (ccss_property_create_f) gce_gtk_border_new,
+	.property_destroy = (ccss_property_destroy_f) g_free,
 	.property_convert = (ccss_property_convert_f) gce_gtk_border_convert
     }, {
-	.name = NULL,
-	.property_new = NULL,
-	.property_free = NULL,
-	.property_convert = NULL
+	.name = NULL
     }
 };
 

Modified: trunk/src/gce-rc-style.c
==============================================================================
--- trunk/src/gce-rc-style.c	(original)
+++ trunk/src/gce-rc-style.c	Mon Dec  1 16:36:26 2008
@@ -19,13 +19,15 @@
 
 #include <gtk/gtk.h>
 #include <string.h>
+#include "gce-functions.h"
+#include "gce-properties.h"
 #include "gce-rc-style.h"
 #include "gce-serialize.h"
 #include "gce-style.h"
 #include "config.h"
 
 static ccss_stylesheet_t	*_stylesheet = NULL;
-gpointer		*_stylesheet_owner = NULL;
+gpointer			*_stylesheet_owner = NULL;
 
 ccss_stylesheet_t const *
 gce_rc_style_get_stylesheet (void)
@@ -59,6 +61,8 @@
 {
 	static GQuark scope_id = 0;
 
+	ccss_grammar_t *grammar;
+
 	char	*gce_file;
 	guint	 old_scope;
 	guint	 token;
@@ -84,18 +88,29 @@
 		gce_file = gtk_rc_find_pixmap_in_path (gtk_settings_get_default (), 
 				scanner, scanner->value.v_string);
 
+		// FIXME: get rid of global stylesheet, assign it to rc-style
+		// and pass on to style.
+		grammar = ccss_cairo_grammar_create ();
+		ccss_grammar_add_properties (grammar, gce_properties_get_ptable ());
+		ccss_grammar_add_functions (grammar, gce_functions_get_vtable ());
+
+		_stylesheet = ccss_grammar_create_stylesheet_from_file (grammar,
+									gce_file);
+		if (_stylesheet) {
+			ccss_grammar_destroy (grammar), grammar = NULL;
+		} else {
+			g_critical ("Could not create stylesheet `%s'", gce_file);
+		}
+		/* ccss_stylesheet_dump (_stylesheet); */
+
 		/* User-agent stylesheet */
-		_stylesheet = ccss_stylesheet_add_from_file (NULL,
-							     GCE_UA_STYLESHEET,
+		_stylesheet = ccss_stylesheet_add_from_file (_stylesheet, GCE_UA_STYLESHEET,
 							     CCSS_STYLESHEET_USER_AGENT);
+
 		if (!_stylesheet) {
 			g_critical ("Could not add user-agent stylesheet `%s'",
 				    GCE_UA_STYLESHEET);
 		}
-/* ccss_stylesheet_dump (_stylesheet); */
-
-		ccss_stylesheet_add_from_file (_stylesheet, gce_file,
-					       CCSS_STYLESHEET_AUTHOR);
 #ifdef GCE_RAPID_DEVELOPMENT
 		G_STMT_START{
 		char *rc_string;
@@ -132,7 +147,7 @@
 	*/
 
 	if (_stylesheet_owner == (gpointer) instance) {
-		ccss_stylesheet_free (_stylesheet);
+		ccss_stylesheet_destroy (_stylesheet);
 	}
 
 	G_OBJECT_CLASS (gce_rc_style_parent_class)->finalize (instance);

Modified: trunk/src/gce-serialize.c
==============================================================================
--- trunk/src/gce-serialize.c	(original)
+++ trunk/src/gce-serialize.c	Mon Dec  1 16:36:26 2008
@@ -159,7 +159,7 @@
 	node.id = NULL;
 	node.pseudo_class = state_name;
 	
-	style = ccss_style_new ();
+	style = ccss_style_create ();
 	ret = ccss_stylesheet_query (stylesheet,
 					  (ccss_node_t const *) &node, style);
 	if (!ret) {
@@ -198,7 +198,7 @@
 				    style_properties);
 	}
 
-	ccss_style_free (style), style = NULL;
+	ccss_style_destroy (style), style = NULL;
 
 	/* Having colors or style properties means there's something to serialise. */
 	return (gboolean) state->flags || 

Modified: trunk/src/gce-style.c
==============================================================================
--- trunk/src/gce-style.c	(original)
+++ trunk/src/gce-style.c	Mon Dec  1 16:36:26 2008
@@ -55,7 +55,7 @@
 	gboolean		 ret;
 
 	stylesheet = gce_rc_style_get_stylesheet ();
-	style = ccss_style_new ();
+	style = ccss_style_create ();
 	ret = ccss_stylesheet_query (stylesheet, (ccss_node_t const *) node, style);
 	if (ret) {
 		cr = gdk_cairo_create (window);
@@ -81,7 +81,7 @@
 
 		cairo_destroy (cr), cr = NULL;
 	}
-	ccss_style_free (style), style = NULL;
+	ccss_style_destroy (style), style = NULL;
 }
 
 static void
@@ -104,7 +104,7 @@
 	gboolean		 ret;
 
 	stylesheet = gce_rc_style_get_stylesheet ();
-	style = ccss_style_new ();
+	style = ccss_style_create ();
 	ret = ccss_stylesheet_query (stylesheet, (ccss_node_t const *) node, style);
 	if (ret) {
 		cr = gdk_cairo_create (window);
@@ -128,7 +128,7 @@
 
 		cairo_destroy (cr), cr = NULL;
 	}
-	ccss_style_free (style), style = NULL;
+	ccss_style_destroy (style), style = NULL;
 }
 
 static void
@@ -148,7 +148,7 @@
 	gboolean		 ret;
 
 	stylesheet = gce_rc_style_get_stylesheet ();
-	style = ccss_style_new ();
+	style = ccss_style_create ();
 	ret = ccss_stylesheet_query (stylesheet, (ccss_node_t const *) node, style);
 	if (ret) {
 		cr = gdk_cairo_create (window);
@@ -162,7 +162,7 @@
 
 		cairo_destroy (cr), cr = NULL;
 	}
-	ccss_style_free (style), style = NULL;
+	ccss_style_destroy (style), style = NULL;
 }
 
 static void 

Modified: trunk/src/gce-theme.c
==============================================================================
--- trunk/src/gce-theme.c	(original)
+++ trunk/src/gce-theme.c	Mon Dec  1 16:36:26 2008
@@ -20,9 +20,6 @@
 #include <ccss-cairo/ccss-cairo.h>
 #include <gmodule.h>
 #include <gtk/gtk.h>
-#include "gce-functions.h"
-#include "gce-node.h"
-#include "gce-properties.h"
 #include "gce-style.h"
 #include "gce-rc-style.h"
 #include "config.h"
@@ -36,25 +33,16 @@
 G_MODULE_EXPORT void 
 theme_init (GTypeModule *module)
 {
-	ccss_property_class_t const	*properties;
-	ccss_function_t const		*functions;
-
 	gce_rc_style_register_type (module);
 	gce_style_register_type (module);
 
 	ccss_cairo_init ();
-
-	properties = gce_properties_get_ptable ();
-	ccss_add_properties (properties);
-
-	functions = gce_functions_get_vtable ();
-	ccss_add_functions (functions);
 }
 
 G_MODULE_EXPORT void 
 theme_exit (void)
 {
-	ccss_shutdown ();
+	ccss_cairo_shutdown ();
 }
 
 G_MODULE_EXPORT GtkRcStyle*

Modified: trunk/themes/Thorwil/gtk-2.0/theme.svg
==============================================================================
--- trunk/themes/Thorwil/gtk-2.0/theme.svg	(original)
+++ trunk/themes/Thorwil/gtk-2.0/theme.svg	Mon Dec  1 16:36:26 2008
@@ -14,7 +14,7 @@
    id="svg2"
    sodipodi:version="0.32"
    inkscape:version="0.46"
-   sodipodi:docname="example-5.svg"
+   sodipodi:docname="theme.svg"
    inkscape:output_extension="org.inkscape.output.svg.inkscape"
    version="1.0"
    inkscape:export-filename="/media/sdb8/software_artwork/kyudo/widgets/button_set.png"
@@ -863,15 +863,15 @@
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
      inkscape:zoom="2"
-     inkscape:cx="84.734568"
-     inkscape:cy="141.16666"
+     inkscape:cx="14.984568"
+     inkscape:cy="121.16666"
      inkscape:document-units="px"
-     inkscape:current-layer="layer1"
+     inkscape:current-layer="layer3"
      showgrid="false"
      inkscape:window-width="1102"
      inkscape:window-height="847"
-     inkscape:window-x="22"
-     inkscape:window-y="62"
+     inkscape:window-x="373"
+     inkscape:window-y="92"
      inkscape:snap-bbox="true"
      inkscape:snap-nodes="false"
      showborder="false"
@@ -899,7 +899,7 @@
      inkscape:groupmode="layer"
      id="layer3"
      inkscape:label="background"
-     style="display:inline"
+     style="display:none"
      transform="translate(-70,-136.36218)"
      sodipodi:insensitive="true">
     <rect



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