Index: libgthumb/file-utils.h
===================================================================
--- libgthumb/file-utils.h	(revision 2391)
+++ libgthumb/file-utils.h	(working copy)
@@ -135,8 +135,7 @@
 gboolean            local_file_move               (const char       *from,
 						   const char       *to);
 gboolean            file_rename                   (const char       *old_path,
-						   const char       *new_path,
-						   GError          **error);
+						   const char       *new_path);
 gboolean            file_unlink                   (const char       *path);
 void		    delete_thumbnail	          (const char       *path);
 gboolean            mime_type_is                  (const char       *mime_type,
Index: libgthumb/gfile-utils.c
===================================================================
--- libgthumb/gfile-utils.c	(revision 2391)
+++ libgthumb/gfile-utils.c	(working copy)
@@ -22,6 +22,7 @@
 
 
 #include <stdlib.h>
+#include <string.h>
 #include <glib.h>
 
 #include "gfile-utils.h"
@@ -56,7 +57,31 @@
 }
 
 
-/* warning about a GFile */
+/* Debug */
+
+void 
+gfile_debug (const char *cfile,
+	     int         line,
+	     const char *function,
+	     const char *msg,
+	     GFile      *file)
+{
+	char *uri;
+	char *dbg;
+	
+	if (file == NULL)
+		uri = g_strdup ("(null)");
+	else
+		uri = gfile_get_uri (file);
+	
+	dbg = g_strdup_printf ("%s: %s\n", msg, uri);
+	
+	debug (cfile, line, function, dbg);
+	
+        g_free (uri);
+        g_free (dbg);
+}
+
 
 void 
 gfile_warning (const char *msg,
@@ -67,7 +92,11 @@
 	char *warning;
 	
 	uri = gfile_get_uri (file);
-	warning = g_strdup_printf ("%s: file %s: %s\n", msg, uri, err->message);
+	
+	if (err == NULL)
+		warning = g_strdup_printf ("%s: file %s\n", msg, uri);
+	else
+		warning = g_strdup_printf ("%s: file %s: %s\n", msg, uri, err->message);
 	
 	g_warning (warning);
 	
@@ -72,6 +101,60 @@
 	g_warning (warning);
 	
         g_free (uri);
+        g_free (warning);
+}
+
+
+/* Constructor enforcing the "uri only" GFile policy */
+
+GFile *
+gfile_new (const char *path)
+{
+	GFile *file;
+	char  *uri;
+	
+	g_assert (path != NULL);
+	
+	if (strstr (path, "://") == NULL)
+		uri = g_strconcat ("file://", path, NULL);
+	else
+		uri = g_strdup (path);
+
+	file = g_file_new_for_uri (uri);
+	
+	g_free (uri);
+	
+	return file;
+}
+
+
+GFile *
+gfile_new_va (const char *path,
+              ...)
+{
+	va_list  args;
+	GFile   *file;
+	char    *pathx;
+	
+	g_assert (path != NULL);
+	
+	file = gfile_new (path);
+	
+	va_start (args, path);
+	
+	while ((pathx = va_arg (args, char*)) != NULL) {
+		GFile *tmp;
+		
+		tmp = g_file_dup (file);
+		g_object_unref (file);
+		
+		file = g_file_resolve_relative_path (tmp, pathx);
+		g_object_unref (tmp);
+	}
+	
+	va_end (args);
+
+	return file;
 }
 
 
@@ -77,6 +160,45 @@
 
 /* File utils */
 
+GFile *
+gfile_append_path (GFile      *dir,
+		   const char *path,
+                   ...)
+{
+	va_list  args;
+	GFile   *file;
+	char    *pathx;
+	
+	if (path == NULL)
+		return g_file_dup (dir);
+	
+	file = g_file_resolve_relative_path (dir, path);
+	
+	va_start (args, path);
+	
+	while ((pathx = va_arg (args, char*)) != NULL) {
+		GFile *tmp;
+		
+		tmp = g_file_dup (file);
+		g_object_unref (file);
+
+		file = g_file_resolve_relative_path (tmp, pathx);
+		g_object_unref (tmp);
+	}
+	
+	va_end (args);
+
+	return file;
+}
+
+
+gboolean
+gfile_is_local (GFile *file)
+{
+	return g_file_has_uri_scheme (file, "file");
+}
+
+
 static gboolean
 gfile_is_filetype (GFile      *file,
 		   GFileType   file_type)
@@ -210,13 +332,6 @@
 }
 
 
