Common gotchas upgrading from 4.0 -> 4.2

Brian J. Tarricone bjt23 at cornell.edu
Wed Nov 3 21:31:14 CET 2004


On 11/03/04 12:19, Brian J. Tarricone wrote:
> On 11/03/04 21:32, Jasper Huijsmans wrote:
> > Brian J. Tarricone wrote:
> > ...
> > >
> > >1) include a small .svg icon with libxfcegui4 that gets installed in a 
> > >known
> > >location, and try to open it on XfceIconTheme's class_init().  if it fails,
> > >we don't have SVG support.
> > >
> > 
> > Very cunning. I considered validating icons, but rejected it because of 
> > obvious performance issues. I like this. Should be 100% accurate, 
> > shouldn't it?
> 
> yeah.  i just coded up a patch for it, actually.  compiling and testing
> now...

and here's the patch.  apply in xfce4/lbixfcegui4 with -p0.  i just yanked
xfce-unknown.svg from rodent; presumably someone will make a tiny SVG
icon that takes up little space and loads quicker.

it's compile tested, and i killed xfdesktop remotely and started it in my
ssh session, and it printed that SVG was enabled (i'm on my win2k box at
work).  beyond that, i don't know.  if it correctly detects no SVG support
and disables it, and we're still missing icons, then those are XfceIconTheme
bugs i need to fix.

	-brian
-------------- next part --------------
Index: Makefile.am
===================================================================
RCS file: /var/cvs/xfce/xfce4/libxfcegui4/Makefile.am,v
retrieving revision 1.16
diff -u -r1.16 Makefile.am
--- Makefile.am	19 Sep 2004 15:21:25 -0000	1.16
+++ Makefile.am	3 Nov 2004 20:39:41 -0000
@@ -1,4 +1,4 @@
-SUBDIRS = libxfcegui4 xfce4-modules docs po
+SUBDIRS = libxfcegui4 xfce4-modules docs po pixmaps
 
 EXTRA_DIST = libxfcegui4.spec index.theme
 
Index: configure.ac
===================================================================
RCS file: /var/cvs/xfce/xfce4/libxfcegui4/configure.ac,v
retrieving revision 1.90
diff -u -r1.90 configure.ac
--- configure.ac	2 Nov 2004 13:34:08 -0000	1.90
+++ configure.ac	3 Nov 2004 20:39:41 -0000
@@ -119,6 +119,7 @@
 libxfcegui4/libxfcegui4-1.0.pc
 libxfcegui4/libxfcegui4-config.h
 libxfcegui4/Makefile
+pixmaps/Makefile
 xfce4-modules/Makefile
 xfce4-modules/mime/Makefile
 xfce4-modules/headers/Makefile
Index: libxfcegui4/xfce-icontheme.c
===================================================================
RCS file: /var/cvs/xfce/xfce4/libxfcegui4/libxfcegui4/xfce-icontheme.c,v
retrieving revision 1.27
diff -u -r1.27 xfce-icontheme.c
--- libxfcegui4/xfce-icontheme.c	26 Oct 2004 06:56:34 -0000	1.27
+++ libxfcegui4/xfce-icontheme.c	3 Nov 2004 20:39:42 -0000
@@ -376,10 +376,8 @@
 xfce_icon_theme_class_init(XfceIconThemeClass *klass)
 {
 	GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
-	GSList *pix_formats, *l;
-	gchar **pix_mimetypes;
-	gint i;
-	
+	GdkPixbuf *svg_test;
+		
 	parent_class = g_type_class_peek_parent(klass);
 	
 	gobject_class->finalize = xfce_icon_theme_finalize;
@@ -409,23 +407,16 @@
 	}
 	
 	/* check SVG format support */
