gtk-css-engine r113 - in trunk: . libccd/ccd libccd/doc src themes/gtk-css-test/gtk-2.0



Author: robsta
Date: Tue Sep 16 16:46:51 2008
New Revision: 113
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=113&view=rev

Log:
* configure.in:
* libccd/ccd/ccd-features.h.in:
* libccd/ccd/ccd-function.c:
* libccd/ccd/ccd-image.c:
* libccd/doc/ccd-docs.sgml:
* src/gce-functions.c:
Optionally depend on libsoup for URI parsing towards SVG sub-image support.
* src/gce-node.c:
* src/gce-style.c:
Fix typos in debug output.


Modified:
   trunk/   (props changed)
   trunk/ChangeLog
   trunk/configure.in
   trunk/libccd/ccd/ccd-features.h.in
   trunk/libccd/ccd/ccd-function.c
   trunk/libccd/ccd/ccd-image.c
   trunk/libccd/doc/ccd-docs.sgml
   trunk/src/gce-functions.c
   trunk/src/gce-node.c
   trunk/src/gce-style.c
   trunk/themes/gtk-css-test/gtk-2.0/styles.css

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Tue Sep 16 16:46:51 2008
@@ -113,13 +113,33 @@
 
 # Guessing a version.
 rsvg_req='librsvg-2.0 >= 2.16'
-with_rsvg="no"
 PKG_CHECK_EXISTS([ $rsvg_req ],
 [
   with_rsvg="yes"
   pkgs="$pkgs $rsvg_req"
+],[
+  with_rsvg="no"
 ])
 
+if test "$with_rsvg" = "yes"; then
+  AC_DEFINE([CCD_WITH_RSVG], [1], [SVG support through librsvg])
+fi
+AM_CONDITIONAL([CCD_WITH_RSVG], [test "$with_rsvg" = "yes"])
+
+soup_req='libsoup-2.4'
+PKG_CHECK_EXISTS([ $soup_req ],
+[
+  with_soup="yes"
+  pkgs="$pkgs $soup_req"
+],[
+  with_soup="no"
+])
+
+if test "$with_soup" = "yes"; then
+  AC_DEFINE([CCD_WITH_SOUP], [1], [URI parsing support through libsoup])
+fi
+AM_CONDITIONAL([CCD_WITH_SOUP], [test "$with_soup" = "yes"])
+
 PKG_CHECK_MODULES(CCD, $pkgs)
 
 AC_SUBST([CCD_CFLAGS])
@@ -129,10 +149,6 @@
 AC_DEFINE([CCD_WITH_GTK], [1], [Support for drawing Gtk+ primitives like `box-gap'])
 AM_CONDITIONAL([CCD_WITH_GTK], [test "yes" = "yes"])
 
-if test "$with_rsvg" = "yes"; then
-  AC_DEFINE([CCD_WITH_RSVG], [1], [SVG support through the `rsvg' library])
-fi
-AM_CONDITIONAL([CCD_WITH_RSVG], [test "$with_rsvg" = "yes"])
 
 AC_SUBST([GCE_CFLAGS], [$CCD_CFLAGS])
 AC_SUBST([GCE_LIBS], [$CCD_LIBS])
@@ -190,9 +206,10 @@
 
 echo "
 Configuration
-    CFLAGS                  ${CFLAGS}
-    Build debugging code    $enable_debug
-    Standalone libccd       $enable_libccd
-    Support for SVG images  $with_rsvg
+    CFLAGS                         ${CFLAGS}
+    Build debugging code           $enable_debug
+    Standalone libccd              $enable_libccd
+    Support for SVG images         $with_rsvg
+    Support for SVG image parts    $with_soup (requires libsoup)
 "
 

Modified: trunk/libccd/ccd/ccd-features.h.in
==============================================================================
--- trunk/libccd/ccd/ccd-features.h.in	(original)
+++ trunk/libccd/ccd/ccd-features.h.in	Tue Sep 16 16:46:51 2008
@@ -26,8 +26,11 @@
 /* Support for drawing Gtk+ primitives like `box-gap' */
 #undef CCD_WITH_GTK
 
-/* SVG support through the `rsvg' library */
+/* SVG support through librsvg */
 #undef CCD_WITH_RSVG
 
+/* URI parsing support through libsoup */
+#undef CCD_WITH_SOUP
+
 #endif /* CCD_FEATURES_H */
 

Modified: trunk/libccd/ccd/ccd-function.c
==============================================================================
--- trunk/libccd/ccd/ccd-function.c	(original)
+++ trunk/libccd/ccd/ccd-function.c	Tue Sep 16 16:46:51 2008
@@ -64,6 +64,7 @@
 	for (unsigned int i = 0; _vtable[i].name; i++) {
 		if (0 == strcmp (name, _vtable[i].name)) {
 			function = _vtable[i].function;
+			break;
 		}
 	}
 

Modified: trunk/libccd/ccd/ccd-image.c
==============================================================================
--- trunk/libccd/ccd/ccd-image.c	(original)
+++ trunk/libccd/ccd/ccd-image.c	Tue Sep 16 16:46:51 2008
@@ -22,6 +22,10 @@
 #include "ccd-function.h"
 #include "ccd-image.h"
 
+#ifdef CCD_WITH_SOUP
+#include <libsoup/soup.h>
+#endif
+
 #if CCD_WITH_RSVG
 #include <librsvg/rsvg.h>
 #include <librsvg/rsvg-cairo.h>
@@ -41,31 +45,6 @@
 	}
 }
 