-gboolean
-gfile_is_local (GFile *file)
-{
-	return g_file_has_uri_scheme (file, "file");
-}
-
-
 guint64
 gfile_get_destination_free_space (GFile *file)
 {
@@ -248,12 +363,8 @@
 gfile_get_home_dir (void)
 {
 	GFile *dir;
-	char  *path;
-	
-	path = g_strconcat ("file://", g_get_home_dir (), NULL);
-	dir = g_file_new_for_uri (path);
 	
-	g_free (path);
+	dir = gfile_new (g_get_home_dir ());
 	
 	return dir;
 }
@@ -263,12 +374,8 @@
 gfile_get_tmp_dir (void)
 {
 	GFile *dir;
-	char  *path;
-	
-	path = g_strconcat ("file://", g_get_tmp_dir (), NULL);
-	dir = g_file_new_for_uri (path);
 	
-	g_free (path);
+	dir = gfile_new (g_get_tmp_dir ());
 	
 	return dir;
 }
@@ -295,7 +402,6 @@
 {
 	char  *path0;
 	char  *path1;
-	char  *path2;
 	char  *template;
 	GFile *dir;
 	
@@ -308,11 +414,9 @@
 	if (path1 == NULL)
 		return NULL;
 	
-	path2 = g_strconcat ("file://", path1, NULL);
-	dir = g_file_new_for_uri (path2);
+	dir = gfile_new (path1);
 	
 	g_free (path1);
-	g_free (path2);
 	
 	return dir;
 }
@@ -418,3 +522,63 @@
 
 	return result;
 }
+
+
+/* Xfer */
+
+
+/* empty functions */
+static void _empty_file_progress_cb  (goffset current_num_bytes,
+				      goffset total_num_bytes,
+				      gpointer user_data)
+{
+}
+
+gboolean
+gfile_xfer (GFile    *sfile,
+	    GFile    *dfile,
+	    gboolean  move)
+{
+	GError *error = NULL;
+
+	if (g_file_equal (sfile, dfile)) {
+		gfile_warning ("cannot copy file: source and destination are the same", 
+			       sfile, 
+			       NULL);
+		return FALSE;
+	}
+
+	if (move)
+		g_file_move (sfile, dfile,
+			     G_FILE_COPY_OVERWRITE,
+			     NULL, _empty_file_progress_cb,
+			     NULL, &error);
+	else
+		g_file_copy (sfile, dfile,
+			     G_FILE_COPY_OVERWRITE,
+			     NULL, _empty_file_progress_cb,
+			     NULL, &error);
+	
+	if (error != NULL) {
+		gfile_warning ("error during file copy", sfile, error);
+		g_error_free (error);
+		return FALSE;
+	}
+	
+	return TRUE;
+}
+
+
+gboolean
+gfile_copy (GFile *sfile,
+	    GFile *dfile)
+{
+	return gfile_xfer (sfile, dfile, FALSE);
+}
+
+gboolean
+gfile_move (GFile *sfile,
+	    GFile *dfile)
+{
+	return gfile_xfer (sfile, dfile, TRUE);
+}
Index: libgthumb/gfile-utils.h
===================================================================
--- libgthumb/gfile-utils.h	(revision 2391)
+++ libgthumb/gfile-utils.h	(working copy)
@@ -24,6 +24,7 @@
 #define GFILE_UTILS_H
 
 #include <gio/gio.h>
+#include "glib-utils.h"
 
 
 #define UNREF(obj) {				\
@@ -42,13 +43,29 @@
 char *        gfile_get_uri                    (GFile *file);
 char *        gfile_get_path                   (GFile *file);
 
-/* Warning */
+/* Debug */
 
+void          gfile_debug                      (const char *cfile,
+					        int         line,
+						const char *function,
+						const char *msg,
+	                                        GFile      *file);
 void          gfile_warning                    (const char *msg,
 	                                        GFile      *file,
 	                                        GError     *err);
+/* Constructors */
+
+GFile *       gfile_new                        (const char *path);
+GFile *       gfile_new_va                     (const char *path,
+                                                ...);
+
 /* File utils */
 
+GFile *       gfile_append_path                (GFile      *dir,
+		                                const char *path,
+                                                ...);
+
+gboolean      gfile_is_local                   (GFile      *file);
 gboolean      gfile_path_is_file               (GFile      *file);
 gboolean      gfile_path_is_dir                (GFile      *file);
 goffset       gfile_get_file_size              (GFile      *file);
@@ -59,7 +76,19 @@
 			                        mode_t      mode,
 			                        GError    **error);
 guint64       gfile_get_destination_free_space (GFile      *file);
+GFile *       gfile_get_home_dir               (void);
+GFile *       gfile_get_tmp_dir                (void);
 GFile *       gfile_get_temp_dir_name          (void);
-gboolean      gfile_dir_remove_recursive       (GFile *dir);
+gboolean      gfile_dir_remove_recursive       (GFile      *dir);
+
+/* Xfer */
+
+gboolean      gfile_xfer                       (GFile      *sfile,
+		                                GFile      *dfile,
+		                                gboolean    move);
+gboolean      gfile_copy                       (GFile      *sfile,
+		                                GFile      *dfile);
+gboolean      gfile_move                       (GFile      *sfile,
+		                                GFile      *dfile);
 
 #endif /* GFILE_UTILS_H */