-	pix_formats = gdk_pixbuf_get_formats();
-	for(l = pix_formats; l; l = l->next) {
-		GdkPixbufFormat *fmt = l->data;
-		pix_mimetypes = gdk_pixbuf_format_get_mime_types(fmt);
-		for(i = 0; pix_mimetypes[i]; i++) {
-			if(!g_ascii_strcasecmp(pix_mimetypes[i], "image/svg")) {
-				supported_icon_ext = (gchar **)icon_ext_with_svg;
-				break;
-			}
-		}
-		g_strfreev(pix_mimetypes);
-	}
-	if(pix_formats)
-		g_slist_free(pix_formats);
-	
-	if(!supported_icon_ext)
+	svg_test = gdk_pixbuf_new_from_file(DATADIR "/xfce4/xfce-svg-test.svg",
+			NULL);
+	if(svg_test) {
+		supported_icon_ext = (gchar **)icon_ext_with_svg;
+		g_object_unref(G_OBJECT(svg_test));
+		DBG("SVG support enabled!");
+	} else {
 		supported_icon_ext = (gchar **)icon_ext;
+		DBG("SVG support disabled!");
+	}
 }
 
 static void

--- /dev/null	2004-10-29 20:48:48.694355048 -0700
+++ pixmaps/Makefile.am	2004-11-03 12:27:12.000000000 -0800
@@ -0,0 +1,4 @@
+pixmapsdir = $(datadir)/xfce4
+pixmaps_DATA = xfce-svg-test.svg
+
+EXTRA_DIST = $(pixmaps_DATA)

--- /dev/null	2004-10-29 20:48:48.694355048 -0700
+++ pixmaps/xfce-svg-test.svg	2004-11-03 12:25:31.000000000 -0800
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<!-- Created with Sodipodi ("http://www.sodipodi.com/") -->
+<svg
+   id="svg559"
+   sodipodi:version="0.32"
+   width="128pt"
+   height="128pt"
+   sodipodi:docbase="/home/francois/waiting/new_theme/New_clock/panel_theme/Clockwork/scalable/emblems"
+   sodipodi:docname="unknown.svg"
+   inkscape:version="0.38.1"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:xlink="http://www.w3.org/1999/xlink">
+  <defs
+     id="defs561" />
+  <sodipodi:namedview
+     id="base"
+     inkscape:zoom="3.0781250"
+     inkscape:cx="64.000000"
+     inkscape:cy="64.000000"
+     inkscape:window-width="829"
+     inkscape:window-height="906"
+     inkscape:window-x="160"
+     inkscape:window-y="34" />
+  <polygon
+     sodipodi:type="star"
+     style="font-size:12.000;fill:#000000;fill-rule:evenodd;stroke-width:6.1078947;fill-opacity:0.46357617;stroke:#000000;stroke-opacity:1.0000;stroke-dasharray:none;"
+     id="polygon563"
+     sodipodi:sides="5"
+     sodipodi:cx="74.3935318"
+     sodipodi:cy="71.1590271"
+     sodipodi:r1="79.9659958"
+     sodipodi:r2="39.9829979"
+     sodipodi:arg1="0.94239664"
+     sodipodi:arg2="1.57071519"
+     points="121.4016,135.8491 74.39677,111.1420 27.39595,135.8567 36.36844,83.51754 -1.660655,46.45435 50.88949,38.81401 74.38704,-8.806969 97.89233,38.81020 150.4437,46.44201 112.4206,83.51137 121.4016,135.8491 "
+     transform="matrix(0.873869,0.000000,0.000000,0.920009,15.42082,15.21986)" />
+  <polygon
+     sodipodi:type="star"
+     style="font-size:12.000;fill:#ffffff;fill-rule:evenodd;stroke-width:6.1078947;fill-opacity:0.39680001;stroke:#000000;stroke-opacity:1.0000;stroke-dasharray:none;"
+     id="polygon564"
+     sodipodi:sides="5"
+     sodipodi:cx="74.3935318"
+     sodipodi:cy="71.1590271"
+     sodipodi:r1="79.9659958"
+     sodipodi:r2="39.9829979"
+     sodipodi:arg1="0.94239664"
+     sodipodi:arg2="1.57071519"
+     points="121.4016,135.8491 74.39677,111.1420 27.39595,135.8567 36.36844,83.51754 -1.660655,46.45435 50.88949,38.81401 74.38704,-8.806969 97.89233,38.81020 150.4437,46.44201 112.4206,83.51137 121.4016,135.8491 "
+     transform="matrix(-0.873869,1.125368e-16,-1.071366e-16,-0.920009,145.4378,144.0992)" />
+</svg>


More information about the Xfce4-dev mailing list