Index: configure.in
===================================================================
--- configure.in	(revision 577)
+++ configure.in	(working copy)
@@ -43,7 +43,6 @@ GTK_REQUIRED=2.3.0
 GNOME_REQUIRED=2.3.3
 LIBBONOBOUI_REQUIRED=2.3.3
 XML_REQUIRED=2.5.8
-VFS_REQUIRED=2.3.5
 LIBGLADE_REQUIRED=2.0.1
 GDL_REQUIRED=0.7.0
 
@@ -72,10 +71,9 @@ PKG_CHECK_MODULES(GBF,
 	libglade-2.0 >= $LIBGLADE_REQUIRED
 	libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED
 	libxml-2.0 >= $XML_REQUIRED
-	gnome-vfs-2.0 >= $VFS_REQUIRED
+	gio-2.0
 	gdl-1.0 >= $GDL_REQUIRED
-	gdl-gnome-1.0 >= $GDL_REQUIRED
-	gnome-vfs-module-2.0 >= $VFS_REQUIRED)
+	gdl-gnome-1.0 >= $GDL_REQUIRED)
 AC_SUBST(GBF_CFLAGS)
 AC_SUBST(GBF_LIBS)
 
Index: src/backends/libgbf_am/gbf-am-config.c
===================================================================
--- src/backends/libgbf_am/gbf-am-config.c	(revision 577)
+++ src/backends/libgbf_am/gbf-am-config.c	(working copy)
@@ -93,7 +93,7 @@ gbf_am_config_value_free (GbfAmConfigVal
 		    }
 		    break;
 	    default:
-		    g_warning (_("Invalid GbfAmConfigValue type"));
+		    g_warning ("%s", _("Invalid GbfAmConfigValue type"));
 		    break;
 	}
 	g_free (value);
@@ -127,7 +127,7 @@ gbf_am_config_value_copy (const GbfAmCon
 		    value->list = g_slist_reverse (value->list);
 		    break;
 	    default:
-		    g_warning (_("Invalid GbfAmConfigValue type"));
+		    g_warning ("%s", _("Invalid GbfAmConfigValue type"));
 		    break;
 	}
 
Index: src/backends/libgbf_am/gbf-am-project.c
===================================================================
--- src/backends/libgbf_am/gbf-am-project.c	(revision 577)
+++ src/backends/libgbf_am/gbf-am-project.c	(working copy)
@@ -36,10 +36,9 @@
 #include <libgnome/gnome-macros.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
-#include <libgnomevfs/gnome-vfs-monitor.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libgnomevfs/gnome-vfs-xfer.h>
+#include <glib.h>
+#include <gio/gio.h>
+#include <gbf/gbf-string-utils.h>
 #include <gbf/gbf-project.h>
 #include <gbf/glue-plugin.h>
 #include "gbf-i18n.h"
@@ -187,15 +186,6 @@ static GbfProject *parent_class;
    Private prototypes
    ---------------------------------------------------------------------- */
 