-static char *
-parse_uri (char const	 *uri,
-	   char		**id)
-{	
-	char const	*suffix;
-	char const	*hash;
-	char		*basename;
-
-	g_return_val_if_fail (uri, NULL);
-
-	suffix = strrchr (uri, '.');
-	hash = strrchr (uri, '#');
-
-	basename = NULL;
-	if (suffix && hash && hash > suffix && hash[1] != '\0') {
-		basename = g_strndup (uri, hash - uri);
-		*id = g_strdup (hash + 1);
-	} else {
-		basename = g_strdup (uri);
-		*id = NULL;
-	}
-
-	return basename;
-}
-
 #if CCD_WITH_RSVG
 
 static bool
@@ -115,29 +94,38 @@
 static bool
 load_image (ccd_image_t *self)
 {
-	char	*basename;
-	char	*id;
-	bool	 matched;
+	bool		 matched;
+	char const	*path;
+	char const	*fragment;
+#if CCD_WITH_SOUP
+	SoupURI		*uri;
 
-	basename = parse_uri (self->uri, &id);
-	g_return_val_if_fail (basename, NULL);
+	uri = soup_uri_new (self->uri);
+	g_return_val_if_fail (uri, NULL);
+	path = uri->path;
+	fragment = uri->fragment;
+#else
+	path = self->uri;
+	fragment = NULL;
+#endif
 
 	matched = false;
 #if CCD_WITH_RSVG
 	if (!matched &&
-	    g_str_has_suffix (basename, ".svg")) {
+	    g_str_has_suffix (path, ".svg")) {
 		matched = true;
-		load_svg (self, basename, id);
+		load_svg (self, path, fragment);
 	}
 #endif
 
 	if (!matched) {
-		self->surface = cairo_image_surface_create_from_png (basename);
+		self->surface = cairo_image_surface_create_from_png (path);
 
 	}
 
-	g_free (basename);
-	g_free (id);
+#if CCD_WITH_SOUP
+	soup_uri_free (uri), uri = NULL;
+#endif
 
 	return (bool) self->surface;
 }

Modified: trunk/libccd/doc/ccd-docs.sgml
==============================================================================
--- trunk/libccd/doc/ccd-docs.sgml	(original)
+++ trunk/libccd/doc/ccd-docs.sgml	Tue Sep 16 16:46:51 2008
@@ -53,6 +53,13 @@
 </varlistentry>
 
 <varlistentry>