Index: libgthumb/file-utils.c
===================================================================
--- libgthumb/file-utils.c	(revision 2391)
+++ libgthumb/file-utils.c	(working copy)
@@ -68,12 +68,6 @@
 #define CHUNK_SIZE 128
 #define MAX_SYMLINKS_FOLLOWED 32
 
-/* empty functions */
-static void _empty_file_progress_cb  (goffset current_num_bytes,
-				      goffset total_num_bytes,
-				      gpointer user_data)
-{
-}
 
 /* Async directory list */
 
@@ -422,7 +416,6 @@
 {
 	GFile    *file;
 	gboolean  result;
-	char     *uri;
 	
 	if (path == NULL)
 		return FALSE;
@@ -427,12 +420,10 @@
 	if (path == NULL)
 		return FALSE;
 	
-	uri = add_scheme_if_absent (path);
-	file = g_file_new_for_uri (uri);
+	file = gfile_new (path);
 	
 	result = gfile_dir_remove_recursive (file);
 	
-	g_free (uri);
 	g_object_unref (file);
 
 	return result;
@@ -452,7 +443,6 @@
 {
 	GFile    *file;
 	gboolean  result;
-	char     *uri;
 	
 	if (path == NULL)
 		return FALSE;
@@ -457,12 +447,10 @@
 	if (path == NULL)
 		return FALSE;
 	
-	uri = add_scheme_if_absent (path);
-	file = g_file_new_for_uri (uri);
+	file = gfile_new (path);
 	
 	result = gfile_ensure_dir_exists (file, mode, NULL);
 	
-	g_free (uri);
 	g_object_unref (file);
 
 	return result;
@@ -743,41 +731,19 @@
 	   const char *to,
 	   gboolean    move)
 {
-	GnomeVFSURI   *from_uri, *to_uri;
-	GError        *ioerror = NULL;
-	GFile         *sfile, *dfile;
+	GFile      *sfile;
+	GFile      *dfile;
+	gboolean    result;
 
-	if (same_uri (from, to)) {
-		g_warning ("cannot copy file %s: source and destination are the same\n", from);
-		return FALSE;
-	}
-
-	from_uri = new_uri_from_path (from);
-	to_uri = new_uri_from_path (to);
-
-	sfile = g_file_new_for_uri (gnome_vfs_uri_get_path (from_uri));
-	dfile = g_file_new_for_uri (gnome_vfs_uri_get_path (to_uri));
-	if (move)
-		g_file_move (sfile, dfile,
-			     G_FILE_COPY_OVERWRITE,
-			     NULL, _empty_file_progress_cb,
-			     NULL, &ioerror);
-	else
-		g_file_copy (sfile, dfile,
-			     G_FILE_COPY_OVERWRITE,
-			     NULL, _empty_file_progress_cb,
-			     NULL, &ioerror);
+	sfile = gfile_new (from);
+	dfile = gfile_new (to);
+	
+	result = gfile_xfer (sfile, dfile, move);
 
 	g_object_unref (sfile);
 	g_object_unref (dfile);
-	g_free (from_uri);
-	g_free (to_uri);
 	
-	if (ioerror) {
-		g_error_free (ioerror);
-		return FALSE;
-	} else
-		return TRUE;
+	return result;
 }
 
 
@@ -801,44 +767,14 @@
 local_file_move (const char *from,
 	         const char *to)
 {
-	char     *from_uri;
-	char     *to_uri;
-	gboolean  result;
-	
-	from_uri = get_uri_from_local_path (from);
-	to_uri = get_uri_from_local_path (to);
-	
-	result = xfer_file (from_uri, to_uri, TRUE);
-	
-	g_free (from_uri);
-	g_free (to_uri);
-	
-	return result;
+	return xfer_file (from, to, TRUE);
 }
 
-
-gboolean 
-file_rename (const char *old_path,
-	     const char *new_path,
-	     GError **error)
+gboolean
+file_rename (const char *from,
+	     const char *to)
 {
-	GFile *sfile, *dfile;
-	GError *err = NULL;
-	gboolean result;
-	sfile = g_file_new_for_uri (old_path);
-	dfile = g_file_new_for_uri (new_path);
-
-	result = g_file_move (sfile, dfile,
-                              G_FILE_COPY_OVERWRITE,
-                              NULL,
-			      _empty_file_progress_cb,
-			      NULL, &err);
-	if (err)
-		g_propagate_error (error, err);
-	
-	g_object_unref (sfile);
-	g_object_unref (dfile);
-	return result;
+	return xfer_file (from, to, TRUE);
 }
 
 
@@ -1049,7 +985,6 @@
 {
 	GFile    *file;
 	gboolean  result;
-	char     *uri;
 	
 	if (path == NULL)
 		return FALSE;
@@ -1054,12 +989,10 @@
 	if (path == NULL)
 		return FALSE;
 	
-	uri = add_scheme_if_absent (path);
-	file = g_file_new_for_uri (uri);
+	file = gfile_new (path);
 	
 	result = gfile_path_is_file (file);
 	
-	g_free (uri);
 	g_object_unref (file);
 
 	return result;
@@ -1070,7 +1003,6 @@
 {
 	GFile    *file;
 	gboolean  result;
-	char     *uri;
 	
 	if (path == NULL)
 		return FALSE;
@@ -1075,12 +1007,10 @@
 	if (path == NULL)
 		return FALSE;
 
-	uri = add_scheme_if_absent (path);
-	file = g_file_new_for_uri (uri);
+	file = gfile_new (path);
 
 	result = gfile_path_is_dir (file);
 	
-	g_free (uri);
 	g_object_unref (file);
 
 	return result;
@@ -1092,7 +1022,6 @@
 {
 	GFile    *file;
 	goffset   result;
-	char     *uri;
 	
 	if (path == NULL)
 		return 0;
@@ -1097,12 +1026,10 @@
 	if (path == NULL)
 		return 0;
 
-	uri = add_scheme_if_absent (path);
-	file = g_file_new_for_uri (uri);
+	file = gfile_new (path);
 
 	result = gfile_get_file_size (file);
 	
-	g_free (uri);
 	g_object_unref (file);
 
 	return result;
@@ -2670,17 +2597,14 @@
 {
 	GFile    *file;
 	gboolean  result;
-	char     *uri;
 	
 	if (path == NULL)
-		return FALSE;
+		return 0;
 	
-	uri = add_scheme_if_absent (path);
-	file = g_file_new_for_uri (uri);
+	file = gfile_new (path);
 
 	result = gfile_get_destination_free_space (file);
 	
-	g_free (uri);
 	g_object_unref (file);
 
 	return result;
Index: src/catalog-web-exporter.h
===================================================================
--- src/catalog-web-exporter.h	(revision 2391)
+++ src/catalog-web-exporter.h	(working copy)
@@ -63,7 +63,7 @@
 
 	char         *header;
 	char         *footer;
-	char         *style;
+	GFile        *style_dir;
 
 	int           page_rows;              /* Number of rows and columns
 	 				       * each page must have. */
Index: src/catalog-web-exporter.c
===================================================================
--- src/catalog-web-exporter.c	(revision 2391)
+++ src/catalog-web-exporter.c	(working copy)
@@ -301,6 +301,43 @@
 }
 
 
+static GFile *
+gfile_get_style_dir (CatalogWebExporter *ce,
+		     const char         *style)
+{
+	GFile *dir;
+	GFile *style_dir;
+
+	if (style == NULL)
+		return NULL;
+	
+	dir = gfile_get_home_dir ();
+	style_dir = gfile_append_path (dir,
+			               ".gnome2",
+			               "gthumb",
+			               "albumthemes",
+			               style,
+			               NULL);
+ 	g_object_unref (dir);
+ 	
+	if (! gfile_path_is_dir (style_dir)) {
+		g_object_unref (style_dir);
+
+		style_dir = gfile_new_va (GTHUMB_DATADIR,
+				          "gthumb",
+				          "albumthemes",
+				          style,
+				          NULL);
+		if (! gfile_path_is_dir (style_dir)) {
+			g_object_unref (style_dir);
+			style_dir = NULL;
+		}
+	}
+
+	return style_dir;
+}
+
+
 static void
 catalog_web_exporter_finalize (GObject *object)
 {
@@ -316,8 +353,7 @@
 	g_free (ce->footer);
 	ce->footer = NULL;
 
-	g_free (ce->style);
-	ce->style = NULL;
+	UNREF (ce->style_dir)
 
 	g_free (ce->base_dir);     /* NOTE: gio port: get rid of these two */
 	g_free (ce->base_tmp_dir);
@@ -406,7 +442,7 @@
 {
 	ce->header = NULL;
 	ce->footer = NULL;
-	ce->style = NULL;
+	ce->style_dir = NULL;
 
 	ce->base_dir = NULL;     /* NOTE: gio port: get rid of these two */
 	ce->base_tmp_dir = NULL;
@@ -518,8 +554,8 @@
 				const char         *style)
 {
 	g_return_if_fail (IS_CATALOG_WEB_EXPORTER (ce));
-	g_free (ce->style);
-	ce->style = g_strdup (style);
+	UNREF (ce->style_dir)
+	ce->style_dir = gfile_get_style_dir (ce, style);
 }
 
 
@@ -529,7 +565,7 @@
 {
 	g_return_if_fail (IS_CATALOG_WEB_EXPORTER (ce));
 	UNREF (ce->target_dir)
-	ce->target_dir = g_file_new_for_uri (location);
+	ce->target_dir = gfile_new (location);
 }
 
 
@@ -1128,42 +1164,7 @@
 }
 
 
-
-/* build a GFile (helpers) */
-
-GFile *
-file_resolve_relative_path (GFile	*file,
-			    const char  *relative_path)
-{
-	GFile *result;
-	
-	if (relative_path != NULL)
-		result = g_file_resolve_relative_path (file, relative_path);
-	else
-		result = g_file_dup (file);
-	
-	return result;
-}
-
-
-GFile *
-get_filename (GFile              *dir,
-	      const char         *subdir,
-	      const char         *filename)
-{
-	GFile *file, *result;
-	
-	file = file_resolve_relative_path (dir, subdir);
-	result = file_resolve_relative_path (file, filename);
-
-	g_object_unref (file);
-	
-	return result;
-}
-
-
-/* build a GFile for a CatalogWebExporter */
-
+/* construct a GFile for a CatalogWebExporter */
 
 GFile *
 get_album_file (CatalogWebExporter *ce,
@@ -1171,9 +1172,19 @@
 		const char         *subdir,
 		const char         *filename)
 {
-	return get_filename (target_dir, 
-			     (ce->use_subfolders ? subdir : NULL),
-			     filename);
+
+	GFile *dir, *file;
+
+	dir = gfile_append_path (target_dir, 
+			         (ce->use_subfolders ? subdir : NULL),
+			         NULL);
+	file = gfile_append_path (dir, 
+				  filename,
+				  NULL);
+
+	g_object_unref (dir);
+
+	return file;
 }
 
 
@@ -1293,7 +1304,7 @@
 		g_free (escaped);
 
 	} else {
-		result = g_file_new_for_uri (idata->src_file->path);
+		result = gfile_new (idata->src_file->path);
 	}
 	
 	return result;
@@ -2099,46 +2110,6 @@
 }
 
 
-static char *
-get_style_dir (CatalogWebExporter *ce)
-{
-	char *path;
-	char *uri;
-	char *style_dir;
-
-	style_dir = g_uri_unescape_string (ce->style, NULL);
-	
-	path = g_build_filename (g_get_home_dir (),
-			         ".gnome2",
-			         "gthumb",
-			         "albumthemes",
-			         style_dir,
-			         NULL);
-	uri = get_uri_from_local_path (path);
- 	g_free (path);
-
-	if (!path_is_dir (uri)) {
-		g_free (uri);
-
-		path = g_build_filename (GTHUMB_DATADIR,
-				         "gthumb",
-				         "albumthemes",
-				         style_dir,
-				         NULL);
-		uri = get_uri_from_local_path (path);
- 		g_free (path);
-
-		if (!path_is_dir (uri)) {
-			g_free (uri);
-			uri = NULL;
-		}
-	}
-
-	g_free (style_dir);
-	return uri;
-}
-
-
 static int
 export__save_other_files__progress_update_cb (GnomeVFSXferProgressInfo *info,
 					      gpointer                  data)
@@ -2164,56 +2135,95 @@
 static void
 export__save_other_files (CatalogWebExporter *ce)
 {
-	GnomeVFSResult  result;
-	GList          *file_list = NULL;
-	char           *source_dir;
+	GFileEnumerator  *file_enum;
+	GError           *error = NULL;
+		
+	file_enum = g_file_enumerate_children (ce->style_dir,
+					       G_FILE_ATTRIBUTE_STANDARD_NAME ","
+					       G_FILE_ATTRIBUTE_STANDARD_TYPE,
+					       0, NULL, &error);
 
-	source_dir = get_style_dir (ce);
-
-	if (source_dir != NULL)
-		result = gnome_vfs_directory_list_load (&file_list, source_dir, GNOME_VFS_FILE_INFO_DEFAULT);
-	else
-		result = GNOME_VFS_ERROR_NOT_A_DIRECTORY;
-
-	if (result == GNOME_VFS_OK) {
-		GList *scan;
-		GList *source_uri_list = NULL, *target_uri_list =  NULL;
-
-		for (scan = file_list; scan; scan = scan->next) {
-			GnomeVFSFileInfo *info = scan->data;
-			char		 *source_filename, *uri;
-			GFile            *file;
-			GnomeVFSURI	 *source_uri = NULL, *target_uri = NULL;
-
-			if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
-				continue;
-
-			if ((strcmp (info->name, "index.gthtml") == 0)
-			    || (strcmp (info->name, "thumbnail.gthtml") == 0)
-			    || (strcmp (info->name, "image.gthtml") == 0))
-				continue;
-
-			source_filename = g_build_filename (source_dir,
-							    info->name,
-							    NULL);
-			source_uri = new_uri_from_path (source_filename);
+	if (error != NULL) {
+		gfile_warning ("Cannot enumerate style directory", 
+			       ce->style_dir, 
+			       error);
+		g_error_free (error);
+	}
+	else {
+		GList *source_uri_list = NULL;
+		GList *target_uri_list = NULL;
+		
+		gboolean enumerate = TRUE;
+		
+		while (enumerate) {
+	
+			GFileInfo        *info;
+	
+			info = g_file_enumerator_next_file (file_enum, NULL, &error);
+			
+			/* error during enumeration */
+			
+			if (error != NULL) {
+				gfile_warning ("Error during enumeration of style directory", 
+					       ce->style_dir, 
+					       error);
+				g_error_free (error);
+				enumerate = FALSE;
+			}
+			
+			/* no more files */
+			
+			else if (info == NULL) {
+				enumerate = FALSE;
+			}
 			
-			file = get_theme_file (ce, 
-					       ce->target_tmp_dir,
-					       info->name);
-			uri = gfile_get_uri (file);
-			target_uri = gnome_vfs_uri_new (uri);
+			/* OK, got a file */
 			
-			source_uri_list = g_list_prepend (source_uri_list, source_uri);
-			target_uri_list = g_list_prepend (target_uri_list, target_uri);
-
-			debug (DEBUG_INFO, "save file: %s", source_filename);
-
-			g_free (source_filename);
-			g_free (uri);
-			g_object_unref (file);
+			else {
+				const char       *name;
+				char		 *target_filename, *source_filename;
+				GFile            *source_file, *target_file;
+				GnomeVFSURI	 *source_uri = NULL, *target_uri = NULL;
+				
+				if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
+					continue;
+		
+				name = g_file_info_get_name (info);
+				
+				if ((strcmp (name, "index.gthtml") == 0)
+				    || (strcmp (name, "thumbnail.gthtml") == 0)
+				    || (strcmp (name, "image.gthtml") == 0))
+					continue;
+		
+				source_file = gfile_append_path (ce->style_dir,
+								 name,
+								 NULL);
+				target_file = get_theme_file (ce, 
+							      ce->target_tmp_dir,
+							      name);
+		
+				source_filename = gfile_get_uri (source_file);
+				source_uri = gnome_vfs_uri_new (source_filename);
+				
+				target_filename = gfile_get_uri (target_file);
+				target_uri = gnome_vfs_uri_new (target_filename);
+				
+				source_uri_list = g_list_prepend (source_uri_list, source_uri);
+				target_uri_list = g_list_prepend (target_uri_list, target_uri);
+		
+				gfile_debug (DEBUG_INFO, "save file", source_file);
+		
+				g_free (source_filename);
+				g_free (target_filename);
+				g_object_unref (source_file);
+				g_object_unref (target_file);
+				
+				g_object_unref (info);
+			}
 		}
 		
+		g_object_unref (file_enum);
+		
 		if (source_uri_list != NULL) {
 			
 			GnomeVFSXferOptions        xfer_options;
@@ -2224,9 +2234,9 @@
 			xfer_options    = 0;
 			xfer_error_mode = GNOME_VFS_XFER_ERROR_MODE_ABORT;
 			overwrite_mode  = GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE;
-
+	
 			result = gnome_vfs_xfer_uri_list (source_uri_list,
-				       			  target_uri_list,
+							  target_uri_list,
 							  xfer_options,
 							  xfer_error_mode,
 							  overwrite_mode,
@@ -2231,7 +2241,7 @@
 							  xfer_error_mode,
 							  overwrite_mode,
 							  export__save_other_files__progress_update_cb,
-				 			  ce);
+							  ce);
 		}
 		
 		if (source_uri_list != NULL)
@@ -2239,11 +2249,6 @@
 		if (target_uri_list != NULL)
 			gnome_vfs_uri_list_free (target_uri_list);
 	}
-
-	if (file_list != NULL)
-		gnome_vfs_file_info_list_free (file_list);
-	g_free (source_dir);
-
 }
 
 
@@ -2636,12 +2641,10 @@
 static void
 export__copy_image (CatalogWebExporter *ce)
 {
-	ImageData                 *idata;
-	GFile                     *file;
-	char                      *uri;
-	GnomeVFSURI               *source_uri = NULL;
-	GnomeVFSURI               *target_uri = NULL;
-	GnomeVFSResult             result;
+	ImageData  *idata;
+	GFile      *sfile;
+	GFile      *dfile;
+	gboolean   *copy_done;
 
 	/* This function is used when "Copy originals to destination" is
 	   enabled, and resizing is NOT enabled. This allows us to use a
@@ -2652,26 +2655,18 @@
 
 	idata = ce->file_to_load->data;
 
-	source_uri = gnome_vfs_uri_new (idata->src_file->path);
+	sfile = gfile_new (idata->src_file->path);
 	
-	file = get_image_file (ce, 
-			       idata, 
-			       ce->target_tmp_dir);
-	uri = gfile_get_uri (file);
-	target_uri = gnome_vfs_uri_new (uri);
+	dfile = get_image_file (ce, 
+			        idata, 
+			        ce->target_tmp_dir);
 		
-	result = gnome_vfs_xfer_uri (source_uri,
-				     target_uri,
-				     GNOME_VFS_XFER_DEFAULT,
-				     GNOME_VFS_XFER_ERROR_MODE_ABORT,
-				     GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
-				     NULL,
-				     NULL);
+	copy_done = gfile_copy (sfile, dfile);
 
-	gnome_vfs_uri_unref (source_uri);
-	gnome_vfs_uri_unref (target_uri);
-
-	if (result == GNOME_VFS_OK) {
+	if (copy_done) {
+		char *uri;
+		uri = gfile_get_uri (dfile);
+		
 		if (image_is_jpeg (uri)) {
 			GthTransform  transform;
 		
@@ -2688,10 +2683,11 @@
 
 			file_data_unref (fd);
 		}
+		g_free (uri);
 	}
 	
-	g_object_unref (file);
-	g_free (uri);
+	g_object_unref (sfile);
+	g_object_unref (dfile);
 	
 	ce->saving_timeout = g_timeout_add (SAVING_TIMEOUT,
 					    save_image_preview_cb,
@@ -2853,8 +2849,7 @@
 static void
 parse_theme_files (CatalogWebExporter *ce)
 {
-	char  *style_dir;
-	char  *template_uri;
+	GFile *template;
 	char  *local_file;
 	GList *scan;
 
@@ -2860,10 +2855,6 @@
 
 	free_parsed_docs (ce);
 
-	style_dir = get_style_dir (ce);
-
-	debug (DEBUG_INFO, "style dir: %s", style_dir);
-
 	ce->image = 0;
 
 	/* read and parse index.gthtml */
@@ -2869,14 +2860,14 @@
 	/* read and parse index.gthtml */
 
 	yy_parsed_doc = NULL;
-	template_uri = build_uri (style_dir, 
-				  "index.gthtml",
-				  NULL);
-	local_file = get_local_path_from_uri (template_uri);
-
-	debug (DEBUG_INFO, "load %s", local_file);
-
+	template = gfile_append_path (ce->style_dir, 
+				      "index.gthtml",
+				      NULL);
+	gfile_debug (DEBUG_INFO, "load", template);
+	
+	local_file = gfile_get_path (template);
 	yyin = fopen (local_file, "r");
+	
 	if ((yyin != NULL) && (yyparse () == 0))
 		ce->index_parsed = yy_parsed_doc;
 	else
@@ -2890,7 +2881,7 @@
 		ce->index_parsed = g_list_prepend (NULL, tag);
 	}
 
-	g_free (template_uri);
+	g_object_unref (template);
 	g_free (local_file);
 
 	/* read and parse thumbnail.gthtml */
@@ -2896,14 +2887,14 @@
 	/* read and parse thumbnail.gthtml */
 
 	yy_parsed_doc = NULL;
-	template_uri = build_uri (style_dir, 
-				  "thumbnail.gthtml",
-				  NULL);
-	local_file = get_local_path_from_uri (template_uri);
+	template = gfile_append_path (ce->style_dir, 
+				      "thumbnail.gthtml",
+				      NULL);
+	gfile_debug (DEBUG_INFO, "load", template);
 	
-	debug (DEBUG_INFO, "load %s", local_file);
- 
+	local_file = gfile_get_path (template);
 	yyin = fopen (local_file, "r");
+	
 	if ((yyin != NULL) && (yyparse () == 0))
 		ce->thumbnail_parsed = yy_parsed_doc;
 	else
@@ -2932,7 +2923,7 @@
 		ce->thumbnail_parsed = g_list_prepend (NULL, tag);
 	}
 
-	g_free (template_uri);
+	g_object_unref (template);
 	g_free (local_file);
 
 	/* Read and parse image.gthtml */
@@ -2938,14 +2929,14 @@
 	/* Read and parse image.gthtml */
 
 	yy_parsed_doc = NULL;
-	template_uri = build_uri (style_dir, 
-				  "image.gthtml",
-				  NULL);
-	local_file = get_local_path_from_uri (template_uri);
+	template = gfile_append_path (ce->style_dir, 
+				      "image.gthtml",
+				      NULL);
+	gfile_debug (DEBUG_INFO, "load", template);
 	
-	debug (DEBUG_INFO, "load %s", local_file);
+	local_file = gfile_get_path (template);	
+	yyin = fopen (local_file, "r");
 	
-	yyin = fopen (local_file, "r");
 	if ((yyin != NULL) && (yyparse () == 0))
 		ce->image_parsed = yy_parsed_doc;
 	else
@@ -2974,10 +2965,9 @@
 		ce->image_parsed = g_list_prepend (NULL, tag);
 	}
 
-	g_free (template_uri);
+	g_object_unref (template);
 	g_free (local_file);
-	g_free (style_dir);
-
+	
 	/* read index.html and set variables. */
 
 	for (scan = ce->index_parsed; scan; scan = scan->next) {
@@ -3032,7 +3022,7 @@
 	gboolean  ok;
 	GFile    *dir;
 	
-	dir = file_resolve_relative_path (target_dir, subdir);
+	dir = gfile_append_path (target_dir, subdir, NULL);
 	
 	ok = gfile_ensure_dir_exists (dir, 0700, NULL);
 	
@@ -3070,6 +3060,20 @@
 		return;
 	ce->exporting = TRUE;
 
+	/* 
+	 * check that the style directory is not NULL. A NULL indicates that
+	 * the folder of the selected style has been deleted or renamed 
+	 * before the user started the export. It is unlikely.
+	 */
+	
+	if (ce->style_dir == NULL) {
+		_gtk_error_dialog_run (GTK_WINDOW (ce->window), _("Could not find the style folder"));
+		g_signal_emit (G_OBJECT (ce), catalog_web_exporter_signals[WEB_EXPORTER_DONE], 0);
+		return;
+	}
+	
+	gfile_debug (DEBUG_INFO, "style dir", ce->style_dir);
+	
 	/* get index file name and subdirs from gconf (hidden prefs) */
 
 	g_free (ce->index_file);
@@ -3090,14 +3094,9 @@
 		g_signal_emit (G_OBJECT (ce), catalog_web_exporter_signals[WEB_EXPORTER_DONE], 0);
 		return;
 	}
-	else {
-		char	*tmp_dir;
-		
-		tmp_dir = gfile_get_path (ce->target_tmp_dir);
-		debug (DEBUG_INFO, "temp dir: %s", tmp_dir);
-		g_free (tmp_dir);
-	}
-
+	
+	gfile_debug (DEBUG_INFO, "temp dir", ce->target_tmp_dir);
+	
 	/* compute n_images, n_pages */
 	
 	ce->n_images = g_list_length (ce->file_list);
@@ -3111,7 +3110,7 @@
 	}
 
 	/* parse .gthtml files */