-static gboolean        uri_is_equal                 (const gchar       *uri1,
-						     const gchar       *uri2);
-static gboolean        uri_is_parent                (const gchar       *parent_uri,
-						     const gchar       *child_uri);
-static gboolean        uri_is_local_path            (const gchar       *uri);
-static gchar          *uri_to_path                  (const gchar       *uri);
-static gchar          *uri_normalize                (const gchar       *uri,
-						     const gchar       *base_uri);
-
 static gboolean        xml_write_add_source         (GbfAmProject      *project,
 						     xmlDocPtr          doc,
 						     GNode             *g_node,
@@ -283,151 +273,6 @@ static void            gbf_am_project_ge
  */
 
 /*
- * URI and path manipulation functions -----------------------------
- */
-
-static gboolean 
-uri_is_equal (const gchar *uri1,
-	      const gchar *uri2)
-{
-	gboolean retval = FALSE;
-	GnomeVFSURI *vfs_uri1, *vfs_uri2;
-
-	vfs_uri1 = gnome_vfs_uri_new (uri1);
-	vfs_uri2 = gnome_vfs_uri_new (uri2);
-	if (vfs_uri1 != NULL && vfs_uri2 != NULL)
-		retval = gnome_vfs_uri_equal (vfs_uri1, vfs_uri2);
-	gnome_vfs_uri_unref (vfs_uri1);
-	gnome_vfs_uri_unref (vfs_uri2);
-
-	return retval;
-}
-
-static gboolean 
-uri_is_parent (const gchar *parent_uri,
-	       const gchar *child_uri)
-{
-	gboolean retval = FALSE;
-	GnomeVFSURI *parent, *child;
-
-	parent = gnome_vfs_uri_new (parent_uri);
-	child = gnome_vfs_uri_new (child_uri);
-	if (parent != NULL && child != NULL)
-		retval = gnome_vfs_uri_is_parent (parent, child, TRUE);
-	gnome_vfs_uri_unref (parent);
-	gnome_vfs_uri_unref (child);
-
-	return retval;
-}
-
-static gboolean
-uri_is_local_path (const gchar *uri)
-{
-	const gchar *p;
-	
-	for (p = uri;
-	     g_ascii_isalnum (*p) || *p == '+' || *p == '-' || *p == '.';
-	     p++)
-		;
-
-	if (*p == ':')
-		return FALSE;
-	else
-		return TRUE;
-}
-
-static gchar *
-uri_to_path (const gchar *uri)
-{
-	return gnome_vfs_get_local_path_from_uri (uri);
-}
-
-static gchar *
-uri_normalize (const gchar *uri, const gchar *base_uri)
-{
-	gchar *normalized_uri = NULL;
-
-	if (uri_is_local_path (uri)) {
-		gchar *absolute_path;
-		
-		absolute_path = gnome_vfs_expand_initial_tilde (uri);
-		if (!g_path_is_absolute (uri)) {
-			gchar *tmp = absolute_path;
-			gchar *base_dir;
-			if (base_uri != NULL)
-				base_dir = uri_to_path (base_uri);
-			else
-				base_dir = g_get_current_dir ();
-
-			absolute_path = g_build_filename (base_dir, tmp, NULL);
-			g_free (base_dir);
-			g_free (tmp);
-		}
-		normalized_uri = gnome_vfs_make_uri_canonical (absolute_path);
-		g_free (absolute_path);
-	} else {
-		GnomeVFSURI *vfs_uri;
-
-		vfs_uri = gnome_vfs_uri_new (uri);
-		/* FIXME: this should probably check that the method is file: */
-		if (gnome_vfs_uri_is_local (vfs_uri))
-			normalized_uri = gnome_vfs_make_uri_canonical (uri);
-		gnome_vfs_uri_unref (vfs_uri);
-	}
-
-	/* strip trailing slash */
-	if (normalized_uri) {
-		gint length = strlen (normalized_uri);
-		gchar *p;
-		if (length > 0) {
-			p = normalized_uri + length - 1;
-			if (*p == '/')
-				*p = '\0';
-		}
-	}
-
-	return normalized_uri;
-}
-
-/**
- * uri_get_chrooted_path:
- * @root_uri: the root uri (or NULL)
- * @uri: the uri which must be inside @root_uri for which the
- * root-changed path is wanted
- *
- * E.g.: uri_get_chrooted_path ("file:///foo/bar", "file:///foo/bar/baz/winkle") -> "/baz/winkle"
- *
- * Return value: a newly allocated chrooted path
- **/
-static gchar *
-uri_get_chrooted_path (const gchar *root_uri, const gchar *uri)
-{
-	gchar *root_path, *path;
-	gint root_length;
-	gchar *retval = NULL;
-	
-	path = uri_to_path (uri);
-	if (root_uri == NULL)
-		return path;
-	
-	root_path = uri_to_path (root_uri);
-	
-	root_length = strlen (root_path);
-	if (strncmp (root_path, path, root_length) == 0) {
-		/* check for trailing path separator in root... we need it to
-		 * make the returned path absolute */
-		if (root_path [root_length - 1] == '/')
-			root_length--;
-		retval = g_strdup (path + root_length);
-	}
-
-	g_free (root_path);
-	g_free (path);
-	
-	return retval;
-}
-
-/*
  * Project modification functions -----------------------------
  */
 
@@ -440,7 +285,7 @@ xml_new_source_node (GbfAmProject *proje
 	gchar *filename;
 	
 	source = xmlNewDocNode (doc, NULL, BAD_CAST "source", NULL);
-	filename = uri_get_chrooted_path (project->project_root_uri, uri);
+	filename = gbf_uri_get_chrooted_path (project->project_root_uri, uri);
 	xmlSetProp (source, BAD_CAST "uri", BAD_CAST filename);
 	g_free (filename);
 	
@@ -762,7 +607,7 @@ xml_new_change_doc (GbfAmProject *projec
 	doc = xmlNewDoc (BAD_CAST "1.0");
 	if (doc != NULL) {
 		gchar *root_path;
-		root_path = uri_to_path (project->project_root_uri);
+		root_path = gbf_uri_to_path (project->project_root_uri);
 		doc->children = xmlNewDocNode (doc, NULL, BAD_CAST "project", NULL);
 		xmlSetProp (doc->children, BAD_CAST "root", BAD_CAST root_path);
 		g_free (root_path);
@@ -778,19 +623,19 @@ xml_new_change_doc (GbfAmProject *projec
  */
 
 static void
-monitor_cb (GnomeVFSMonitorHandle   *handle,
-	    const gchar             *monitor_uri,
-	    const gchar             *info_uri,
-	    GnomeVFSMonitorEventType event_type,
-	    gpointer                 data)
+monitor_cb (GFileMonitor      *monitor,
+	    GFile             *file,
+	    GFile             *other_file,
+	    GFileMonitorEvent  event_type,
+	    gpointer           data)
 {
 	GbfAmProject *project = data;
 
 	g_return_if_fail (project != NULL && GBF_IS_AM_PROJECT (project));
 
 	switch (event_type) {
-		case GNOME_VFS_MONITOR_EVENT_CHANGED:
-		case GNOME_VFS_MONITOR_EVENT_DELETED:
+		case G_FILE_MONITOR_EVENT_CHANGED:
+		case G_FILE_MONITOR_EVENT_DELETED:
 			/* monitor will be removed here... is this safe? */
 			DEBUG (g_message ("File changed"));
 			project_reload (project, NULL);
@@ -801,11 +646,11 @@ monitor_cb (GnomeVFSMonitorHandle   *han
 	}
 }
 
+
 static void
 monitor_add (GbfAmProject *project, const gchar *uri)
 {
-	GnomeVFSMonitorHandle *handle = NULL;
-	GnomeVFSResult result;
+	GFileMonitor *monitor;
 
 	g_return_if_fail (project != NULL);
 	g_return_if_fail (project->monitors != NULL);
@@ -813,27 +658,32 @@ monitor_add (GbfAmProject *project, cons
 	if (!uri)
 		return;
 	
-	handle = g_hash_table_lookup (project->monitors, uri);
-	if (!handle) {
-		GnomeVFSURI *vfs_uri;
+	monitor = g_hash_table_lookup (project->monitors, uri);
+	if (!monitor) {
+		GFile *file;
 		gboolean exists;
+		GError *error = NULL;
 		
-		vfs_uri = gnome_vfs_uri_new (uri);
-		exists = gnome_vfs_uri_exists (vfs_uri);
-		gnome_vfs_uri_unref (vfs_uri);
+		file = g_file_new_for_commandline_arg (uri);
+		exists = g_file_query_exists (file, NULL);
 
 		if (exists) {
-			result = gnome_vfs_monitor_add (&handle,
-							uri,
-							GNOME_VFS_MONITOR_FILE,
-							monitor_cb,
-							project);
-			if (result == GNOME_VFS_OK) {
+			monitor = g_file_monitor_file (file,
+						       0, NULL, &error);
+			if (!error) {
 				g_hash_table_insert (project->monitors,
 						     g_strdup (uri),
-						     handle);
+						     monitor);
+				g_signal_connect (monitor, "changed",
+						  G_CALLBACK (monitor_cb),
+						  project);
+			} else {
+				g_warning ("Error monitoring file: %s", error->message);
+				g_error_free (error);
 			}
 		}
+
+		g_object_unref (file);
 	}
 }
 
@@ -867,7 +717,7 @@ monitors_setup (GbfAmProject *project)
 	
 	/* setup monitors hash */
 	project->monitors = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
-						   (GDestroyNotify) gnome_vfs_monitor_cancel);
+						   (GDestroyNotify) g_file_monitor_cancel);
 
 	monitor_add (project, project->project_file);
 	g_hash_table_foreach (project->groups, group_hash_foreach_monitor, project);
@@ -1724,7 +1574,7 @@ parse_errors (GbfAmProject *project,
 	if (message->len > 0) {
 		err = g_error_new (GBF_PROJECT_ERROR,
 				   GBF_PROJECT_ERROR_GENERAL_FAILURE,
-				   message->str);
+				   "%s", message->str);
 	}
 	g_string_free (message, TRUE);
 	
@@ -2141,7 +1991,7 @@ project_reload (GbfAmProject *project, G
 	gboolean retval;
 	gint i;
 	
-	project_path = uri_to_path (project->project_root_uri);
+	project_path = gbf_uri_to_path (project->project_root_uri);
 		
 	i = 0;
 	argv [i++] = GBF_AM_PARSE;
@@ -2586,7 +2436,7 @@ impl_load (GbfProject  *_project,
 		return;
 	
 	/* check that the uri is in the filesystem */
-	project->project_root_uri = uri_normalize (uri, NULL);
+	project->project_root_uri = gbf_uri_normalize (uri, NULL);
 	if (project->project_root_uri == NULL) {
 		error_set (error, GBF_PROJECT_ERROR_DOESNT_EXIST,
 			   _("Invalid or remote path (only local paths supported)"));
@@ -2594,7 +2444,7 @@ impl_load (GbfProject  *_project,
 	}
 		
 	/* some basic checks */
-	root_path = uri_to_path (project->project_root_uri);
+	root_path = gbf_uri_to_path (project->project_root_uri);
 	if (root_path == NULL || !g_file_test (root_path, G_FILE_TEST_IS_DIR)) {
 		error_set (error, GBF_PROJECT_ERROR_DOESNT_EXIST,
 			   _("Project doesn't exist or invalid path"));
@@ -2637,9 +2487,9 @@ impl_probe (GbfProject  *_project,
 	
 	g_return_val_if_fail (GBF_IS_AM_PROJECT (_project), FALSE);
 
-	normalized_uri = uri_normalize (path, NULL);
+	normalized_uri = gbf_uri_normalize (path, NULL);
 	if (normalized_uri != NULL) {
-		root_path = uri_to_path (normalized_uri);
+		root_path = gbf_uri_to_path (normalized_uri);
 		if (root_path != NULL && g_file_test (root_path, G_FILE_TEST_IS_DIR)) {
 			retval = (file_exists (root_path, "Makefile.am") &&
 				  (file_exists (root_path, "configure.in") ||
@@ -3393,34 +3243,32 @@ impl_add_source (GbfProject  *_project,
 	/* if the uri is relative, resolve it against the target's
 	 * group directory; we need to compute the group's uri
 	 * first */
-	group_uri = uri_normalize (g_path_skip_root (GBF_AM_NODE (g_node->parent)->id),
-				   project->project_root_uri);
+	group_uri = gbf_uri_normalize (g_path_skip_root (GBF_AM_NODE (g_node->parent)->id),
+				       project->project_root_uri);
 	
-	full_uri = uri_normalize (uri, group_uri);
+	full_uri = gbf_uri_normalize (uri, group_uri);
 	
 	/* Check that the source uri is inside the project root */
-	if (!uri_is_parent (project->project_root_uri, full_uri)) {
+	if (!gbf_uri_is_parent (project->project_root_uri, full_uri)) {
 		/* If not, copy it to target's group directory */
-		GnomeVFSURI *group_vuri, *dest_vuri, *src_vuri;
-		GnomeVFSResult res;
-		
-		src_vuri = gnome_vfs_uri_new (uri);
-		group_vuri = gnome_vfs_uri_new (group_uri);
-		dest_vuri = gnome_vfs_uri_append_file_name (group_vuri,
-							    filename);
-		
-		res = gnome_vfs_xfer_uri (src_vuri, dest_vuri,
-					  GNOME_VFS_XFER_DEFAULT,
-					  GNOME_VFS_XFER_ERROR_MODE_ABORT,
-					  GNOME_VFS_XFER_OVERWRITE_MODE_ABORT,
-					  NULL, NULL);
-		if (res != GNOME_VFS_OK && res != GNOME_VFS_ERROR_FILE_EXISTS) {
+		GFile *group_vfile, *dest_vfile, *src_vfile;
+		gboolean res;
+		GError *vfs_error = NULL;
+
+		src_vfile = g_file_new_for_commandline_arg (uri);
+		group_vfile = g_file_new_for_commandline_arg (group_uri);
+		dest_vfile = g_file_get_child (group_vfile,
+					       filename);
+
+		res = g_file_copy (src_vfile, dest_vfile,
+				   0, NULL, NULL, NULL, &vfs_error);
+		if (!res && !g_error_matches (vfs_error, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
 			GbfProjectError gbf_err;
 			gchar *error_str =
 				g_strdup_printf ("Failed to copy source file inside project: %s",
-						 gnome_vfs_result_to_string (res));
-			switch (res) {
-			case GNOME_VFS_ERROR_NOT_FOUND:
+						 vfs_error->message);
+			switch (vfs_error->code) {
+			case G_IO_ERROR_NOT_FOUND:
 				gbf_err = GBF_PROJECT_ERROR_DOESNT_EXIST;
 				break;
 			default:
@@ -3429,15 +3277,15 @@ impl_add_source (GbfProject  *_project,
 			}
 			error_set (error, gbf_err, error_str);
 			g_free (error_str);
+			g_error_free (vfs_error);
 			abort_action = TRUE;
 		} else {
 			g_free (full_uri);
-			full_uri = gnome_vfs_uri_to_string (dest_vuri,
-							    GNOME_VFS_URI_HIDE_NONE);
+			full_uri = g_file_get_uri (dest_vfile);
 		}
-		gnome_vfs_uri_unref (src_vuri);
-		gnome_vfs_uri_unref (group_vuri);
-		gnome_vfs_uri_unref (dest_vuri);
+		g_object_unref (src_vfile);
+		g_object_unref (group_vfile);
+		g_object_unref (dest_vfile);
 	}
 	
 	g_free (group_uri);
@@ -3449,7 +3297,7 @@ impl_add_source (GbfProject  *_project,
 		GbfAmNode *node = GBF_AM_NODE (iter_node);
 		
 		if (node->type == GBF_AM_NODE_SOURCE &&
-		    uri_is_equal (full_uri, node->uri)) {
+		    gbf_uri_is_equal (full_uri, node->uri)) {
 			error_set (error, GBF_PROJECT_ERROR_ALREADY_EXISTS,
 				   _("Source file is already in given target"));
 			abort_action = TRUE;
Index: src/backends/libgbf_mkfile/gbf-mkfile-project.c
===================================================================
--- src/backends/libgbf_mkfile/gbf-mkfile-project.c	(revision 577)
+++ src/backends/libgbf_mkfile/gbf-mkfile-project.c	(working copy)
@@ -39,10 +39,9 @@
 #include <libgnome/gnome-macros.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
-#include <libgnomevfs/gnome-vfs-monitor.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
+#include <gio/gio.h>
 #include <gbf/gbf-project.h>
+#include <gbf/gbf-string-utils.h>
 #include <gbf/glue-plugin.h>
 #include "gbf-i18n.h"
 #include "gbf-mkfile-project.h"
@@ -187,15 +186,6 @@ static GbfProject *parent_class;
    Private prototypes
    ---------------------------------------------------------------------- */
 
-static gboolean        uri_is_equal                 (const gchar       *uri1,
-						     const gchar       *uri2);
-static gboolean        uri_is_parent                (const gchar       *parent_uri,
-						     const gchar       *child_uri);
-static gboolean        uri_is_local_path            (const gchar       *uri);
-static gchar          *uri_to_path                  (const gchar       *uri);
-static gchar          *uri_normalize                (const gchar       *uri,
-						     const gchar       *base_uri);
-
 static gboolean        xml_write_add_source         (GbfMkfileProject      *project,
 						     xmlDocPtr          doc,
 						     GNode             *g_node,
@@ -275,151 +265,6 @@ static void            gbf_mkfile_projec
 						     GParamSpec        *pspec);
 
 /*
- * URI and path manipulation functions -----------------------------
- */
-
-static gboolean 
-uri_is_equal (const gchar *uri1,
-	      const gchar *uri2)
-{
-	gboolean retval = FALSE;
-	GnomeVFSURI *vfs_uri1, *vfs_uri2;
-
-	vfs_uri1 = gnome_vfs_uri_new (uri1);
-	vfs_uri2 = gnome_vfs_uri_new (uri2);
-	if (vfs_uri1 != NULL && vfs_uri2 != NULL)
-		retval = gnome_vfs_uri_equal (vfs_uri1, vfs_uri2);
-	gnome_vfs_uri_unref (vfs_uri1);
-	gnome_vfs_uri_unref (vfs_uri2);
-
-	return retval;
-}
-
-static gboolean 
-uri_is_parent (const gchar *parent_uri,
-	       const gchar *child_uri)
-{
-	gboolean retval = FALSE;
-	GnomeVFSURI *parent, *child;
-
-	parent = gnome_vfs_uri_new (parent_uri);
-	child = gnome_vfs_uri_new (child_uri);
-	if (parent != NULL && child != NULL)
-		retval = gnome_vfs_uri_is_parent (parent, child, TRUE);
-	gnome_vfs_uri_unref (parent);
-	gnome_vfs_uri_unref (child);
-
-	return retval;
-}
-
-static gboolean
-uri_is_local_path (const gchar *uri)
-{
-	const gchar *p;
-	
-	for (p = uri;
-	     g_ascii_isalnum (*p) || *p == '+' || *p == '-' || *p == '.';
-	     p++)
-		;
-
-	if (*p == ':')
-		return FALSE;
-	else
-		return TRUE;
-}
-
-static gchar *
-uri_to_path (const gchar *uri)
-{
-	return gnome_vfs_get_local_path_from_uri (uri);
-}
-
-static gchar *
-uri_normalize (const gchar *uri, const gchar *base_uri)
-{
-	gchar *normalized_uri = NULL;
-
-	if (uri_is_local_path (uri)) {
-		gchar *absolute_path;
-		
-		absolute_path = gnome_vfs_expand_initial_tilde (uri);
-		if (!g_path_is_absolute (uri)) {
-			gchar *tmp = absolute_path;
-			gchar *base_dir;
-			if (base_uri != NULL)
-				base_dir = uri_to_path (base_uri);
-			else
-				base_dir = g_get_current_dir ();
-
-			absolute_path = g_build_filename (base_dir, tmp, NULL);
-			g_free (base_dir);
-			g_free (tmp);
-		}
-		normalized_uri = gnome_vfs_make_uri_canonical (absolute_path);
-		g_free (absolute_path);
-	} else {
-		GnomeVFSURI *vfs_uri;
-
-		vfs_uri = gnome_vfs_uri_new (uri);
-		/* FIXME: this should probably check that the method is file: */
-		if (gnome_vfs_uri_is_local (vfs_uri))
-			normalized_uri = gnome_vfs_make_uri_canonical (uri);
-		gnome_vfs_uri_unref (vfs_uri);
-	}
-
-	/* strip trailing slash */
-	if (normalized_uri) {
-		gint length = strlen (normalized_uri);
-		gchar *p;
-		if (length > 0) {
-			p = normalized_uri + length - 1;
-			if (*p == '/')
-				*p = '\0';
-		}
-	}
-
-	return normalized_uri;
-}
-
-/**
- * uri_get_chrooted_path:
- * @root_uri: the root uri (or NULL)
- * @uri: the uri which must be inside @root_uri for which the
- * root-changed path is wanted
- *
- * E.g.: uri_get_chrooted_path ("file:///foo/bar", "file:///foo/bar/baz/winkle") -> "/baz/winkle"
- *
- * Return value: a newly allocated chrooted path
- **/
-static gchar *
-uri_get_chrooted_path (const gchar *root_uri, const gchar *uri)
-{
-	gchar *root_path, *path;
-	gint root_length;
-	gchar *retval = NULL;
-	
-	path = uri_to_path (uri);
-	if (root_uri == NULL)
-		return path;
-	
-	root_path = uri_to_path (root_uri);
-	
-	root_length = strlen (root_path);
-	if (strncmp (root_path, path, root_length) == 0) {
-		/* check for trailing path separator in root... we need it to
-		 * make the returned path absolute */
-		if (root_path [root_length - 1] == '/')
-			root_length--;
-		retval = g_strdup (path + root_length);
-	}
-
-	g_free (root_path);
-	g_free (path);
-	
-	return retval;
-}
-
-/*
  * Project modification functions -----------------------------
  */
 
@@ -432,7 +277,7 @@ xml_new_source_node (GbfMkfileProject *p
 	gchar *filename;
 	
 	source = xmlNewDocNode (doc, NULL, BAD_CAST("source"), NULL);
-	filename = uri_get_chrooted_path (project->project_root_uri, uri);
+	filename = gbf_uri_get_chrooted_path (project->project_root_uri, uri);
 	xmlSetProp (source, BAD_CAST("uri"), BAD_CAST(filename));
 	g_free (filename);
 	
@@ -753,7 +598,7 @@ xml_new_change_doc (GbfMkfileProject *pr
 	doc = xmlNewDoc (BAD_CAST("1.0"));
 	if (doc != NULL) {
 		gchar *root_path;
-		root_path = uri_to_path (project->project_root_uri);
+		root_path = gbf_uri_to_path (project->project_root_uri);
 		doc->children = xmlNewDocNode (doc, NULL, BAD_CAST("project"), NULL);
 		xmlSetProp (doc->children, BAD_CAST("root"), BAD_CAST(root_path));
 		g_free (root_path);
@@ -769,19 +614,19 @@ xml_new_change_doc (GbfMkfileProject *pr
  */
 
 static void
-monitor_cb (GnomeVFSMonitorHandle   *handle,
-	    const gchar             *monitor_uri,
-	    const gchar             *info_uri,
-	    GnomeVFSMonitorEventType event_type,
-	    gpointer                 data)
+monitor_cb (GFileMonitor      *monitor,
+	    GFile             *file,
+	    GFile             *other_file,
+	    GFileMonitorEvent  event_type,
+	    gpointer           data)
 {
 	GbfMkfileProject *project = data;
 
 	g_return_if_fail (project != NULL && GBF_IS_MKFILE_PROJECT (project));
 
 	switch (event_type) {
-		case GNOME_VFS_MONITOR_EVENT_CHANGED:
-		case GNOME_VFS_MONITOR_EVENT_DELETED:
+		case G_FILE_MONITOR_EVENT_CHANGED:
+		case G_FILE_MONITOR_EVENT_DELETED:
 			/* monitor will be removed here... is this safe? */
 			DEBUG (g_message ("File changed"));
 			project_reload (project, NULL);
@@ -795,8 +640,7 @@ monitor_cb (GnomeVFSMonitorHandle   *han
 static void
 monitor_add (GbfMkfileProject *project, const gchar *uri)
 {
-	GnomeVFSMonitorHandle *handle = NULL;
-	GnomeVFSResult result;
+	GFileMonitor *monitor;
 
 	g_return_if_fail (project != NULL);
 	g_return_if_fail (project->monitors != NULL);
@@ -804,27 +648,32 @@ monitor_add (GbfMkfileProject *project, 
 	if (!uri)
 		return;
 	
-	handle = g_hash_table_lookup (project->monitors, uri);
-	if (!handle) {
-		GnomeVFSURI *vfs_uri;
+	monitor = g_hash_table_lookup (project->monitors, uri);
+	if (!monitor) {
+		GFile *file;
 		gboolean exists;
+		GError *error = NULL;
 		
-		vfs_uri = gnome_vfs_uri_new (uri);
-		exists = gnome_vfs_uri_exists (vfs_uri);
-		gnome_vfs_uri_unref (vfs_uri);
+		file = g_file_new_for_commandline_arg (uri);
+		exists = g_file_query_exists (file, NULL);
 
 		if (exists) {
-			result = gnome_vfs_monitor_add (&handle,
-							uri,
-							GNOME_VFS_MONITOR_FILE,
-							monitor_cb,
-							project);
-			if (result == GNOME_VFS_OK) {
+			monitor = g_file_monitor_file (file,
+						       0, NULL, &error);
+			if (!error) {
 				g_hash_table_insert (project->monitors,
 						     g_strdup (uri),
-						     handle);
+						     monitor);
+				g_signal_connect (monitor, "changed",
+						  G_CALLBACK (monitor_cb),
+						  project);
+			} else {
+				g_warning ("Error monitoring file: %s", error->message);
+				g_error_free (error);
 			}
 		}
+
+		g_object_unref (file);
 	}
 }
 
@@ -858,7 +707,7 @@ monitors_setup (GbfMkfileProject *projec
 	
 	/* setup monitors hash */
 	project->monitors = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
-						   (GDestroyNotify) gnome_vfs_monitor_cancel);
+						   (GDestroyNotify) g_file_monitor_cancel);
 
 	monitor_add (project, project->project_file);
 	g_hash_table_foreach (project->groups, group_hash_foreach_monitor, project);
@@ -2102,7 +1951,7 @@ project_reload (GbfMkfileProject *projec
 	gboolean retval;
 	gint i;
 	
-	project_path = uri_to_path (project->project_root_uri);
+	project_path = gbf_uri_to_path (project->project_root_uri);
 		
 	i = 0;
 	argv [i++] = GBF_MKFILE_PARSE;
@@ -2524,7 +2373,7 @@ impl_load (GbfProject  *_project,
 		return;
 	
 	/* check that the uri is in the filesystem */
-	project->project_root_uri = uri_normalize (uri, NULL);
+	project->project_root_uri = gbf_uri_normalize (uri, NULL);
 	if (project->project_root_uri == NULL) {
 		error_set (error, GBF_PROJECT_ERROR_DOESNT_EXIST,
 			   _("Invalid or remote path (only local paths supported)"));
@@ -2532,7 +2381,7 @@ impl_load (GbfProject  *_project,
 	}
 		
 	/* some basic checks */
-	root_path = uri_to_path (project->project_root_uri);
+	root_path = gbf_uri_to_path (project->project_root_uri);
 	if (root_path == NULL || !g_file_test (root_path, G_FILE_TEST_IS_DIR)) {
 		error_set (error, GBF_PROJECT_ERROR_DOESNT_EXIST,
 			   _("Project doesn't exist or invalid path"));
@@ -2575,9 +2424,9 @@ impl_probe (GbfProject  *_project,
 	
 	g_return_val_if_fail (GBF_IS_MKFILE_PROJECT (_project), FALSE);
 
-	normalized_uri = uri_normalize (path, NULL);
+	normalized_uri = gbf_uri_normalize (path, NULL);
 	if (normalized_uri != NULL) {
-		root_path = uri_to_path (normalized_uri);
+		root_path = gbf_uri_to_path (normalized_uri);
 		if (root_path != NULL && g_file_test (root_path, G_FILE_TEST_IS_DIR)) {
 			retval = ((file_exists (root_path, "Makefile") ||
 					   file_exists (root_path, "makefile")) &&
@@ -3229,13 +3078,13 @@ impl_add_source (GbfProject  *_project,
 	/* if the uri is relative, resolve it against the target's
 	 * group directory; we need to compute the group's uri
 	 * first */
-	group_uri = uri_normalize (g_path_skip_root (GBF_MKFILE_NODE (g_node->parent)->id),
+	group_uri = gbf_uri_normalize (g_path_skip_root (GBF_MKFILE_NODE (g_node->parent)->id),
 				   project->project_root_uri);
-	full_uri = uri_normalize (uri, group_uri);
+	full_uri = gbf_uri_normalize (uri, group_uri);
 	g_free (group_uri);
 	
 	/* Check that the source uri is inside the project root */
-	if (!uri_is_parent (project->project_root_uri, full_uri)) {
+	if (!gbf_uri_is_parent (project->project_root_uri, full_uri)) {
 		error_set (error, GBF_PROJECT_ERROR_DOESNT_EXIST,
 			   _("Source file must be inside the project directory"));
 		abort_action = TRUE;
@@ -3247,7 +3096,7 @@ impl_add_source (GbfProject  *_project,
 		GbfMkfileNode *node = GBF_MKFILE_NODE (iter_node);
 		
 		if (node->type == GBF_MKFILE_NODE_SOURCE &&
-		    uri_is_equal (full_uri, node->uri)) {
+		    gbf_uri_is_equal (full_uri, node->uri)) {
 			error_set (error, GBF_PROJECT_ERROR_DOESNT_EXIST,
 				   _("Source is already in target"));
 			abort_action = TRUE;
Index: src/gbf/gbf-string-utils.c
===================================================================
--- src/gbf/gbf-string-utils.c	(revision 0)
+++ src/gbf/gbf-string-utils.c	(revision 0)
@@ -0,0 +1,388 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8; coding: utf-8 -*- */
+/* gbf-mkfile-project.c
+ *
+ * Copyright (C) 2005  Eric Greveson
+ * Copyright (C) 2008  Cosimo Cecchi <cosimoc@gnome.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Eric Greveson
+ * Based on the Autotools GBF backend (libgbf-am) by
+ *   JP Rosevear
+ *   Dave Camp
+ *   Naba Kumar
+ *   Gustavo Giráldez
+ */
+ 
+#include <glib.h>
+#include <gio/gio.h>
+#include <string.h>
+#include <pwd.h>
+#include "gbf-string-utils.h"
+
+/*
+ * URI and path manipulation functions -----------------------------
+ */
+
+gboolean 
+gbf_uri_is_equal (const gchar *uri1,
+		  const gchar *uri2)
+{
+	gboolean retval;
+	GFile *file1;
+	GFile *file2;
+
+	file1 = g_file_new_for_commandline_arg (uri1);
+	file2 = g_file_new_for_commandline_arg (uri2);
+
+	retval = g_file_equal (file1, file2);
+
+	g_object_unref (file1);
+	g_object_unref (file2);
+
+	return retval;
+}
+
+gboolean 
+gbf_uri_is_parent (const gchar *parent_uri,
+		   const gchar *child_uri)
+{
+	gboolean retval;
+	GFile *parent;
+	GFile *child;
+
+	parent = g_file_new_for_commandline_arg (parent_uri);
+	child = g_file_new_for_commandline_arg (child_uri);
+
+	retval = g_file_has_prefix (child, parent);
+
+	g_object_unref (parent);
+	g_object_unref (child);
+
+	return retval;
+}
+
+gboolean
+gbf_uri_is_local_path (const gchar *uri)
+{
+	const gchar *p;
+	
+	for (p = uri;
+	     g_ascii_isalnum (*p) || *p == '+' || *p == '-' || *p == '.';
+	     p++)
+		;
+
+	if (*p == ':')
+		return FALSE;
+	else
+		return TRUE;
+}
+
+gchar *
+gbf_uri_to_path (const gchar *uri)
+{
+	GFile *file = g_file_new_for_commandline_arg (uri);
+	char *path = g_file_get_path (file);
+
+	g_object_unref (file);
+
+	return path;
+}
+
+/* Following code copied from gnome-vfs-private-utils.c */
+
+static int
+find_next_slash (const char *path, int current_offset)
+{
+	const char *match;
+	
+	g_assert (current_offset <= strlen (path));
+	
+	match = strchr (path + current_offset, G_DIR_SEPARATOR);
+	return match == NULL ? -1 : match - path;
+}
+
+static int
+find_slash_before_offset (const char *path, int to)
+{
+	int result;
+	int next_offset;
+
+	result = -1;
+	next_offset = 0;
+	for (;;) {
+		next_offset = find_next_slash (path, next_offset);
+		if (next_offset < 0 || next_offset >= to) {
+			break;
+		}
+		result = next_offset;
+		next_offset++;
+	}
+	return result;
+}
+
+static void
+collapse_slash_runs (char *path, int from_offset)
+{
+	int i;
+	/* Collapse multiple `/'s in a row. */
+	for (i = from_offset;; i++) {
+		if (path[i] != G_DIR_SEPARATOR) {
+			break;
+		}
+	}
+
+	if (from_offset < i) {
+		memmove (path + from_offset, path + i, strlen (path + i) + 1);
+		i = from_offset + 1;
+	}
+}
+
+/* Canonicalize path, and return a new path.  Do everything in situ.  The new
+   path differs from path in:
+
+     Multiple `/'s are collapsed to a single `/'.
+     Leading `./'s and trailing `/.'s are removed.
+     Non-leading `../'s and trailing `..'s are handled by removing
+     portions of the path.  */
+static char *
+canonicalize_pathname (const char *cpath)
+{
+	char *path;
+	int i, marker;
+	
+	path = g_strdup (cpath);
+
+	if (path == NULL || strlen (path) == 0) {
+		return "";
+	}
+
+	/* Walk along path looking for things to compact. */
+	for (i = 0, marker = 0;;) {
+		if (!path[i])
+			break;
+
+		/* Check for `../', `./' or trailing `.' by itself. */
+		if (path[i] == '.') {
+			/* Handle trailing `.' by itself. */
+			if (path[i + 1] == '\0') {
+				if (i > 1 && path[i - 1] == G_DIR_SEPARATOR) {
+					/* strip the trailing /. */
+					path[i - 1] = '\0';
+				} else {
+					/* convert path "/." to "/" */
+					path[i] = '\0';
+				}
+				break;
+			}
+
+			/* Handle `./'. */
+			if (path[i + 1] == G_DIR_SEPARATOR) {
+				memmove (path + i, path + i + 2, 
+					 strlen (path + i + 2) + 1);
+				if (i == 0) {
+					/* don't leave leading '/' for paths that started
+					 * as relative (.//foo)
+					 */
+					collapse_slash_runs (path, i);
+					marker = 0;
+				}
+				continue;
+			}
+
+			/* Handle `../' or trailing `..' by itself. 
+			 * Remove the previous xxx/ part 
+			 */
+			if (path[i + 1] == '.'
+			    && (path[i + 2] == G_DIR_SEPARATOR
+				|| path[i + 2] == '\0')) {
+
+				/* ignore ../ at the beginning of a path */
+				if (i != 0) {
+					marker = find_slash_before_offset (path, i - 1);
+
+					/* Either advance past '/' or point to the first character */
+					marker ++;
+					if (path [i + 2] == '\0' && marker > 1) {
+						/* If we are looking at a /.. at the end of the uri and we
+						 * need to eat the last '/' too.
+						 */
+						 marker--;
+					}
+					g_assert(marker < i);
+					
+					if (path[i + 2] == G_DIR_SEPARATOR) {
+						/* strip the entire ../ string */
+						i++;
+					}
+
+					memmove (path + marker, path + i + 2,
+						 strlen (path + i + 2) + 1);
+					i = marker;
+				} else {
+					i = 2;
+					if (path[i] == G_DIR_SEPARATOR) {
+						i++;
+					}
+				}
+				collapse_slash_runs (path, i);
+				continue;
+			}
+		}
+		
+		/* advance to the next '/' */
+		i = find_next_slash (path, i);
+
+		/* If we didn't find any slashes, then there is nothing left to do. */
+		if (i < 0) {
+			break;
+		}
+
+		marker = i++;
+		collapse_slash_runs (path, i);
+	}
+	return path;
+}
+
+/* copied from epiphany/lib/ephy-string.c */
+
+static char *
+expand_initial_tilde (const char *path)
+{
+        char *slash_after_user_name, *user_name;
+        struct passwd *passwd_file_entry;
+
+        g_return_val_if_fail (path != NULL, NULL);
+
+        if (path[0] != '~') {
+                return g_strdup (path);
+        }
+
+        if (path[1] == '/' || path[1] == '\0') {
+                return g_strconcat (g_get_home_dir (), &path[1], NULL);
+        }
+
+        slash_after_user_name = strchr (&path[1], '/');
+        if (slash_after_user_name == NULL) {
+                user_name = g_strdup (&path[1]);
+        } else {
+                user_name = g_strndup (&path[1],
+                                       slash_after_user_name - &path[1]);
+        }
+        passwd_file_entry = getpwnam (user_name);
+        g_free (user_name);
+
+        if (passwd_file_entry == NULL || passwd_file_entry->pw_dir == NULL) {
+                return g_strdup (path);
+        }
+
+        return g_strconcat (passwd_file_entry->pw_dir,
+                            slash_after_user_name,
+                            NULL);
+}
+
+/* end of copied code */
+
+gchar *
+gbf_uri_normalize (const gchar *uri, const gchar *base_uri)
+{
+	gchar *normalized_uri = NULL;
+
+	if (gbf_uri_is_local_path (uri)) {
+		gchar *absolute_path;
+		
+		absolute_path = expand_initial_tilde (uri);
+		if (!g_path_is_absolute (uri)) {
+			gchar *tmp = absolute_path;
+			gchar *base_dir;
+			if (base_uri != NULL)
+				base_dir = gbf_uri_to_path (base_uri);
+			else
+				base_dir = g_get_current_dir ();
+
+			absolute_path = g_build_filename (base_dir, tmp, NULL);
+			g_free (base_dir);
+			g_free (tmp);
+		}
+		normalized_uri = canonicalize_pathname (absolute_path);
+		g_free (absolute_path);
+	} else {
+		if (g_str_has_prefix (uri, "file://")) {
+			/* move after it */
+			const char *path;
+			char *normalized_path;
+			if (strlen (uri) > 6) {
+				path = uri + 7;
+				normalized_path = canonicalize_pathname (path);
+				normalized_uri = g_strconcat ("file://",
+							      normalized_path, NULL);
+				g_free (normalized_path);
+			}
+		}
+	}
+
+	/* strip trailing slash */
+	if (normalized_uri) {
+		gint length = strlen (normalized_uri);
+		gchar *p;
+		if (length > 0) {
+			p = normalized_uri + length - 1;
+			if (*p == '/')
+				*p = '\0';
+		}
+	}
+
+	return normalized_uri;
+}
+
+/**
+ * gbf_uri_get_chrooted_path:
+ * @root_uri: the root uri (or NULL)
+ * @uri: the uri which must be inside @root_uri for which the
+ * root-changed path is wanted
+ *
+ * E.g.: uri_get_chrooted_path ("file:///foo/bar", "file:///foo/bar/baz/winkle") -> "/baz/winkle"
+ *
+ * Return value: a newly allocated chrooted path
+ **/
+gchar *
+gbf_uri_get_chrooted_path (const gchar *root_uri, const gchar *uri)
+{
+	gchar *root_path, *path;
+	gint root_length;
+	gchar *retval = NULL;
+	
+	path = gbf_uri_to_path (uri);
+	if (root_uri == NULL)
+		return path;
+	
+	root_path = gbf_uri_to_path (root_uri);
+	
+	root_length = strlen (root_path);
+	if (strncmp (root_path, path, root_length) == 0) {
+		/* check for trailing path separator in root... we need it to
+		 * make the returned path absolute */
+		if (root_path [root_length - 1] == '/')
+			root_length--;
+		retval = g_strdup (path + root_length);
+	}
+
+	g_free (root_path);
+	g_free (path);
+	
+	return retval;
+}
+
Index: src/gbf/gbf-string-utils.h
===================================================================
--- src/gbf/gbf-string-utils.h	(revision 0)
+++ src/gbf/gbf-string-utils.h	(revision 0)
@@ -0,0 +1,51 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8; coding: utf-8 -*- */
+/* gbf-mkfile-project.c
+ *
+ * Copyright (C) 2005  Eric Greveson
+ * Copyright (C) 2008  Cosimo Cecchi <cosimoc@gnome.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Eric Greveson
+ * Based on the Autotools GBF backend (libgbf-am) by
+ *   JP Rosevear
+ *   Dave Camp
+ *   Naba Kumar
+ *   Gustavo Giráldez
+ */
+
+#ifndef __GBF_STRING_UTILS_H__
+#define __GBF_STRING_UTILS_H__
+ 
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+gboolean gbf_uri_is_equal          (const gchar *uri1,
+				    const gchar *uri2);
+gboolean gbf_uri_is_parent         (const gchar *parent_uri,
+				    const gchar *child_uri);
+gboolean gbf_uri_is_local_path     (const gchar *uri);
+gchar *  gbf_uri_to_path           (const gchar *uri);
+gchar *  gbf_uri_normalize         (const gchar *uri,
+				    const gchar *base_uri);
+gchar *  gbf_uri_get_chrooted_path (const gchar *root_uri,
+				    const gchar *uri);
+
+G_END_DECLS
+
+#endif /* __GBF_STRING_UTILS_H__ */
+
Index: src/gbf/test-project-view.c
===================================================================
--- src/gbf/test-project-view.c	(revision 577)
+++ src/gbf/test-project-view.c	(working copy)
@@ -312,7 +312,7 @@ main (int argc, char *argv[])
 			    GNOME_PARAM_NONE);
 
 	if (!bonobo_init (&argc, argv))
-		g_error (_("Can't initialize bonobo!"));
+		g_error ("%s", _("Can't initialize bonobo!"));
 
 	app = GTK_WIDGET (create_window ());
     
Index: src/gbf/gbf-project-util.c
===================================================================
--- src/gbf/gbf-project-util.c	(revision 577)
+++ src/gbf/gbf-project-util.c	(working copy)
@@ -81,7 +81,7 @@ load_interface (const gchar *top_widget)
     xml = glade_xml_new (GLADE_FILE, top_widget, GETTEXT_PACKAGE);
 
     if (!xml) {
-        g_warning (_("Couldn't load glade file"));
+        g_warning ("%s", _("Couldn't load glade file"));
         return NULL;
     }
     
@@ -166,7 +166,7 @@ error_dialog (GtkWindow *parent, const g
 						 GTK_DIALOG_DESTROY_WITH_PARENT,
 						 GTK_MESSAGE_ERROR,
 						 GTK_BUTTONS_OK,
-						 message);
+						 "%s", message);
     g_free (tmp);
     g_free (message);
     
Index: src/gbf/Makefile.am
===================================================================
--- src/gbf/Makefile.am	(revision 577)
+++ src/gbf/Makefile.am	(working copy)
@@ -18,6 +18,8 @@ libgbf_1_la_SOURCES =		\
 	glue-plugin.c		\
 	gbf-i18n.h		\
 	gbf-i18n.c		\
+	gbf-string-utils.h	\
+	gbf-string-utils.c	\
 	gbf-project.h		\
 	gbf-project.c		\
 	gbf-backend.h		\