+<term><link linkend="libsoup" title="LibSoup">LibSoup (optional)</link></term>
+<listitem><para>
+LibSoup is an HTTP client/server library for GNOME. It uses GObjects and the glib main loop, to integrate well with GNOME applications. 
+</para></listitem>
+</varlistentry>
+
+<varlistentry>
 <term><link linkend="gtk+" title="Gtk+">Gtk+ (optional)</link></term>
 <listitem><para>
 GTK+ is a highly usable, feature rich toolkit for creating graphical user interfaces which boasts cross platform compatibility and an easy to use API. GTK+ it is written in C, but has bindings to many other popular programming languages such as C++, Python and C# among others. GTK+ is licensed under the GNU LGPL 2.1 allowing development of both free and proprietary software with GTK+ without any license fees or royalties.

Modified: trunk/src/gce-functions.c
==============================================================================
--- trunk/src/gce-functions.c	(original)
+++ trunk/src/gce-functions.c	Tue Sep 16 16:46:51 2008
@@ -17,17 +17,48 @@
  * MA 02110-1301, USA.
  */
 
+#include <ccd/ccd.h>
+
+/* Need the ccd include above for the feature defs. */
+#ifdef CCD_WITH_SOUP
+#include <libsoup/soup.h>
+#endif
+
 #include "gce-functions.h"
 
+/*
+ * TODO make this bullet proof wrt uri scheme.
+ */
 static char *
 url (GSList const *args)
 {
-	char const *uri;
+	char		*given_path;
+	char		*resolved_path;
+	char		*ret;
+#ifdef CCD_WITH_SOUP
+	SoupURI		*uri;
 
 	g_return_val_if_fail (args, NULL);
 
-	uri = (char const *) args->data;
-	return gtk_rc_find_pixmap_in_path (gtk_settings_get_default (), NULL, uri);
+	given_path = g_strdup_printf ("file:///%s", (char const *) args->data);
+	uri = soup_uri_new (given_path);
+	g_free (given_path), given_path = NULL;
+
+	resolved_path = gtk_rc_find_pixmap_in_path (gtk_settings_get_default (), NULL, uri->path);
+	soup_uri_set_path (uri, resolved_path);
+	g_free (resolved_path), resolved_path = NULL;
+
+	ret = soup_uri_to_string (uri, FALSE);
+	soup_uri_free (uri), uri = NULL;
+#else
+	g_return_val_if_fail (args, NULL);
+
+	given_path = (char const *) args->data;
+	resolved_path = gtk_rc_find_pixmap_in_path (gtk_settings_get_default (), NULL, given_path);
+	ret = resolved_path;
+#endif
+
+	return ret;
 }
 
 static ccd_function_t const _functions[] = 

Modified: trunk/src/gce-node.c
==============================================================================
--- trunk/src/gce-node.c	(original)
+++ trunk/src/gce-node.c	Tue Sep 16 16:46:51 2008
@@ -428,6 +428,6 @@
 char const *
 gce_node_get_primitive (const GceNode *node)
 {
-	node->class_name;
+	return node->impl.primitive;
 }
 

Modified: trunk/src/gce-style.c
==============================================================================
--- trunk/src/gce-style.c	(original)
+++ trunk/src/gce-style.c	Tue Sep 16 16:46:51 2008
@@ -56,7 +56,7 @@
 
 	if (!status) {
 		g_warning ("Un-themed widget `%s', primitive `%s'.", 
-			   G_OBJECT_TYPE_NAME (G_OBJECT (gce_node_get_widget (node))), gce_node_get_primitive (node));
+			   G_OBJECT_TYPE_NAME (G_OBJECT (gce_node_get_widget (node))), gce_node_get_primitive (base));
 		ccd_selector_group_free (group);
 		group = NULL;
 	}

Modified: trunk/themes/gtk-css-test/gtk-2.0/styles.css
==============================================================================
--- trunk/themes/gtk-css-test/gtk-2.0/styles.css	(original)
+++ trunk/themes/gtk-css-test/gtk-2.0/styles.css	Tue Sep 16 16:46:51 2008
@@ -103,6 +103,10 @@
 }
 */
 
+check {
+	background-image: url(nordic.svg#CheckMarkOn.Shape);
+}
+
 extension {
 	background: khaki;
 	border: 1px solid black;



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