-		
+
 	parse_theme_files (ce);
 
 	debug (DEBUG_INFO, "thumb size: %dx%d", ce->thumb_width, ce->thumb_height);
Index: src/gth-browser-actions-callbacks.c
===================================================================
--- src/gth-browser-actions-callbacks.c	(revision 2391)
+++ src/gth-browser-actions-callbacks.c	(working copy)
@@ -509,7 +509,7 @@
 				       _("The name \"%s\" is already used. " "Please use a different name."), utf8_name);
 		g_free (utf8_name);
 	} 
-	else if (file_rename (catalog_path, new_catalog_path, NULL)) {
+	else if (file_rename (catalog_path, new_catalog_path)) {
 		all_windows_notify_catalog_rename (catalog_path,
 						   new_catalog_path);
 	} 
@@ -1031,7 +1031,7 @@
 
 		old_folder_comment = comments_get_comment_filename (old_path, TRUE);
 
-		result = file_rename (old_path, new_path, NULL);
+		result = file_rename (old_path, new_path);
 		if (result) {
 			char *new_folder_comment;
 
@@ -1038,7 +1038,7 @@
 			/* Comment cache. */
 
 			new_folder_comment = comments_get_comment_filename (new_path, TRUE);
-			file_rename (old_folder_comment, new_folder_comment, NULL);
+			file_rename (old_folder_comment, new_folder_comment);
 			g_free (new_folder_comment);
 
 			all_windows_notify_directory_rename (old_path, new_path);
@@ -1341,7 +1341,7 @@
 
 		old_folder_comment = comments_get_comment_filename (old_path, TRUE);
 
-		result = file_rename (old_path, new_path, NULL);
+		result = file_rename (old_path, new_path);
 		if (result) {
 			char *new_folder_comment;
 
@@ -1349,7 +1349,7 @@
 			 * implemeted with rename, which is faster. */
 
 			new_folder_comment = comments_get_comment_filename (new_path, TRUE);
-			file_rename (old_folder_comment, new_folder_comment, NULL);
+			file_rename (old_folder_comment, new_folder_comment);
 			g_free (new_folder_comment);
 
 			all_windows_notify_directory_rename (old_path, new_path);
Index: src/dlg-file-utils.c
===================================================================
--- src/dlg-file-utils.c	(revision 2391)
+++ src/dlg-file-utils.c	(working copy)
@@ -1005,7 +1005,7 @@
 			continue;
 		}
 
-		result = file_rename (old_full_path, new_full_path, NULL);
+		result = file_rename (old_full_path, new_full_path);
 		if (result) {
 			cache_move (old_full_path, new_full_path);
 			comment_move (old_full_path, new_full_path);

