gedit r6304 - branches/gnome-2-22/plugins/filebrowser



Author: pborelli
Date: Tue May 27 12:03:55 2008
New Revision: 6304
URL: http://svn.gnome.org/viewvc/gedit?rev=6304&view=rev

Log:
revert filebrowser plugin chnages that should have never been on this branch


Modified:
   branches/gnome-2-22/plugins/filebrowser/gedit-file-bookmarks-store.c
   branches/gnome-2-22/plugins/filebrowser/gedit-file-bookmarks-store.h
   branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-marshal.list
   branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-plugin.c
   branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-store.c
   branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-store.h
   branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-utils.c
   branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-utils.h
   branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-view.c
   branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-widget.c
   branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-widget.h

Modified: branches/gnome-2-22/plugins/filebrowser/gedit-file-bookmarks-store.c
==============================================================================
--- branches/gnome-2-22/plugins/filebrowser/gedit-file-bookmarks-store.c	(original)
+++ branches/gnome-2-22/plugins/filebrowser/gedit-file-bookmarks-store.c	Tue May 27 12:03:55 2008
@@ -21,7 +21,7 @@
 
 #include <string.h>
 #include <glib/gi18n.h>
-#include <gio/gio.h>
+#include <libgnomevfs/gnome-vfs.h>
 #include <gedit/gedit-utils.h>
 #include <gedit/gedit-plugin.h>
 
@@ -34,23 +34,24 @@
 
 struct _GeditFileBookmarksStorePrivate 
 {
-	GVolumeMonitor * volume_monitor;
-	GFileMonitor * bookmarks_monitor;
+	GnomeVFSVolumeMonitor *volume_monitor;
+	GnomeVFSMonitorHandle *bookmarks_monitor;
 };
 
 static void remove_node               (GtkTreeModel * model, 
-                                       GtkTreeIter * iter);
+                                       GtkTreeIter * iter,
+                                       gboolean fromtree);
 
-static void on_mount_added            (GVolumeMonitor * monitor,
-                                       GMount * mount,
+static void on_volume_mounted         (GnomeVFSVolumeMonitor * monitor,
+                                       GnomeVFSVolume * volume,
                                        GeditFileBookmarksStore * model);
-static void on_mount_removed          (GVolumeMonitor * monitor,
-                                       GMount * mount,
+static void on_volume_unmounted       (GnomeVFSVolumeMonitor * monitor,
+                                       GnomeVFSVolume * volume,
                                        GeditFileBookmarksStore * model);
-static void on_bookmarks_file_changed (GFileMonitor * monitor,
-				       GFile * file,
-				       GFile * other_file,
-				       GFileMonitorEvent event_type,
+static void on_bookmarks_file_changed (GnomeVFSMonitorHandle * handle,
+				       gchar const *monitor_uri,
+				       gchar const *info_uri,
+				       GnomeVFSMonitorEventType event_type,
 				       GeditFileBookmarksStore * model);
 static gboolean find_with_flags       (GtkTreeModel * model, 
                                        GtkTreeIter * iter,
@@ -67,24 +68,36 @@
 
 	if (obj->priv->volume_monitor != NULL) {
 		g_signal_handlers_disconnect_by_func (obj->priv->volume_monitor,
-						      on_mount_added,
+						      on_volume_mounted,
 						      obj);
 		g_signal_handlers_disconnect_by_func (obj->priv->volume_monitor,
-						      on_mount_removed,
+						      on_volume_unmounted,
 						      obj);
-		g_object_unref (obj->priv->volume_monitor);
+		obj->priv->volume_monitor = NULL;
 	}
 
 	if (obj->priv->bookmarks_monitor != NULL) {
-		g_object_unref (obj->priv->bookmarks_monitor);
+		gnome_vfs_monitor_cancel (obj->priv->bookmarks_monitor);
 	}
 
 	G_OBJECT_CLASS (gedit_file_bookmarks_store_parent_class)->dispose (object);
 }
 
+static gboolean
+foreach_remove_node (GtkTreeModel * model, GtkTreePath * path,
+		     GtkTreeIter * iter, gpointer user_data)
+{
+	remove_node (model, iter, FALSE);
+	return FALSE;
+}
+
 static void
 gedit_file_bookmarks_store_finalize (GObject * object)
 {
+	GeditFileBookmarksStore *obj = GEDIT_FILE_BOOKMARKS_STORE (object);
+
+	gtk_tree_model_foreach (GTK_TREE_MODEL (obj), foreach_remove_node, NULL);
+
 	G_OBJECT_CLASS (gedit_file_bookmarks_store_parent_class)->finalize (object);
 }
 
@@ -106,6 +119,13 @@
 }
 
 /* Private */
+static GdkPixbuf *
+pixbuf_from_stock (const gchar * stock)
+{
+	return gedit_file_browser_utils_pixbuf_from_theme(stock, 
+	                                                  GTK_ICON_SIZE_MENU);
+}
+
 static void
 add_node (GeditFileBookmarksStore * model, GdkPixbuf * pixbuf,
 	  gchar const *name, gpointer obj, guint flags, GtkTreeIter * iter)
@@ -126,219 +146,236 @@
 }
 
 static gboolean
-add_file (GeditFileBookmarksStore * model, GFile * file,
-	  gchar const * name, guint flags, GtkTreeIter * iter)
+add_uri (GeditFileBookmarksStore * model, const gchar * uri,
+	 gchar * name, guint flags, GtkTreeIter * iter)
 {
-	GdkPixbuf * pixbuf = NULL;
-	gboolean native;
-	gchar * newname;
+	GnomeVFSURI *vfs_uri;
+	GdkPixbuf *pixbuf = NULL;
+	gchar *mime;
+	gchar *path;
+	gchar *tmp;
+	gboolean free_name = FALSE;
+	gboolean local;
 
-	native = g_file_is_native (file);
+	vfs_uri = gnome_vfs_uri_new (uri);
+	if (vfs_uri == NULL)
+		return FALSE;
+
+	path = gnome_vfs_uri_to_string (vfs_uri, GNOME_VFS_URI_HIDE_NONE);
+	local = gedit_utils_uri_has_file_scheme (path);
 
-	if (native && !g_file_query_exists (file, NULL)) {
+	if (local && !gnome_vfs_uri_exists (vfs_uri)) {
+		gnome_vfs_uri_unref (vfs_uri);
+		g_free (path);
 		return FALSE;
 	}
 
 	if (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_HOME)
-		pixbuf = gedit_file_browser_utils_pixbuf_from_theme ("gnome-fs-home", GTK_ICON_SIZE_MENU);
+		pixbuf = pixbuf_from_stock ("gnome-fs-home");
 	else if (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_DESKTOP)
-		pixbuf = gedit_file_browser_utils_pixbuf_from_theme ("gnome-fs-desktop", GTK_ICON_SIZE_MENU);
-	else if (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_ROOT)
-		pixbuf = gedit_file_browser_utils_pixbuf_from_theme ("drive-harddisk", GTK_ICON_SIZE_MENU);
+		pixbuf = pixbuf_from_stock ("gnome-fs-desktop");
 
 	if (pixbuf == NULL) {
-		pixbuf = gedit_file_browser_utils_pixbuf_from_file (file, GTK_ICON_SIZE_MENU);
+		if (local)
+			mime = gnome_vfs_get_mime_type (path);
+		else
+			mime = g_strdup ("x-directory/normal");
+
+		pixbuf = gedit_file_browser_utils_pixbuf_from_mime_type (path, 
+		                                                         mime, 
+		                                                         GTK_ICON_SIZE_MENU);
+		g_free (mime);
 	}
 
+	g_free (path);
+
 	if (name == NULL) {
-		newname = gedit_file_browser_utils_file_basename (file);
-	} else {
-		newname = g_strdup (name);
+		tmp = gedit_file_browser_utils_uri_basename (gnome_vfs_uri_get_path (vfs_uri));
+		
+		if (local)
+			name = tmp;
+		else {
+			/* Translators: this is used in "file on host", e.g. "/foo/bar on ftp.baz.org" */
+			name = g_strconcat(tmp, " ", _("on"), " ", gnome_vfs_uri_get_host_name (vfs_uri), NULL);
+			g_free (tmp);
+		}
+		
+		free_name = TRUE;
 	}
 
-	add_node (model, pixbuf, newname, file, flags, iter);
+	add_node (model, pixbuf, name, vfs_uri, flags, iter);
 
 	if (pixbuf)
 		g_object_unref (pixbuf);
 
-	g_free (newname);
+	if (free_name)
+		g_free (name);
 
 	return TRUE;
 }
 
 static void
-check_mount_separator (GeditFileBookmarksStore * model, guint flags,
-			gboolean added)
-{
-	GtkTreeIter iter;
-	gboolean found;
-
-	found =
-	    find_with_flags (GTK_TREE_MODEL (model), &iter, NULL,
-			     flags |
-			     GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR, 0);
-
-	if (added && !found) {
-		/* Add the separator */
-		add_node (model, NULL, NULL, NULL,
-			  flags | GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR,
-			  NULL);
-	} else if (!added && found) {
-		remove_node (GTK_TREE_MODEL (model), &iter);
-	}
-}
-
-static void
 init_special_directories (GeditFileBookmarksStore * model)
 {
 	gchar const *path;
-	GFile * file;
+	gchar *uri;
 
 	path = g_get_home_dir ();
 	if (path != NULL)
 	{
-		file = g_file_new_for_path (path);
-		add_file (model, file, NULL, GEDIT_FILE_BOOKMARKS_STORE_IS_HOME |
+		uri = gnome_vfs_get_uri_from_local_path (path);
+		add_uri (model, uri, NULL, GEDIT_FILE_BOOKMARKS_STORE_IS_HOME |
 			 GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR, NULL);
-		g_object_unref (file);
+		g_free (uri);
 	}
 
 	path = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
 	if (path != NULL)
 	{
-		file = g_file_new_for_path (path);
-		add_file (model, file, NULL, GEDIT_FILE_BOOKMARKS_STORE_IS_DESKTOP |
-			  GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR, NULL);
-		g_object_unref (file);
+		uri = gnome_vfs_get_uri_from_local_path (path);
+		add_uri (model, uri, NULL, GEDIT_FILE_BOOKMARKS_STORE_IS_DESKTOP |
+			 GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR, NULL);
+		g_free (uri);
 	}
 
 	path = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
 	if (path != NULL)
 	{
-		file = g_file_new_for_path (path);
-		add_file (model, file, NULL, GEDIT_FILE_BOOKMARKS_STORE_IS_DOCUMENTS |
+		uri = gnome_vfs_get_uri_from_local_path (path);
+		add_uri (model, uri, NULL, GEDIT_FILE_BOOKMARKS_STORE_IS_DOCUMENTS |
 			 GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR, NULL);
-		g_object_unref (file);
+		g_free (uri);
 	}
-	
-	file = g_file_new_for_uri ("file:///");
-	add_file (model, file, _("File System"), GEDIT_FILE_BOOKMARKS_STORE_IS_ROOT, NULL);
-	g_object_unref (file);
-	
-	check_mount_separator (model, GEDIT_FILE_BOOKMARKS_STORE_IS_ROOT, TRUE);
 }
 
 static void
-add_mount (GeditFileBookmarksStore * model, GMount * mount,
-	   const gchar * name, guint flags, GtkTreeIter * iter)
+check_volume_separator (GeditFileBookmarksStore * model, guint flags,
+			gboolean added)
 {
-	GdkPixbuf *pixbuf = NULL;
-	GIcon *icon;
+	GtkTreeIter iter;
+	gboolean found;
 
-	icon = g_mount_get_icon (mount);
-	
-	if (icon) {
-		pixbuf = gedit_file_browser_utils_pixbuf_from_icon (icon, GTK_ICON_SIZE_MENU);
-		g_object_unref (icon);
+	found =
+	    find_with_flags (GTK_TREE_MODEL (model), &iter, NULL,
+			     flags |
+			     GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR, 0);
+
+	if (added && !found) {
+		/* Add the separator */
+		add_node (model, NULL, NULL, NULL,
+			  flags | GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR,
+			  NULL);
+	} else if (!added && found) {
+		remove_node (GTK_TREE_MODEL (model), &iter, TRUE);
 	}
+}
+
+static void
+add_volume (GeditFileBookmarksStore * model, GnomeVFSVolume * volume,
+	    const gchar * name, guint flags, GtkTreeIter * iter)
+{
+	GdkPixbuf *pixbuf;
+	gchar *icon;
+
+	icon = gnome_vfs_volume_get_icon (volume);
+	pixbuf = pixbuf_from_stock (icon);
+	g_free (icon);
 
-	add_node (model, pixbuf, name, mount,
-		  flags | GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT, iter);
+	add_node (model, pixbuf, name, volume,
+		  flags | GEDIT_FILE_BOOKMARKS_STORE_IS_VOLUME, iter);
 
 	if (pixbuf)
 		g_object_unref (pixbuf);
 
-	check_mount_separator (model, GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT, TRUE);
+	flags = flags & (GEDIT_FILE_BOOKMARKS_STORE_IS_DRIVE |
+			 GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT |
+			 GEDIT_FILE_BOOKMARKS_STORE_IS_REMOTE_MOUNT);
+
+	if (flags)
+		check_volume_separator (model, flags, TRUE);
 }
 
-static void
-process_mount (GeditFileBookmarksStore * model, GMount * mount,
-		gboolean * isroot)
+static gboolean
+process_volume (GeditFileBookmarksStore * model, GnomeVFSVolume * volume,
+		gboolean * root)
 {
-	guint flags = GEDIT_FILE_BOOKMARKS_STORE_NONE;
-	GFile * root;
-	GFileInfo * info;
-	gchar * name;
-	gboolean local;
+	GnomeVFSVolumeType vtype;
+	guint flags;
+
+	vtype = gnome_vfs_volume_get_volume_type (volume);
+
+	if (gnome_vfs_volume_get_device_type (volume) ==
+	    GNOME_VFS_DEVICE_TYPE_AUDIO_CD)
+		return FALSE;
+
+	if (gnome_vfs_volume_is_user_visible (volume)) {
+		gchar *name;
+
+		if (vtype == GNOME_VFS_VOLUME_TYPE_VFS_MOUNT)
+			flags = GEDIT_FILE_BOOKMARKS_STORE_IS_DRIVE;
+		else if (vtype == GNOME_VFS_VOLUME_TYPE_MOUNTPOINT)
+			flags = GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT;
+		else
+			flags = GEDIT_FILE_BOOKMARKS_STORE_IS_REMOTE_MOUNT;
+
+		name = gnome_vfs_volume_get_display_name (volume);
+
+		add_volume (model, volume, name, flags, NULL);
 
-	root = g_mount_get_root (mount);
-	
-	if (!root)
-		return;
-
-	info = g_file_query_info (root, G_FILE_ATTRIBUTE_ACCESS_CAN_READ, G_FILE_QUERY_INFO_NONE, NULL, NULL);
-
-	/* Is this mount actually readable by the user */
-	if (info && g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ)) {
-		/* Here we set up the flags for the mount */
-		local = g_file_is_native (root);
-		
-		if (local) {
-			flags |= GEDIT_FILE_BOOKMARKS_STORE_IS_LOCAL_MOUNT;
-		} else {
-			flags |= GEDIT_FILE_BOOKMARKS_STORE_IS_REMOTE_MOUNT;
-		}
-		
-		name = g_mount_get_name (mount);
-		add_mount (model, mount, name, flags, NULL);
 		g_free (name);
+	} else if (root && !*root) {
+		gchar *uri;
+
+		uri = gnome_vfs_volume_get_activation_uri (volume);
+
+		if (strcmp (uri, "file:///") == 0) {
+			*root = TRUE;
+
+			add_volume (model, volume, _("File System"),
+				    GEDIT_FILE_BOOKMARKS_STORE_IS_ROOT |
+				    GEDIT_FILE_BOOKMARKS_STORE_IS_DRIVE,
+				    NULL);
+		}
+
+		g_free (uri);
+	} else {
+		return FALSE;
 	}
-	
-	if (info)
-		g_object_unref (info);
-	
-	g_object_unref (root);
+
+	return TRUE;
 }
 
 static void
-init_mounts (GeditFileBookmarksStore * model)
+init_volumes (GeditFileBookmarksStore * model)
 {
-	GList * mounts;
-	GList * item;
+	GList *volumes;
+	GList *item;
+	GnomeVFSVolume *volume;
 	gboolean root = FALSE;
 
 	if (model->priv->volume_monitor == NULL) {
-		model->priv->volume_monitor = g_volume_monitor_get ();
+		model->priv->volume_monitor =
+		    gnome_vfs_get_volume_monitor ();
 
 		/* Connect signals */
 		g_signal_connect (model->priv->volume_monitor,
-				  "mount-added",
-				  G_CALLBACK (on_mount_added), model);
+				  "volume-mounted",
+				  G_CALLBACK (on_volume_mounted), model);
 		g_signal_connect (model->priv->volume_monitor,
-				  "mount-removed",
-				  G_CALLBACK (on_mount_removed), model);
+				  "volume-unmounted",
+				  G_CALLBACK (on_volume_unmounted), model);
 	}
 
-	mounts = g_volume_monitor_get_mounts (model->priv->volume_monitor);
-
-	for (item = mounts; item; item = item->next)
-		process_mount (model, G_MOUNT(item->data), &root);
+	volumes =
+	    gnome_vfs_volume_monitor_get_mounted_volumes (model->priv->
+							  volume_monitor);
 
-	g_list_foreach (mounts, (GFunc)g_object_unref, NULL);
-	g_list_free (mounts);
-}
-
-static gboolean
-add_bookmark (GeditFileBookmarksStore * model, 
-	      gchar const * name,
-	      gchar const * uri)
-{
-	GFile * file;
-	gboolean ret;
-	guint flags = GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK;
-	
-	file = g_file_new_for_uri (uri);
-	
-	if (g_file_is_native (file)) {
-		flags |= GEDIT_FILE_BOOKMARKS_STORE_IS_LOCAL_BOOKMARK;
-	} else {
-		flags |= GEDIT_FILE_BOOKMARKS_STORE_IS_REMOTE_BOOKMARK;
+	for (item = volumes; item; item = item->next) {
+		volume = GNOME_VFS_VOLUME (item->data);
+		process_volume (model, volume, &root);
 	}
 
-	ret = add_file (model, file, name, flags, NULL);
-	g_object_unref (file);
-	
-	return ret;
+	g_list_free (volumes);
 }
 
 static void
@@ -350,7 +387,6 @@
 	gchar **lines;
 	gchar **line;
 	gboolean added = FALSE;
-	GFile * file;
 
 	/* Read the bookmarks file */
 	bookmarks = g_build_filename (g_get_home_dir (),
@@ -365,7 +401,7 @@
 				gchar *pos;
 				gchar *name;
 
-				/* CHECK: is this really utf8? */
+				/* Check, is this really utf8? */
 				pos = g_utf8_strchr (*line, -1, ' ');
 
 				if (pos != NULL) {
@@ -378,7 +414,11 @@
 				/* the bookmarks file should contain valid
 				 * URIs, but paranoia is good */
 				if (gedit_utils_is_valid_uri (*line)) {
-					added |= add_bookmark (model, name, *line);
+					added = add_uri (model,
+							 *line,
+							 name,
+							 GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK,
+							 NULL);
 				}
 			}
 		}
@@ -388,12 +428,11 @@
 
 		/* Add a watch */
 		if (model->priv->bookmarks_monitor == NULL) {
-			file = g_file_new_for_path (bookmarks);
-			model->priv->bookmarks_monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL);
-			g_signal_connect (model->priv->bookmarks_monitor, 
-					  "changed", 
-					  (GCallback)on_bookmarks_file_changed, 
-					  model);
+			gnome_vfs_monitor_add (&model->priv->bookmarks_monitor,
+					       bookmarks,
+					       GNOME_VFS_MONITOR_FILE,
+					       (GnomeVFSMonitorCallback)on_bookmarks_file_changed, 
+					       model);
 		}
 	} else {
 		/* The bookmarks file doesn't exist (which is perfectly fine) */
@@ -414,10 +453,11 @@
 	GEDIT_FILE_BOOKMARKS_STORE_IS_HOME,
 	GEDIT_FILE_BOOKMARKS_STORE_IS_DESKTOP,
 	GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR,
+	GEDIT_FILE_BOOKMARKS_STORE_IS_DRIVE,
 	GEDIT_FILE_BOOKMARKS_STORE_IS_ROOT,
 	GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT,
-	GEDIT_FILE_BOOKMARKS_STORE_IS_LOCAL_MOUNT,
-	GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK,
+	GEDIT_FILE_BOOKMARKS_STORE_IS_REMOTE_MOUNT,
+	GEDIT_FILE_BOOKMARKS_STORE_IS_VOLUME,
 	-1
 };
 
@@ -525,9 +565,8 @@
 {
 	GtkTreeIter child;
 	guint childflags = 0;
- 	GObject * childobj;
- 	gboolean fequal;
-	
+	gpointer childobj;
+
 	if (!gtk_tree_model_get_iter_first (model, &child))
 		return FALSE;
 
@@ -537,13 +576,8 @@
 				    &childobj,
 				    GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS,
 				    &childflags, -1);
-		
-		fequal = (obj == childobj);
-		
-		if (childobj)
-			g_object_unref (childobj);
-		 
-		if ((obj == NULL || fequal) &&
+
+		if ((obj == NULL || childobj == obj) &&
 		    (childflags & flags) == flags
 		    && !(childflags & notflags)) {
 			*iter = child;
@@ -555,23 +589,38 @@
 }
 
 static void
-remove_node (GtkTreeModel * model, GtkTreeIter * iter)
+remove_node (GtkTreeModel * model, GtkTreeIter * iter, gboolean fromtree)
 {
+	gpointer obj;
 	guint flags;
 
 	gtk_tree_model_get (model, iter,
-			    GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &flags,
+			    GEDIT_FILE_BOOKMARKS_STORE_COLUMN_FLAGS,
+			    &flags,
+			    GEDIT_FILE_BOOKMARKS_STORE_COLUMN_OBJECT, &obj,
 			    -1);
 
 	if (!(flags & GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR)) {
-		if (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT) {
-			check_mount_separator (GEDIT_FILE_BOOKMARKS_STORE (model),
-			     		       flags & GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT,
-					       FALSE);
+		if (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_VOLUME) {
+			gnome_vfs_volume_unref (GNOME_VFS_VOLUME (obj));
+
+			if (fromtree)
+				check_volume_separator
+				    (GEDIT_FILE_BOOKMARKS_STORE (model),
+				     flags &
+				     (GEDIT_FILE_BOOKMARKS_STORE_IS_DRIVE |
+				      GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT),
+				     FALSE);
+		} else if ((flags &
+			   GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR) ||
+			   (flags &
+			   GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK)) {
+			gnome_vfs_uri_unref ((GnomeVFSURI *) obj);
 		}
 	}
 
-	gtk_tree_store_remove (GTK_TREE_STORE (model), iter);
+	if (fromtree)
+		gtk_tree_store_remove (GTK_TREE_STORE (model), iter);
 }
 
 static void
@@ -582,7 +631,7 @@
 	while (find_with_flags (GTK_TREE_MODEL (model), &iter, NULL,
 				GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK,
 				0)) {
-		remove_node (GTK_TREE_MODEL (model), &iter);
+		remove_node (GTK_TREE_MODEL (model), &iter, TRUE);
 	}
 }
 
@@ -590,7 +639,7 @@
 initialize_fill (GeditFileBookmarksStore * model)
 {
 	init_special_directories (model);
-	init_mounts (model);
+	init_volumes (model);
 	init_bookmarks (model);
 }
 
@@ -602,7 +651,7 @@
 	GType column_types[] = {
 		GDK_TYPE_PIXBUF,
 		G_TYPE_STRING,
-		G_TYPE_OBJECT,
+		G_TYPE_POINTER,
 		G_TYPE_UINT
 	};
 
@@ -627,11 +676,9 @@
 gedit_file_bookmarks_store_get_uri (GeditFileBookmarksStore * model,
 				    GtkTreeIter * iter)
 {
-	GObject * obj;
-	GFile * file = NULL;
+	gpointer obj;
 	guint flags;
-	gchar * ret = NULL;
-	
+
 	g_return_val_if_fail (GEDIT_IS_FILE_BOOKMARKS_STORE (model), NULL);
 	g_return_val_if_fail (iter != NULL, NULL);
 
@@ -644,70 +691,73 @@
 	if (obj == NULL)
 		return NULL;
 
-	if (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT) {
-		file = g_mount_get_root (G_MOUNT (obj));
-	} else {
-		file = g_object_ref (obj);
-	}
-	
-	g_object_unref (obj);
-	
-	if (file) {
-		ret = g_file_get_uri (file);
-		g_object_unref (file);
+	if (!(flags & GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR)) {
+		if (flags & GEDIT_FILE_BOOKMARKS_STORE_IS_VOLUME) {
+			return
+			    gnome_vfs_volume_get_activation_uri
+			    (GNOME_VFS_VOLUME (obj));
+		} else
+		    if ((flags & GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR)
+			|| (flags &
+			    GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK)) {
+			return gnome_vfs_uri_to_string ((GnomeVFSURI *)
+							obj,
+							GNOME_VFS_URI_HIDE_NONE);
+		}
 	}
-	
-	return ret;
+
+	return NULL;
 }
 
 void
 gedit_file_bookmarks_store_refresh (GeditFileBookmarksStore * model)
 {
+	gtk_tree_model_foreach (GTK_TREE_MODEL (model), foreach_remove_node,
+				NULL);
+
 	gtk_tree_store_clear (GTK_TREE_STORE (model));
 	initialize_fill (model);
 }
 
 /* Signal handlers */
 static void
-on_mount_added (GVolumeMonitor * monitor,
-		GMount * mount,
-		GeditFileBookmarksStore * model)
+on_volume_mounted (GnomeVFSVolumeMonitor * monitor,
+		   GnomeVFSVolume * volume,
+		   GeditFileBookmarksStore * model)
 {
-	process_mount (model, mount, NULL);
+	if (process_volume (model, volume, NULL))
+		gnome_vfs_volume_ref (volume);
 }
 
 static void
-on_mount_removed (GVolumeMonitor * monitor,
-		  GMount * mount,
-		  GeditFileBookmarksStore * model)
+on_volume_unmounted (GnomeVFSVolumeMonitor * monitor,
+		     GnomeVFSVolume * volume,
+		     GeditFileBookmarksStore * model)
 {
 	GtkTreeIter iter;
 
-	/* Find the mount and remove it */
-	if (find_with_flags (GTK_TREE_MODEL (model), &iter, mount,
-			     GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT,
+	/* Find the volume and remove it */
+	if (find_with_flags (GTK_TREE_MODEL (model), &iter, volume,
+			     GEDIT_FILE_BOOKMARKS_STORE_IS_VOLUME,
 			     GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR))
-		remove_node (GTK_TREE_MODEL (model), &iter);
+		remove_node (GTK_TREE_MODEL (model), &iter, TRUE);
 }
 
 static void
-on_bookmarks_file_changed (GFileMonitor * monitor,
-			   GFile * file,
-			   GFile * other_file,
-			   GFileMonitorEvent event_type,
+on_bookmarks_file_changed (GnomeVFSMonitorHandle * handle,
+			   gchar const *monitor_uri, gchar const *info_uri,
+			   GnomeVFSMonitorEventType event_type,
 			   GeditFileBookmarksStore * model)
 {
 	switch (event_type) {
-	case G_FILE_MONITOR_EVENT_CHANGED:
-	case G_FILE_MONITOR_EVENT_CREATED:
-		/* Re-initialize bookmarks */
+	case GNOME_VFS_MONITOR_EVENT_CHANGED:
+	case GNOME_VFS_MONITOR_EVENT_CREATED:
 		remove_bookmarks (model);
 		init_bookmarks (model);
 		break;
-	case G_FILE_MONITOR_EVENT_DELETED: // FIXME: shouldn't we also monitor the directory?
-		/* Remove bookmarks */
+	case GNOME_VFS_MONITOR_EVENT_DELETED:
 		remove_bookmarks (model);
-		g_object_unref (monitor);
+		gnome_vfs_monitor_cancel (handle);
 		model->priv->bookmarks_monitor = NULL;
 		break;
 	default:

Modified: branches/gnome-2-22/plugins/filebrowser/gedit-file-bookmarks-store.h
==============================================================================
--- branches/gnome-2-22/plugins/filebrowser/gedit-file-bookmarks-store.h	(original)
+++ branches/gnome-2-22/plugins/filebrowser/gedit-file-bookmarks-store.h	Tue May 27 12:03:55 2008
@@ -48,19 +48,18 @@
 
 enum 
 {
-	GEDIT_FILE_BOOKMARKS_STORE_NONE            	= 0,
-	GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR   	= 1 << 0,  /* Separator item */
-	GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR 	= 1 << 1,  /* Special user dir */
-	GEDIT_FILE_BOOKMARKS_STORE_IS_HOME         	= 1 << 2,  /* The special Home user directory */
-	GEDIT_FILE_BOOKMARKS_STORE_IS_DESKTOP      	= 1 << 3,  /* The special Desktop user directory */
-	GEDIT_FILE_BOOKMARKS_STORE_IS_DOCUMENTS    	= 1 << 4,  /* The special Documents user directory */
-	GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT        	= 1 << 5,  /* A mount point on file:// */
-	GEDIT_FILE_BOOKMARKS_STORE_IS_REMOTE_MOUNT 	= 1 << 6,  /* A remote mount point (ssh://) */
-	GEDIT_FILE_BOOKMARKS_STORE_IS_LOCAL_MOUNT 	= 1 << 7,  /* A remote mount point (ssh://) */
-	GEDIT_FILE_BOOKMARKS_STORE_IS_ROOT         	= 1 << 8,  /* The root file system (file:///) */
-	GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK     	= 1 << 9,  /* A gtk bookmark */
-	GEDIT_FILE_BOOKMARKS_STORE_IS_REMOTE_BOOKMARK	= 1 << 10, /* A remote gtk bookmark */
-	GEDIT_FILE_BOOKMARKS_STORE_IS_LOCAL_BOOKMARK	= 1 << 11  /* A local gtk bookmark */
+	GEDIT_FILE_BOOKMARKS_STORE_NONE            = 0,
+	GEDIT_FILE_BOOKMARKS_STORE_IS_SEPARATOR    = 1 << 0,
+	GEDIT_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR  = 1 << 1,
+	GEDIT_FILE_BOOKMARKS_STORE_IS_HOME         = 1 << 2,
+	GEDIT_FILE_BOOKMARKS_STORE_IS_DESKTOP      = 1 << 3,
+	GEDIT_FILE_BOOKMARKS_STORE_IS_DOCUMENTS    = 1 << 4,
+	GEDIT_FILE_BOOKMARKS_STORE_IS_VOLUME       = 1 << 5,
+	GEDIT_FILE_BOOKMARKS_STORE_IS_ROOT         = 1 << 6,
+	GEDIT_FILE_BOOKMARKS_STORE_IS_DRIVE        = 1 << 7,
+	GEDIT_FILE_BOOKMARKS_STORE_IS_MOUNT        = 1 << 8,
+	GEDIT_FILE_BOOKMARKS_STORE_IS_REMOTE_MOUNT = 1 << 9,
+	GEDIT_FILE_BOOKMARKS_STORE_IS_BOOKMARK     = 1 << 10
 };
 
 struct _GeditFileBookmarksStore 

Modified: branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-marshal.list
==============================================================================
--- branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-marshal.list	(original)
+++ branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-marshal.list	Tue May 27 12:03:55 2008
@@ -1,4 +1,2 @@
 VOID:UINT,STRING
 BOOL:OBJECT,POINTER
-BOOL:POINTER
-BOOL:VOID

Modified: branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-plugin.c
==============================================================================
--- branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-plugin.c	(original)
+++ branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-plugin.c	Tue May 27 12:03:55 2008
@@ -94,7 +94,8 @@
                                           GList * rows,
                                           GeditWindow * window);
 static gboolean on_confirm_no_trash_cb   (GeditFileBrowserWidget * widget,
-                                          GList * files,
+                                          GeditFileBrowserStore * store,
+                                          GList * rows,
                                           GeditWindow * window);
 static void on_end_loading_cb            (GeditFileBrowserStore      * store,
                                           GtkTreeIter                * iter,
@@ -158,7 +159,7 @@
 	gboolean bookmarks;
 	gboolean remote;
 	GConfClient * client;
-	GFile * file = NULL;
+	GnomeVFSURI * uri = NULL;
 
 	client = gconf_client_get_default ();
 
@@ -187,9 +188,9 @@
 	                                NULL);
 
 	if (root != NULL && *root != '\0') {
-		file = g_file_new_for_uri (root);
+		uri = gnome_vfs_uri_new (root);
 
-		if (!remote && !g_file_is_native (file)) {
+		if (uri == NULL || (!remote && !gedit_utils_uri_has_file_scheme (root))) {
 		} else if (virtual_root != NULL && virtual_root != '\0') {
 			prepare_auto_root(data);
 			gedit_file_browser_widget_set_root_and_virtual_root (data->tree_widget, 
@@ -203,6 +204,9 @@
 		}
 	}
 
+	if (uri)
+		gnome_vfs_uri_unref (uri);
+
 	g_object_unref (client);
 	g_free (root);
 	g_free (virtual_root);
@@ -408,10 +412,9 @@
 set_root_from_doc (GeditFileBrowserPluginData * data,
                    GeditDocument * doc)
 {
-	gchar * uri;
-	gchar * root;
-	GFile * parent;
-	GFile * file;
+	gchar *uri;
+	gchar *root;
+	GnomeVFSURI *guri;
 
 	if (doc == NULL)
 		return;
@@ -420,25 +423,28 @@
 	if (uri == NULL)
 		return;
 
-	file = g_file_new_for_uri (uri);
+	guri = gnome_vfs_uri_new (uri);
 
-	if (file == NULL) {
+	if (guri == NULL) {
 		g_free (uri);
 		return;
 	}
 
-	if ((parent = g_file_get_parent (file))) {
-		g_object_unref (file);
-		file = parent;
+	if (gnome_vfs_uri_has_parent (guri)) {
+		GnomeVFSURI *parent;
+
+		parent = gnome_vfs_uri_get_parent (guri);
+		gnome_vfs_uri_unref (guri);
+		guri = parent;
 	}
 
-	root = g_file_get_uri (file);
+	root = gnome_vfs_uri_to_string (guri, GNOME_VFS_URI_HIDE_NONE);
 
 	gedit_file_browser_widget_set_root (data->tree_widget,
 		                            root,
 		                            TRUE);
 
-	g_object_unref (file);
+	gnome_vfs_uri_unref (guri);
 	g_free (root);
 	g_free (uri);
 }
@@ -487,7 +493,6 @@
 	gchar * wd = NULL;
 	gchar * local;
 	gchar * argv[2];
-	GFile * file;
 
 	GtkTreeIter iter;
 	GeditFileBrowserStore * store;
@@ -509,10 +514,7 @@
 		return;
 
 	terminal = get_terminal ();
-	
-	file = g_file_new_for_uri (wd);
-	local = g_file_get_path (file);
-	g_object_unref (file);
+	local = gnome_vfs_get_local_path_from_uri (wd);
 
 	argv[0] = terminal;
 	argv[1] = NULL;
@@ -535,12 +537,13 @@
 on_selection_changed_cb (GtkTreeSelection *selection,
 			 GeditWindow      *window)
 {
-	GeditFileBrowserPluginData * data;
-	GtkTreeView * tree_view;
-	GtkTreeModel * model;
+	GeditFileBrowserPluginData *data;
+	GtkTreeView *tree_view;
+	GtkTreeModel *model;
 	GtkTreeIter iter;
 	gboolean sensitive;
-	gchar * uri;
+	GnomeVFSURI *guri;
+	gchar *uri;
 
 	data = get_plugin_data (window);
 	
@@ -562,7 +565,13 @@
 				    GEDIT_FILE_BROWSER_STORE_COLUMN_URI, 
 				    &uri, -1);
 
-		sensitive = gedit_utils_uri_has_file_scheme (uri);
+		guri = gnome_vfs_uri_new (uri);
+
+		sensitive = guri != NULL && gedit_utils_uri_has_file_scheme (uri);
+	
+		if (guri)
+			gnome_vfs_uri_unref (guri);
+
 		g_free (uri);
 	}
 
@@ -1099,7 +1108,8 @@
 
 static gboolean
 on_confirm_no_trash_cb (GeditFileBrowserWidget * widget,
-                        GList * files,
+                        GeditFileBrowserStore * store,
+                        GList *paths,
                         GeditWindow * window)
 {
 	gchar *normal;
@@ -1112,8 +1122,8 @@
 
 	message = _("Cannot move file to trash, do you\nwant to delete permanently?");
 
-	if (files->next == NULL) {
-		normal = gedit_file_browser_utils_file_basename (G_FILE (files->data));
+	if (paths->next == NULL) {
+		normal = get_filename_from_path (GTK_TREE_MODEL (store), (GtkTreePath *)(paths->data));
 	    	secondary = g_strdup_printf (_("The file \"%s\" cannot be moved to the trash."), normal);
 		g_free (normal);
 	} else {

Modified: branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-store.c
==============================================================================
--- branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-store.c	(original)
+++ branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-store.c	Tue May 27 12:03:55 2008
@@ -25,7 +25,6 @@
 
 #include <string.h>
 #include <glib/gi18n-lib.h>
-#include <gio/gio.h>
 #include <gedit/gedit-plugin.h>
 #include <gedit/gedit-utils.h>
 
@@ -46,33 +45,25 @@
 
 #define FILE_BROWSER_NODE_DIR(node)		((FileBrowserNodeDir *)(node))
 
-#define DIRECTORY_LOAD_ITEMS_PER_CALLBACK 100
-#define STANDARD_ATTRIBUTE_TYPES G_FILE_ATTRIBUTE_STANDARD_TYPE "," \
-				 G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN "," \
-			 	 G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP "," \
-				 G_FILE_ATTRIBUTE_STANDARD_NAME "," \
-				 G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE
-
 typedef struct _FileBrowserNode    FileBrowserNode;
 typedef struct _FileBrowserNodeDir FileBrowserNodeDir;
-typedef struct _AsyncData	   AsyncData;
 
 typedef gint (*SortFunc) (FileBrowserNode * node1,
 			  FileBrowserNode * node2);
 
-struct _AsyncData
+typedef struct 
 {
-	GeditFileBrowserStore * model;
-	GCancellable * cancellable;
-	gboolean trash;
-	GList * files;
-	GList * iter;
-	gboolean removed;
-};
+	GnomeVFSAsyncHandle *handle;
+	GeditFileBrowserStore *model;
+	gpointer user_data;
+
+	gboolean alive;
+} AsyncHandle;
 
 struct _FileBrowserNode 
 {
-	GFile *file;
+	GnomeVFSURI *uri;
+	gchar *mime_type;
 	guint flags;
 	gchar *name;
 
@@ -89,8 +80,8 @@
 	GSList *children;
 	GHashTable *hidden_file_hash;
 
-	GCancellable *cancellable;
-	GFileMonitor *monitor;
+	GnomeVFSAsyncHandle *load_handle;
+	GnomeVFSMonitorHandle *monitor_handle;
 	GeditFileBrowserStore *model;
 };
 
@@ -111,7 +102,7 @@
 
 static FileBrowserNode *model_find_node 		    (GeditFileBrowserStore *model,
 							     FileBrowserNode *node,
-							     GFile *uri);
+							     GnomeVFSURI *uri);
 static void model_remove_node                               (GeditFileBrowserStore * model,
 							     FileBrowserNode * node, 
 							     GtkTreePath * path,
@@ -174,13 +165,11 @@
 							     gchar * prefix);
 static void model_check_dummy                               (GeditFileBrowserStore * model,
 							     FileBrowserNode * node);
-static void next_files_async 				    (GFileEnumerator * enumerator,
-							     FileBrowserNodeDir * dir);
 
-static void on_directory_monitor_event                      (GFileMonitor * handle,
-							     GFile *monitor_file,
-							     GFile * info_file,
-							     guint event_type,
+static void on_directory_monitor_event                      (GnomeVFSMonitorHandle * handle,
+							     gchar const *monitor_uri,
+							     const gchar * info_uri,
+							     GnomeVFSMonitorEventType event_type,
 							     FileBrowserNode * parent);
 
 GEDIT_PLUGIN_DEFINE_TYPE_WITH_CODE (GeditFileBrowserStore, gedit_file_browser_store,
@@ -205,7 +194,6 @@
 	BEGIN_LOADING,
 	END_LOADING,
 	ERROR,
-	NO_TRASH,
 	NUM_SIGNALS
 };
 
@@ -220,14 +208,8 @@
 	// Free all the nodes
 	file_browser_node_free (obj, obj->priv->root);
 
-	// Cancel any asynchronous operations
 	for (item = obj->priv->async_handles; item; item = item->next)
-	{
-		AsyncData *data = (AsyncData *) (item->data);
-		g_cancellable_cancel (data->cancellable);
-		
-		data->removed = TRUE;
-	}
+		((AsyncHandle *) (item->data))->alive = FALSE;
 
 	g_slist_free (obj->priv->async_handles);
 	G_OBJECT_CLASS (gedit_file_browser_store_parent_class)->
@@ -240,10 +222,11 @@
 {
 	gchar * uri;
 
-	if (node == NULL || !node->file)
+	if (node == NULL || node->uri)
 		g_value_set_string (value, NULL);
 	else {
-		uri = g_file_get_uri (node->file);
+		uri = gnome_vfs_uri_to_string (node->uri, 
+		                               GNOME_VFS_URI_HIDE_NONE);
 		g_value_take_string (value, uri);
 	}
 }
@@ -348,13 +331,6 @@
 					   error), NULL, NULL,
 			  gedit_file_browser_marshal_VOID__UINT_STRING,
 			  G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING);
-	model_signals[NO_TRASH] =
-	    g_signal_new ("no-trash", G_OBJECT_CLASS_TYPE (object_class),
-			  G_SIGNAL_RUN_LAST,
-			  G_STRUCT_OFFSET (GeditFileBrowserStoreClass,
-					   no_trash), g_signal_accumulator_true_handled, NULL,
-			  gedit_file_browser_marshal_BOOL__POINTER,
-			  G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
 
 	g_type_class_add_private (object_class,
 				  sizeof (GeditFileBrowserStorePrivate));
@@ -598,6 +574,7 @@
 				    GValue * value)
 {
 	FileBrowserNode *node;
+	gchar *uri;
 
 	g_return_if_fail (GEDIT_IS_FILE_BROWSER_STORE (tree_model));
 	g_return_if_fail (iter != NULL);
@@ -611,7 +588,14 @@
 
 	switch (column) {
 	case GEDIT_FILE_BROWSER_STORE_COLUMN_URI:
-		set_gvalue_from_node (value, node);
+		if (node->uri == NULL)
+			uri = NULL;
+		else
+			uri =
+			    gnome_vfs_uri_to_string (node->uri,
+						     GNOME_VFS_URI_HIDE_NONE);
+
+		g_value_take_string (value, uri);
 		break;
 	case GEDIT_FILE_BROWSER_STORE_COLUMN_NAME:
 		g_value_set_string (value, node->name);
@@ -1203,14 +1187,14 @@
 				row_deleted (model, path);
 			} else {
 				row_inserted (model, path, &iter);
+
+				model_check_dummy (model, node);
 				gtk_tree_path_next (path);
 			}
 		} else if (old_visible) {
 			gtk_tree_path_next (path);
 		}
 	}
-	
-	model_check_dummy (model, node);
 
 	if (free_path)
 		gtk_tree_path_free (path);
@@ -1227,19 +1211,19 @@
 {
 	g_free (node->name);
 
-	if (node->file) {
-		node->name = gedit_file_browser_utils_file_basename (node->file);
+	if (node->uri) {
+		node->name = gedit_file_browser_utils_uri_basename (gnome_vfs_uri_get_path (node->uri));
 	} else {
 		node->name = NULL;
 	}
 }
 
 static void
-file_browser_node_init (FileBrowserNode * node, GFile * file,
+file_browser_node_init (FileBrowserNode * node, GnomeVFSURI * uri,
 			FileBrowserNode * parent)
 {
-	if (file != NULL) {
-		node->file = g_object_ref (file);
+	if (uri != NULL) {
+		node->uri = gnome_vfs_uri_ref (uri);
 		file_browser_node_set_name (node);
 	}
 
@@ -1247,24 +1231,25 @@
 }
 
 static FileBrowserNode *
-file_browser_node_new (GFile * file, FileBrowserNode * parent)
+file_browser_node_new (GnomeVFSURI * uri, FileBrowserNode * parent)
 {
 	FileBrowserNode *node = g_new0 (FileBrowserNode, 1);
 
-	file_browser_node_init (node, file, parent);
+	file_browser_node_init (node, uri, parent);
 	return node;
 }
 
 static FileBrowserNode *
 file_browser_node_dir_new (GeditFileBrowserStore * model,
-			   GFile * file, FileBrowserNode * parent)
+			   GnomeVFSURI * uri, FileBrowserNode * parent)
 {
 	FileBrowserNode *node =
 	    (FileBrowserNode *) g_new0 (FileBrowserNodeDir, 1);
 
-	file_browser_node_init (node, file, parent);
+	file_browser_node_init (node, uri, parent);
 
 	node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_DIRECTORY;
+	node->mime_type = g_strdup ("text/directory");
 
 	FILE_BROWSER_NODE_DIR (node)->model = model;
 
@@ -1307,26 +1292,22 @@
 	if (NODE_IS_DIR (node)) {
 		dir = FILE_BROWSER_NODE_DIR (node);
 
-		if (dir->cancellable) {
-			g_cancellable_cancel (dir->cancellable);
-			g_object_unref (dir->cancellable);
-
+		if (dir->load_handle) {
+			gnome_vfs_async_cancel (dir->load_handle);
 			model_end_loading (model, node);
 		}
 
 		file_browser_node_free_children (model, node);
 
-		if (dir->monitor) {
-			g_file_monitor_cancel (dir->monitor);
-			g_object_unref (dir->monitor);
-		}
+		if (dir->monitor_handle)
+			gnome_vfs_monitor_cancel (dir->monitor_handle);
 
 		if (dir->hidden_file_hash)
 			g_hash_table_destroy (dir->hidden_file_hash);
 	}
 
-	if (node->file)
-		g_object_unref (node->file);
+	if (node->uri)
+		gnome_vfs_uri_unref (node->uri);
 
 	if (node->icon)
 		g_object_unref (node->icon);
@@ -1335,6 +1316,7 @@
 		g_object_unref (node->emblem);
 
 	g_free (node->name);
+	g_free (node->mime_type);
 	g_free (node);
 }
 
@@ -1509,19 +1491,15 @@
 	if (remove_children)
 		model_remove_node_children (model, node, NULL, TRUE);
 
-	if (dir->cancellable) {
-		g_cancellable_cancel (dir->cancellable);
-		g_object_unref (dir->cancellable);
-
+	if (dir->load_handle) {
+		gnome_vfs_async_cancel (dir->load_handle);
 		model_end_loading (model, node);
-		dir->cancellable = NULL;
+		dir->load_handle = NULL;
 	}
 
-	if (dir->monitor) {
-		g_file_monitor_cancel (dir->monitor);
-		g_object_unref (dir->monitor);
-		
-		dir->monitor = NULL;
+	if (dir->monitor_handle) {
+		gnome_vfs_monitor_cancel (dir->monitor_handle);
+		dir->monitor_handle = NULL;
 	}
 
 	node->flags &= ~GEDIT_FILE_BROWSER_STORE_FLAG_LOADED;
@@ -1533,15 +1511,21 @@
 {
 	GtkIconTheme *theme;
 	GdkPixbuf *icon;
+	gchar *uri;
 
 	g_return_if_fail (GEDIT_IS_FILE_BROWSER_STORE (tree_model));
 	g_return_if_fail (node != NULL);
 
-	if (node->file == NULL)
+	if (node->uri == NULL)
 		return;
 
 	theme = gtk_icon_theme_get_default ();
-	icon = gedit_file_browser_utils_pixbuf_from_file (node->file, GTK_ICON_SIZE_MENU);
+
+	uri = gnome_vfs_uri_to_string (node->uri, GNOME_VFS_URI_HIDE_NONE);
+
+	icon = gedit_file_browser_utils_pixbuf_from_mime_type (uri,
+							       node->mime_type,
+							       GTK_ICON_SIZE_MENU);
 
 	if (node->icon)
 		g_object_unref (node->icon);
@@ -1572,6 +1556,8 @@
 	} else {
 		node->icon = icon;
 	}
+
+	g_free (uri);
 }
 
 static void
@@ -1731,83 +1717,68 @@
 	model_check_dummy (model, child);
 }
 
-static gchar const *
-backup_content_type (GFileInfo * info)
-{
-	gchar const * content;
-	
-	if (!g_file_info_get_is_backup (info))
-		return NULL;
-	
-	content = g_file_info_get_content_type (info);
-	
-	if (!content || g_content_type_equals (content, "application/x-trash"))
-		return "text/plain";
-	
-	return content;
-}
-
 static void
 file_browser_node_set_from_info (GeditFileBrowserStore * model,
 				 FileBrowserNode * node,
-				 GFileInfo * info,
-				 gboolean isadded)
+				 GnomeVFSFileInfo * info)
 {
 	FileBrowserNodeDir * dir;
-	gchar const * content;
-	gchar const * name;
-	gboolean free_info = FALSE;
-	GtkTreePath * path;
-
-	if (info == NULL) {
-		info = g_file_query_info (node->file,  
-					  STANDARD_ATTRIBUTE_TYPES,
-					  G_FILE_QUERY_INFO_NONE,
-					  NULL,
-					  NULL);
-		free_info = TRUE;
-	}
+	gchar * filename;
+	gchar const * mime;
 
 	dir = FILE_BROWSER_NODE_DIR (node->parent);
-	name = g_file_info_get_name (info);
 
-	if (g_file_info_get_is_hidden (info) || g_file_info_get_is_backup (info))
-		node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_HIDDEN;
-	else if (dir != NULL && dir->hidden_file_hash != NULL &&
-		 g_hash_table_lookup (dir->hidden_file_hash, name) != NULL)
-		node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_HIDDEN;
+	g_free (node->mime_type);
+	node->mime_type = NULL;
 
-	if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
-		node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_DIRECTORY;
-	else {
-		if (!(content = backup_content_type (info)))
-			content = g_file_info_get_content_type (info);
-		
-		if (!content || 
-		    g_content_type_is_unknown (content) ||
-		    g_content_type_is_a (content, "text/plain"))
-			node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_TEXT;		
+	if (info->name) {
+		if (*(info->name) == '.') {
+			node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_HIDDEN;
+		}
+		else if (g_utf8_get_char (g_utf8_offset_to_pointer 
+		           (&(info->name[strlen(info->name)]), -1)) == '~') {
+			node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_HIDDEN;
+			
+			/* FIXME: this isn't totally correct. We need this 
+			   though because the mime type system somehow says that
+			   files ending on ~ are application/x-trash. Don't
+			   ask why. The fact is that most ~ files are backup 
+			   files and are text. Therefore we will try to guess
+			   the mime type from the filename (minus ~) and default
+			   to text/plain. Eat that, mime type system! */
+			filename = g_strndup (info->name, strlen(info->name) - 1);
+		   	mime = gnome_vfs_get_mime_type_for_name (filename);
+			g_free (filename);
+			
+			if (strcmp(mime, GNOME_VFS_MIME_TYPE_UNKNOWN) == 0)
+				node->mime_type = g_strdup("text/plain");
+			else
+				node->mime_type = g_strdup(mime);
+		}
+		else if (dir != NULL && dir->hidden_file_hash != NULL &&
+			 g_hash_table_lookup (dir->hidden_file_hash, info->name) != NULL) {
+			node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_HIDDEN;
+		}
 	}
-	
-	if (free_info)
-		g_object_unref (info);
 
-	model_recomposite_icon_real (model, node);
+	if (node->mime_type == NULL)
+		node->mime_type = g_strdup (info->mime_type);
 
-	if (isadded) {
-		path = gedit_file_browser_store_get_path_real (model, node);
-		model_refilter_node (model, node, path);
-		gtk_tree_path_free (path);
-		
-		model_check_dummy (model, node->parent);
-	} else {
-		model_node_update_visibility (model, node);
-	}
+	if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
+		node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_DIRECTORY;
+	else if (node->mime_type && 
+	         gnome_vfs_mime_type_get_equivalence (node->mime_type,
+						      "text/plain") !=
+		 GNOME_VFS_MIME_UNRELATED)
+		node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_TEXT;
+
+	model_node_update_visibility (model, node);
+	model_recomposite_icon_real (model, node);
 }
 
 static FileBrowserNode *
-model_file_exists (GeditFileBrowserStore * model, FileBrowserNode * parent,
-		  GFile * file)
+model_uri_exists (GeditFileBrowserStore * model, FileBrowserNode * parent,
+		  GnomeVFSURI * uri)
 {
 	GSList *item;
 	FileBrowserNode *node;
@@ -1819,8 +1790,8 @@
 	     item = item->next) {
 		node = (FileBrowserNode *) (item->data);
 
-		if (node->file != NULL
-		    && g_file_equal (node->file, file))
+		if (node->uri != NULL
+		    && gnome_vfs_uri_equal (node->uri, uri))
 			return node;
 	}
 
@@ -1828,89 +1799,110 @@
 }
 
 static FileBrowserNode *
-model_add_node_from_file (GeditFileBrowserStore * model,
-			  FileBrowserNode * parent,
-			  GFile * file,
-			  GFileInfo * info)
+model_add_node_from_uri (GeditFileBrowserStore * model,
+			 FileBrowserNode * parent,
+			 GnomeVFSURI * uri,
+			 GnomeVFSFileInfo * info)
 {
 	FileBrowserNode *node;
 	gboolean free_info = FALSE;
-	
-	if (!info)
-	{
-		info = g_file_query_info (file,
-					  STANDARD_ATTRIBUTE_TYPES,
-					  G_FILE_QUERY_INFO_NONE,
-					  NULL,
-					  NULL);
-		free_info = TRUE;
-	}
-	
+
 	// Check if it already exists
-	if ((node = model_file_exists (model, parent, file)) == NULL) {
-		if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
-			node = file_browser_node_dir_new (model, file, parent);
+	if ((node = model_uri_exists (model, parent, uri)) == NULL) {
+		if (info == NULL) {
+			info = gnome_vfs_file_info_new ();
+			free_info = TRUE;
+			gnome_vfs_get_file_info_uri (uri, info,
+						     GNOME_VFS_FILE_INFO_DEFAULT
+						     |
+						     GNOME_VFS_FILE_INFO_GET_MIME_TYPE);
+		}
+
+		if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) {
+			node = file_browser_node_dir_new (model, uri, parent);
 		} else {
-			node = file_browser_node_new (file, parent);
+			node = file_browser_node_new (uri, parent);
 		}
 
-		file_browser_node_set_from_info (model, node, info, FALSE);
+		file_browser_node_set_from_info (model, node, info);
 		model_add_node (model, node, parent);
+
+		if (free_info)
+			gnome_vfs_file_info_unref (info);
 	}
-	
-	if (free_info)
-		g_object_unref (info);
 
 	return node;
 }
 
 /* Read is sync, but we only do it for local files */
 static void
-parse_dot_hidden_file (FileBrowserNode *directory)
+parse_dot_hidden_file (FileBrowserNode *parent)
 {
-	gsize file_size;
-	char *file_contents;
-	GFile *child;
-	GFileInfo *info;
-	GFileType type;
-	int i;
-	FileBrowserNodeDir * dir = FILE_BROWSER_NODE_DIR (directory);
-
-
-	/* FIXME: We only support .hidden on file: uri's for the moment.
-	 * Need to figure out if we should do this async or sync to extend
-	 * it to all types of uris.
-	 */
-	if (directory->file == NULL || !g_file_is_native (directory->file)) {
+	FileBrowserNodeDir *dir;
+	GnomeVFSURI *vfs_uri;
+	gchar *uri;
+	GnomeVFSFileInfo *file_info;
+	GnomeVFSResult res;
+	gint i, file_size;
+	gchar *file_contents;
+
+	vfs_uri = gnome_vfs_uri_append_path (parent->uri, ".hidden");
+
+	uri = gnome_vfs_uri_to_string (vfs_uri, GNOME_VFS_URI_HIDE_NONE);
+	if (!gedit_utils_uri_has_file_scheme (uri) ||
+	    !gnome_vfs_uri_exists (vfs_uri)) {
+		gnome_vfs_uri_unref (vfs_uri);
+		g_free (uri);
 		return;
 	}
-	
-	child = g_file_get_child (directory->file, ".hidden");
-	info = g_file_query_info (child, G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL);
 
-	type = info ? g_file_info_get_file_type (info) : G_FILE_TYPE_UNKNOWN;
-	
-	if (info)
-		g_object_unref (info);
-	
-	if (type != G_FILE_TYPE_REGULAR) {
-		g_object_unref (child);
+	file_info = gnome_vfs_file_info_new ();
+	if (!file_info) {
+		gnome_vfs_uri_unref (vfs_uri);
+		g_free (uri);
+		return;
+	}
+
+	res = gnome_vfs_get_file_info_uri (vfs_uri,
+					   file_info,
+					   GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
+	if (res != GNOME_VFS_OK) {
+		gnome_vfs_file_info_unref (file_info);
+		gnome_vfs_uri_unref (vfs_uri);
+		g_free (uri);
+		return;
+	}
 
+	if ((file_info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) &&
+	    (file_info->type != GNOME_VFS_FILE_TYPE_REGULAR)) {
+		gnome_vfs_file_info_unref (file_info);
+		gnome_vfs_uri_unref (vfs_uri);
+		g_free (uri);
 		return;
 	}
 
-	if (!g_file_load_contents (child, NULL, &file_contents, &file_size, NULL, NULL)) {
-		g_object_unref (child);
+	gnome_vfs_file_info_unref (file_info);
+
+	res = gnome_vfs_read_entire_file (uri, &file_size, &file_contents);
+
+	gnome_vfs_uri_unref (vfs_uri);
+	g_free (uri);
+
+	if (res != GNOME_VFS_OK) {
 		return;
 	}
 
-	g_object_unref (child);
+	dir = FILE_BROWSER_NODE_DIR (parent);
 
-	if (dir->hidden_file_hash == NULL) {
-		dir->hidden_file_hash =
-			g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+	if (dir->hidden_file_hash) {
+		g_hash_table_destroy (dir->hidden_file_hash);
 	}
-	
+
+	dir->hidden_file_hash = g_hash_table_new_full (g_str_hash,
+						       g_str_equal,
+						       g_free,
+						       NULL);
+
 	/* Now parse the data */
 	i = 0;
 	while (i < file_size) {
@@ -1922,142 +1914,84 @@
 		}
 
 		if (i > start) {
-			char *hidden_filename;
-		
-			hidden_filename = g_strndup (file_contents + start, i - start);
+			gchar *tmp, *tmp2;
+
+			tmp = g_strndup (file_contents + start, i - start);
+			tmp2 = gnome_vfs_escape_string (tmp);
+			g_free (tmp);
+
 			g_hash_table_insert (dir->hidden_file_hash,
-					     hidden_filename, hidden_filename);
+					     tmp2, tmp2);
 		}
 
 		i++;
-		
 	}
 
 	g_free (file_contents);
 }
 
 static void
-model_iterate_next_files_cb (GFileEnumerator * enumerator, 
-			     GAsyncResult * result, 
-			     FileBrowserNode * parent)
-{
-	GList * files;
-	GList * item;
-	GError * error = NULL;
-	GFileInfo * info;
-	GFileType type;
-	gchar const * name;
-	GFile * file;
-	FileBrowserNodeDir * dir = FILE_BROWSER_NODE_DIR (parent);
-	
-	files = g_file_enumerator_next_files_finish (enumerator, result, &error);
+model_load_directory_cb (GnomeVFSAsyncHandle * handle,
+			 GnomeVFSResult result, GList * list,
+			 guint entries_read, gpointer user_data)
+{
+	FileBrowserNode *parent = (FileBrowserNode *) user_data;
+	GeditFileBrowserStore *model;
 
-	if (files == NULL) {
-		g_file_enumerator_close (enumerator, NULL, NULL);
-		
-		if (!error)
-		{
-			/* We're done loading */
-			g_object_unref (dir->cancellable);
-			dir->cancellable = NULL;
-			
-			if (g_file_is_native (parent->file) && dir->monitor == NULL) {
-				dir->monitor = g_file_monitor_directory (parent->file, 
-									 G_FILE_MONITOR_NONE,
-									 NULL,
-									 NULL);
-				g_signal_connect (dir->monitor,
-						  "changed",
-						  G_CALLBACK (on_directory_monitor_event),
-						  parent);
-			}
+	model = FILE_BROWSER_NODE_DIR (parent)->model;
 
-			model_check_dummy (dir->model, parent);
-			model_end_loading (dir->model, parent);
-		} else {
-			/* Simply return if we were cancelled */
-			if (error->domain == G_IO_ERROR && error->code == G_IO_ERROR_CANCELLED)
-				return;
-		
-			/* Otherwise handle the error appropriately */
-			g_signal_emit (dir->model,
-				       model_signals[ERROR],
-				       0,
-				       GEDIT_FILE_BROWSER_ERROR_LOAD_DIRECTORY,
-				       error->message);
+	if (result == GNOME_VFS_OK || result == GNOME_VFS_ERROR_EOF) {
+		GList *item;
+
+		for (item = list; item; item = item->next) {
+			GnomeVFSFileInfo *info;
+			GnomeVFSURI *uri;
+
+			info = (GnomeVFSFileInfo *) (item->data);
 
-			file_browser_node_unload (dir->model, (FileBrowserNode *)parent, TRUE);
-			g_error_free (error);
-		}
-	} else {
-		for (item = files; item; item = item->next) {
-			info = G_FILE_INFO (item->data);
-			type = g_file_info_get_file_type (info);
-			
 			/* Skip all non regular, non directory files */
-			if (type != G_FILE_TYPE_REGULAR &&
-			    type != G_FILE_TYPE_DIRECTORY &&
-			    type != G_FILE_TYPE_SYMBOLIC_LINK)
+			if (info->type != GNOME_VFS_FILE_TYPE_REGULAR &&
+			    info->type != GNOME_VFS_FILE_TYPE_DIRECTORY &&
+			    info->type != GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK)
 				continue;
 
-			name = g_file_info_get_name (info);
-
 			/* Skip '.' and '..' directories */
-			if (type == G_FILE_TYPE_DIRECTORY &&
-			    (strcmp (name, ".") == 0 ||
-			     strcmp (name, "..") == 0))
+			if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY &&
+			    (strcmp (info->name, ".") == 0 ||
+			     strcmp (info->name, "..") == 0))
 				continue;
 
-			file = g_file_get_child (parent->file, name);
-			model_add_node_from_file (dir->model, parent, file, info);
+			uri = gnome_vfs_uri_append_path (parent->uri,
+							 info->name);
+			model_add_node_from_uri (model, parent, uri, info);
+			gnome_vfs_uri_unref (uri);
+		}
+
+		if (result == GNOME_VFS_ERROR_EOF) {
+			FileBrowserNodeDir *dir;
+
+			dir = FILE_BROWSER_NODE_DIR (parent);
+			dir->load_handle = NULL;
+
+			if (gnome_vfs_uri_is_local (parent->uri)
+			    && dir->monitor_handle == NULL) {
+				gnome_vfs_monitor_add (&(dir->monitor_handle),
+						       gnome_vfs_uri_get_path (parent->uri),
+						       GNOME_VFS_MONITOR_DIRECTORY,
+						       (GnomeVFSMonitorCallback)on_directory_monitor_event, parent);
+			}
 
-			g_object_unref (file);
-			g_object_unref (info);
+			model_end_loading (model, parent);
+			model_check_dummy (model, parent);
 		}
-		
-		g_list_free (files);
-		next_files_async (enumerator, dir);
-	}
-}
-
-static void
-next_files_async (GFileEnumerator * enumerator,
-		  FileBrowserNodeDir * dir)
-{
-	g_file_enumerator_next_files_async (enumerator,
-					    DIRECTORY_LOAD_ITEMS_PER_CALLBACK,
-					    G_PRIORITY_DEFAULT,
-					    dir->cancellable,
-					    (GAsyncReadyCallback)model_iterate_next_files_cb,
-					    dir);
-}
-
-static void
-model_iterate_children_cb (GFile * file, 
-			   GAsyncResult * result,
-			   FileBrowserNodeDir * dir)
-{
-	GError * error = NULL;
-	GFileEnumerator * enumerator;
-	
-	enumerator = g_file_enumerate_children_finish (file, result, &error);
-	
-	if (enumerator == NULL) {
-		/* Simply return if we were cancelled */
-		if (error->domain == G_IO_ERROR && error->code == G_IO_ERROR_CANCELLED)
-			return;
-		
-		/* Otherwise handle the error appropriately */
-		g_signal_emit (dir->model,
-			       model_signals[ERROR],
-			       0,
-			       GEDIT_FILE_BROWSER_ERROR_LOAD_DIRECTORY,
-			       error->message);
-
-		file_browser_node_unload (dir->model, (FileBrowserNode *)dir, TRUE);
-		g_error_free (error);
 	} else {
-		next_files_async (enumerator, dir);
+		g_signal_emit (model, 
+		               model_signals[ERROR], 
+		               0,
+		               GEDIT_FILE_BROWSER_ERROR_LOAD_DIRECTORY,
+		               gnome_vfs_result_to_string (result));
+
+		file_browser_node_unload (model, parent, TRUE);
 	}
 }
 
@@ -2072,8 +2006,9 @@
 	dir = FILE_BROWSER_NODE_DIR (node);
 
 	/* Cancel a previous load */
-	if (dir->cancellable != NULL) {
-		file_browser_node_unload (dir->model, node, TRUE);
+	if (dir->load_handle != NULL) {
+		gnome_vfs_async_cancel (dir->load_handle);
+		dir->load_handle = NULL;
 	}
 
 	node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_LOADED;
@@ -2081,33 +2016,32 @@
 
 	/* Read the '.hidden' file first (if any) */
 	parse_dot_hidden_file (node);
-	
-	dir->cancellable = g_cancellable_new ();
 
 	/* Start loading async */
-	g_file_enumerate_children_async (node->file,
-					 STANDARD_ATTRIBUTE_TYPES,
-					 G_FILE_QUERY_INFO_NONE,
-					 G_PRIORITY_DEFAULT,
-					 dir->cancellable,
-					 (GAsyncReadyCallback)model_iterate_children_cb,
-					 dir);
+	gnome_vfs_async_load_directory_uri (&(dir->load_handle), node->uri,
+					    GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
+					    GNOME_VFS_FILE_INFO_FOLLOW_LINKS,
+					    100,
+					    GNOME_VFS_PRIORITY_DEFAULT,
+					    model_load_directory_cb, node);
 }
 
 static GList *
-get_parent_files (GeditFileBrowserStore * model, GFile * file)
+get_parent_uris (GeditFileBrowserStore * model, GnomeVFSURI * uri)
 {
-	GList * result = NULL;
-	
-	result = g_list_prepend (result, g_object_ref (file));
+	GList *result = NULL;
+
+	result = g_list_prepend (result, gnome_vfs_uri_ref (uri));
+
+	while (gnome_vfs_uri_has_parent (uri)) {
+		uri = gnome_vfs_uri_get_parent (uri);
 
-	while ((file = g_file_get_parent (file))) {
-		if (g_file_equal (file, model->priv->root->file)) {
-			g_object_unref (file);
+		if (gnome_vfs_uri_equal (uri, model->priv->root->uri)) {
+			gnome_vfs_uri_unref (uri);
 			break;
 		}
 
-		result = g_list_prepend (result, file);
+		result = g_list_prepend (result, uri);
 	}
 
 	return result;
@@ -2290,36 +2224,102 @@
 }
 
 static void
-set_virtual_root_from_file (GeditFileBrowserStore * model,
-			    GFile * file)
+set_virtual_root_from_uri (GeditFileBrowserStore * model,
+			   GnomeVFSURI * uri)
 {
-	GList * files;
-	GList * item;
-	FileBrowserNode * parent;
-	GFile * check;
+	GList *uris;
+	GList *item;
+	FileBrowserNode *node;
+	FileBrowserNode *parent;
+	GnomeVFSURI *check;
+	gboolean created = FALSE;
+	GnomeVFSFileInfo *info;
 
 	/* Always clear the model before altering the nodes */
 	model_clear (model, FALSE);
 
 	/* Create the node path, get all the uri's */
-	files = get_parent_files (model, file);
+	uris = get_parent_uris (model, uri);
 	parent = model->priv->root;
+	node = NULL;
 
-	for (item = files; item; item = item->next) {
-		check = G_FILE (item->data);
-		
-		parent = model_add_node_from_file (model, parent, check, NULL);
-		g_object_unref (check);
+	for (item = uris; item; item = item->next) {
+		check = (GnomeVFSURI *) (item->data);
+		node = NULL;
+
+		if (!created)
+			node = model_uri_exists (model, parent, check);
+
+		if (node == NULL) {
+			// Create the node
+			node = file_browser_node_dir_new (model, check, parent);
+
+			info = gnome_vfs_file_info_new ();
+			gnome_vfs_get_file_info_uri (check, info,
+						     GNOME_VFS_FILE_INFO_DEFAULT |
+						     GNOME_VFS_FILE_INFO_GET_MIME_TYPE);
+			file_browser_node_set_from_info (model, node, info);
+			gnome_vfs_file_info_unref (info);
+
+			model_add_node (model, node, parent);
+			created = TRUE;
+		}
+
+		parent = node;
+		gnome_vfs_uri_unref (check);
 	}
 
-	g_list_free (files);
+	g_list_free (uris);
+
 	set_virtual_root_from_node (model, parent);
 }
 
+static int
+progress_update_callback (GnomeVFSAsyncHandle * handle,
+			  GnomeVFSXferProgressInfo * progress_info,
+			  gpointer data)
+{
+	AsyncHandle *ahandle;
+
+	ahandle = (AsyncHandle *) (data);
+
+	switch (progress_info->status) {
+	case GNOME_VFS_XFER_PROGRESS_STATUS_VFSERROR:
+		if (ahandle->alive)
+			g_signal_emit (ahandle->model,
+				       model_signals[ERROR], 0,
+				       GEDIT_FILE_BROWSER_ERROR_DELETE,
+				       gnome_vfs_result_to_string
+				       (progress_info->vfs_status));
+
+		return GNOME_VFS_XFER_ERROR_ACTION_ABORT;
+		break;
+	case GNOME_VFS_XFER_PROGRESS_STATUS_OK:
+		switch (progress_info->phase) {
+		case GNOME_VFS_XFER_PHASE_COMPLETED:
+			if (ahandle->alive) {
+				ahandle->model->priv->async_handles =
+				    g_slist_remove (ahandle->model->priv->
+						    async_handles,
+						    ahandle);
+			}
+
+			g_free (ahandle);
+			break;
+		default:
+			break;
+		}
+	default:
+		break;
+	}
+
+	return 1;
+}
+
 static FileBrowserNode *
-model_find_node_children (GeditFileBrowserStore * model,
-			  FileBrowserNode * parent,
-			  GFile * file)
+model_find_node_children (GeditFileBrowserStore *model,
+			  FileBrowserNode *parent,
+			  GnomeVFSURI *uri)
 {
 	FileBrowserNodeDir *dir;
 	FileBrowserNode *child;
@@ -2334,7 +2334,7 @@
 	for (children = dir->children; children; children = children->next) {
 		child = (FileBrowserNode *)(children->data);
 		
-		result = model_find_node (model, child, file);
+		result = model_find_node (model, child, uri);
 		
 		if (result)
 			return result;
@@ -2344,22 +2344,103 @@
 }
 
 static FileBrowserNode *
-model_find_node (GeditFileBrowserStore * model,
-		 FileBrowserNode * node,
-		 GFile * file)
+model_find_node (GeditFileBrowserStore *model,
+		 FileBrowserNode *node,
+		 GnomeVFSURI *uri)
 {
 	if (node == NULL)
 		node = model->priv->root;
 
-	if (node->file && g_file_equal (node->file, file))
+	if (node->uri && gnome_vfs_uri_equal (node->uri, uri))
 		return node;
-
-	if (NODE_IS_DIR (node) && g_file_has_prefix (file, node->file))
-		return model_find_node_children (model, node, file);
+	
+	if (NODE_IS_DIR (node) && gnome_vfs_uri_is_parent (node->uri, uri, TRUE))
+		return model_find_node_children (model, node, uri);
 	
 	return NULL;
 }
 
+typedef struct {
+	GeditFileBrowserStore *model;
+	gchar *uri;
+} IdleDelete;
+
+static void
+idle_delete_free (IdleDelete *data)
+{
+	g_free (data->uri);
+	g_free (data);
+}
+
+static gboolean
+uri_deleted (IdleDelete *data)
+{
+	GnomeVFSURI *guri;
+	FileBrowserNode *node;
+
+	guri = gnome_vfs_uri_new (data->uri);
+	node = model_find_node (data->model, NULL, guri);
+	    	
+	if (node)
+		model_remove_node (data->model, node, NULL, TRUE);
+		
+	gnome_vfs_uri_unref (guri);
+	
+	return FALSE;
+}
+
+static int
+progress_sync_callback_trash (GnomeVFSXferProgressInfo * progress_info,
+			      gpointer data)
+{
+	AsyncHandle *ahandle = (AsyncHandle *) (data);
+	IdleDelete *delete;
+
+	if (!ahandle->alive)
+		return 1;
+
+	if (progress_info->status == GNOME_VFS_XFER_PROGRESS_STATUS_OK && 
+	    (progress_info->phase == GNOME_VFS_XFER_PHASE_DELETESOURCE ||
+	    progress_info->phase == GNOME_VFS_XFER_PHASE_MOVING)) {
+	    	delete = g_new(IdleDelete, 1);
+	    	delete->model = ahandle->model;
+	    	delete->uri = g_strdup (progress_info->source_name);
+
+		g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, 
+				 (GSourceFunc)uri_deleted,
+				 delete,
+				 (GDestroyNotify)idle_delete_free);
+	}
+
+	return 1;
+}
+
+
+static int
+progress_sync_callback_delete (GnomeVFSXferProgressInfo * progress_info,
+			       gpointer data)
+{
+	AsyncHandle *ahandle = (AsyncHandle *) (data);
+	IdleDelete *delete;
+
+	if (!ahandle->alive)
+		return 1;
+
+	if (progress_info->status == GNOME_VFS_XFER_PROGRESS_STATUS_OK && 
+	    progress_info->phase == GNOME_VFS_XFER_PHASE_DELETESOURCE) {
+	    	delete = g_new(IdleDelete, 1);
+	    	delete->model = ahandle->model;
+	    	delete->uri = g_strdup (progress_info->source_name);
+
+		g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, 
+				 (GSourceFunc)uri_deleted,
+				 delete,
+				 (GDestroyNotify)idle_delete_free);
+	}
+
+	return 1;
+}
+
 static GQuark
 gedit_file_browser_store_error_quark (void)
 {
@@ -2373,23 +2454,25 @@
 	return quark;
 }
 
-static GFile *
-unique_new_name (GFile * directory, gchar const * name)
+static GnomeVFSURI *
+unique_new_name (GnomeVFSURI * uri, gchar const *name)
 {
-	GFile * newuri = NULL;
+	GnomeVFSURI *newuri = NULL;
 	guint num = 0;
-	gchar * newname;
 
-	while (newuri == NULL || g_file_query_exists (newuri, NULL)) {
+	while (newuri == NULL || gnome_vfs_uri_exists (newuri)) {
+		gchar *newname;
+
 		if (newuri != NULL)
-			g_object_unref (newuri);
+			gnome_vfs_uri_unref (newuri);
 
 		if (num == 0)
 			newname = g_strdup (name);
 		else
 			newname = g_strdup_printf ("%s(%d)", name, num);
 
-		newuri = g_file_get_child (directory, newname);
+		newuri = gnome_vfs_uri_append_file_name (uri, newname);
+
 		g_free (newname);
 
 		++num;
@@ -2398,6 +2481,19 @@
 	return newuri;
 }
 
+static GnomeVFSURI *
+append_basename (GnomeVFSURI * target_uri, GnomeVFSURI * uri)
+{
+	gchar *basename;
+	GnomeVFSURI *ret;
+
+	basename = gnome_vfs_uri_extract_short_name (uri);
+	ret = gnome_vfs_uri_append_file_name (target_uri, basename);
+	g_free (basename);
+
+	return ret;
+}
+
 /* Public */
 GeditFileBrowserStore *
 gedit_file_browser_store_new (gchar const *root)
@@ -2475,27 +2571,27 @@
 GeditFileBrowserStoreResult
 gedit_file_browser_store_set_virtual_root_from_string
     (GeditFileBrowserStore * model, gchar const *root) {
-	GFile * file = g_file_new_for_uri (root);
+	GnomeVFSURI *uri = gnome_vfs_uri_new (root);
 	gchar *str, *str1;
 
 	g_return_val_if_fail (GEDIT_IS_FILE_BROWSER_STORE (model),
 			      GEDIT_FILE_BROWSER_STORE_RESULT_NO_CHANGE);
 
-	if (file == NULL) {
+	if (uri == NULL) {
 		g_warning ("Invalid uri (%s)", root);
 		return GEDIT_FILE_BROWSER_STORE_RESULT_NO_CHANGE;
 	}
 
 	/* Check if uri is already the virtual root */
 	if (model->priv->virtual_root &&
-	    g_file_equal (model->priv->virtual_root->file, file)) {
-		g_object_unref (file);
+	    gnome_vfs_uri_equal (model->priv->virtual_root->uri, uri)) {
+		gnome_vfs_uri_unref (uri);
 		return GEDIT_FILE_BROWSER_STORE_RESULT_NO_CHANGE;
 	}
 
 	/* Check if uri is the root itself */
-	if (g_file_equal (model->priv->root->file, file)) {
-		g_object_unref (file);
+	if (gnome_vfs_uri_equal (model->priv->root->uri, uri)) {
+		gnome_vfs_uri_unref (uri);
 
 		/* Always clear the model before altering the nodes */
 		model_clear (model, FALSE);
@@ -2503,23 +2599,25 @@
 		return GEDIT_FILE_BROWSER_STORE_RESULT_OK;
 	}
 
-	if (!g_file_has_prefix (file, model->priv->root->file)) {
-		str = gedit_file_browser_utils_file_display (model->priv->root->file);
-		str1 = gedit_file_browser_utils_file_display (file);
-
+	if (!gnome_vfs_uri_is_parent (model->priv->root->uri, uri, TRUE)) {
+		str =
+		    gnome_vfs_uri_to_string (model->priv->root->uri,
+					     GNOME_VFS_URI_HIDE_PASSWORD);
+		str1 =
+		    gnome_vfs_uri_to_string (uri,
+					     GNOME_VFS_URI_HIDE_PASSWORD);
 		g_warning
 		    ("Virtual root (%s) is not below actual root (%s)",
 		     str1, str);
-
 		g_free (str);
 		g_free (str1);
 
-		g_object_unref (file);
+		gnome_vfs_uri_unref (uri);
 		return GEDIT_FILE_BROWSER_STORE_RESULT_ERROR;
 	}
 
-	set_virtual_root_from_file (model, file);
-	g_object_unref (file);
+	set_virtual_root_from_uri (model, uri);
+	gnome_vfs_uri_unref (uri);
 
 	return GEDIT_FILE_BROWSER_STORE_RESULT_OK;
 }
@@ -2605,9 +2703,9 @@
 						    gchar const *root,
 						    gchar const *virtual_root)
 {
-	GFile * file = NULL;
-	GFile * vfile = NULL;
-	FileBrowserNode * node;
+	GnomeVFSURI *uri = NULL;
+	GnomeVFSURI *vuri = NULL;
+	FileBrowserNode *node;
 	gboolean equal = FALSE;
 
 	g_return_val_if_fail (GEDIT_IS_FILE_BROWSER_STORE (model),
@@ -2617,9 +2715,9 @@
 		return GEDIT_FILE_BROWSER_STORE_RESULT_NO_CHANGE;
 
 	if (root != NULL) {
-		file = g_file_new_for_uri (root);
+		uri = gnome_vfs_uri_new (root);
 
-		if (file == NULL) {
+		if (uri == NULL) {
 			g_signal_emit (model, model_signals[ERROR], 0,
 				       GEDIT_FILE_BROWSER_ERROR_SET_ROOT,
 				       _("Invalid uri"));
@@ -2628,27 +2726,28 @@
 	}
 
 	if (root != NULL && model->priv->root != NULL) {
-		equal = g_file_equal (file, model->priv->root->file);
+		equal = gnome_vfs_uri_equal (uri, model->priv->root->uri);
 
 		if (equal && virtual_root == NULL) {
-			g_object_unref (file);
+			gnome_vfs_uri_unref (uri);
 			return GEDIT_FILE_BROWSER_STORE_RESULT_NO_CHANGE;
 		}
 	}
 
 	if (virtual_root) {
-		vfile = g_file_new_for_uri (virtual_root);
+		vuri = gnome_vfs_uri_new (virtual_root);
 
 		if (equal && model->priv->virtual_root &&
-		    g_file_equal (vfile, model->priv->virtual_root->file)) {
-			if (file)
-				g_object_unref (file);
+		    gnome_vfs_uri_equal (vuri,
+					 model->priv->virtual_root->uri)) {
+			if (uri)
+				gnome_vfs_uri_unref (uri);
 
-			g_object_unref (vfile);
+			gnome_vfs_uri_unref (vuri);
 			return GEDIT_FILE_BROWSER_STORE_RESULT_NO_CHANGE;
 		}
 
-		g_object_unref (vfile);
+		gnome_vfs_uri_unref (vuri);
 	}
 
 	/* Always clear the model before altering the nodes */
@@ -2658,10 +2757,10 @@
 	model->priv->root = NULL;
 	model->priv->virtual_root = NULL;
 
-	if (file != NULL) {
+	if (uri != NULL) {
 		/* Create the root node */
-		node = file_browser_node_dir_new (model, file, NULL);
-		g_object_unref (file);
+		node = file_browser_node_dir_new (model, uri, NULL);
+		gnome_vfs_uri_unref (uri);
 
 		model->priv->root = node;
 		model_check_dummy (model, node);
@@ -2698,20 +2797,18 @@
 gedit_file_browser_store_get_root (GeditFileBrowserStore * model)
 {
 	g_return_val_if_fail (GEDIT_IS_FILE_BROWSER_STORE (model), NULL);
-	g_return_val_if_fail (model->priv->root != NULL, NULL);
-	g_return_val_if_fail (model->priv->root->file != NULL, NULL);
 
-	return g_file_get_uri (model->priv->root->file);
+	return gnome_vfs_uri_to_string (model->priv->root->uri,
+					GNOME_VFS_URI_HIDE_NONE);
 }
 
 gchar * 
 gedit_file_browser_store_get_virtual_root (GeditFileBrowserStore * model)
 {
 	g_return_val_if_fail (GEDIT_IS_FILE_BROWSER_STORE (model), NULL);
-	g_return_val_if_fail (model->priv->virtual_root != NULL, NULL);
-	g_return_val_if_fail (model->priv->virtual_root->file != NULL, NULL);
 	
-	return g_file_get_uri (model->priv->virtual_root->file);
+	return gnome_vfs_uri_to_string (model->priv->virtual_root->uri,
+	                                GNOME_VFS_URI_HIDE_NONE);
 }
 
 void
@@ -2827,10 +2924,11 @@
 				 GError ** error)
 {
 	FileBrowserNode *node;
-	GFile * file;
-	GFile * parent;
-	GError * err = NULL;
-	GtkTreePath *path;
+	GnomeVFSURI *uri;
+	GnomeVFSURI *parent;
+	GnomeVFSResult ret;
+
+	*error = NULL;
 
 	g_return_val_if_fail (GEDIT_IS_FILE_BROWSER_STORE (model), FALSE);
 	g_return_val_if_fail (iter != NULL, FALSE);
@@ -2838,180 +2936,82 @@
 
 	node = (FileBrowserNode *) (iter->user_data);
 
-	parent = g_file_get_parent (node->file);
-	g_return_val_if_fail (parent != NULL, FALSE);
-
-	file = g_file_get_child (parent, new_name);
-	g_object_unref (parent);
+	parent = gnome_vfs_uri_get_parent (node->uri);
+	uri = gnome_vfs_uri_append_file_name (parent, new_name);
+	gnome_vfs_uri_unref (parent);
 
-	if (g_file_equal (node->file, file)) {
-		g_object_unref (file);
+	if (gnome_vfs_uri_equal (node->uri, uri)) {
+		gnome_vfs_uri_unref (uri);
 		return TRUE;
 	}
 
-	if (g_file_move (node->file, file, G_FILE_COPY_NONE, NULL, NULL, NULL, &err)) {
-		/* TODO: make sure to also re'path all the child nodes that
-		   might be there! */
-		parent = node->file;
-		node->file = file;
+	ret = gnome_vfs_move_uri (node->uri, uri, FALSE);
 
-		/* This makes sure the actual info for the node is requeried */
+	if (ret == GNOME_VFS_OK) {
+		GnomeVFSFileInfo *info;
+		GtkTreePath *path;
+
+		parent = node->uri;
+		node->uri = uri;
+		info = gnome_vfs_file_info_new ();
+		gnome_vfs_get_file_info_uri (uri, info,
+					     GNOME_VFS_FILE_INFO_DEFAULT |
+					     GNOME_VFS_FILE_INFO_GET_MIME_TYPE);
+		file_browser_node_set_from_info (model, node, info);
 		file_browser_node_set_name (node);
-		file_browser_node_set_from_info (model, node, NULL, TRUE);
+		gnome_vfs_file_info_unref (info);
+		gnome_vfs_uri_unref (parent);
 
-		/* Free the old nodes' GFile */
-		g_object_unref (parent);
-		
-		if (model_node_visibility (model, node)) {
-			path = gedit_file_browser_store_get_path_real (model, node);
-			gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, iter);
-			gtk_tree_path_free (path);
+		path = gedit_file_browser_store_get_path_real (model, node);
+		gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, iter);
+		gtk_tree_path_free (path);
 
-			/* Reorder this item */
-			model_resort_node (model, node);
-		} else {
-			if (error != NULL)
-				*error = g_error_new_literal (gedit_file_browser_store_error_quark (),
-							      GEDIT_FILE_BROWSER_ERROR_RENAME,
-				       			      _("The renamed file is currently filtered out. You need to adjust your filter settings to make the file visible"));
-			return FALSE;
-		}
+		/* Reorder this item */
+		model_resort_node (model, node);
 
 		return TRUE;
 	} else {
-		g_object_unref (file);
+		gnome_vfs_uri_unref (uri);
 
-		if (err) {
-			if (error != NULL) {
-				*error =
-				    g_error_new_literal
-				    (gedit_file_browser_store_error_quark (),
-				     GEDIT_FILE_BROWSER_ERROR_RENAME,
-				     err->message);
-			}
-		
-			g_error_free (err);
+		if (error != NULL) {
+			*error =
+			    g_error_new_literal
+			    (gedit_file_browser_store_error_quark (),
+			     GEDIT_FILE_BROWSER_ERROR_RENAME,
+			     gnome_vfs_result_to_string (ret));
 		}
 
 		return FALSE;
 	}
 }
 
-static void
-async_data_free (AsyncData * data)
-{
-	g_object_unref (data->cancellable);
-	
-	g_list_foreach (data->files, (GFunc)g_object_unref, NULL);
-	g_list_free (data->files);
-	
-	if (!data->removed)
-		data->model->priv->async_handles = g_slist_remove (data->model->priv->async_handles, data);
-	
-	g_free (data);
-}
-
-static gboolean
-emit_no_trash (AsyncData * data)
-{
-	/* Emit the no trash error */
-	gboolean ret;
-
-	g_signal_emit (data->model, model_signals[NO_TRASH], 0, data->files, &ret);
-	return ret;
-}
-
-typedef struct {
-	GeditFileBrowserStore * model;
-	GFile * file;
-} IdleDelete;
-
-static gboolean
-file_deleted (IdleDelete * data)
-{
-	FileBrowserNode * node;
-	node = model_find_node (data->model, NULL, data->file);
-	    	
-	if (node)
-		model_remove_node (data->model, node, NULL, TRUE);
-	
-	return FALSE;
-}
-
-static gboolean
-delete_files (GIOSchedulerJob * job,
-	      GCancellable * cancellable,
-	      AsyncData * data)
-{
-	GFile * file;
-	GError * error = NULL;
-	gboolean ret;
-	gint code;
-	IdleDelete delete;
-	
-	/* Check if our job is done */
-	if (!data->iter)
-		return FALSE;
-	
-	/* Move a file to the trash */
-	file = G_FILE (data->iter->data);
-	
-	if (data->trash)
-		ret = g_file_trash (file, cancellable, &error);
-	else
-		ret = g_file_delete (file, cancellable, &error);
-
-	if (ret) {
-		delete.model = data->model;
-		delete.file = file;
-
-		/* Remove the file from the model in the main loop */
-		g_io_scheduler_job_send_to_mainloop (job, (GSourceFunc)file_deleted, &delete, NULL);
-	} else if (!ret && error) {
-		code = error->code;
-		g_error_free (error);
-
-		if (data->trash && code == G_IO_ERROR_NOT_SUPPORTED) {
-			/* Trash is not supported on this system ... */
-			if (g_io_scheduler_job_send_to_mainloop (job, (GSourceFunc)emit_no_trash, data, NULL))
-			{
-				/* Changes this into a delete job */
-				data->trash = FALSE;
-				data->iter = data->files;
-
-				return TRUE;
-			}
-			
-			/* End the job */
-			return FALSE;
-		} else if (code == G_IO_ERROR_CANCELLED) {
-			/* Job has been cancelled, just let the job end */
-			return FALSE;
-		}
-	}
-	
-	/* Process the next item */
-	data->iter = data->iter->next;
-	return TRUE;
-}
-
 GeditFileBrowserStoreResult
 gedit_file_browser_store_delete_all (GeditFileBrowserStore *model,
 				     GList *rows, gboolean trash)
 {
-	FileBrowserNode * node;
-	AsyncData * data;
-	GList * files = NULL;
-	GList * row;
+	FileBrowserNode *node;
+	AsyncHandle *handle;
+	GList *uris = NULL;
+	GList *row;
+	GList *target = NULL;
+	GnomeVFSURI *trash_uri;
+	GnomeVFSResult ret;
+	GnomeVFSXferOptions options;
 	GtkTreeIter iter;
-	GtkTreePath * prev = NULL;
-	GtkTreePath * path;
+	GeditFileBrowserStoreResult result = GEDIT_FILE_BROWSER_STORE_RESULT_OK;
+	GtkTreePath *prev = NULL;
+	GtkTreePath *path;
+	GnomeVFSXferProgressCallback sync_cb;
 
 	g_return_val_if_fail (GEDIT_IS_FILE_BROWSER_STORE (model), GEDIT_FILE_BROWSER_STORE_RESULT_NO_CHANGE);
 	
 	if (rows == NULL)
 		return GEDIT_FILE_BROWSER_STORE_RESULT_NO_CHANGE;
 
+	handle = g_new (AsyncHandle, 1);
+	handle->model = model;
+	handle->alive = TRUE;
+
 	/* First we sort the paths so that we can later on remove any
 	   files/directories that are actually subfiles/directories of
 	   a directory that's also deleted */
@@ -3030,26 +3030,76 @@
 		
 		prev = path;
 		node = (FileBrowserNode *)(iter.user_data);
-		files = g_list_prepend (files, g_object_ref (node->file));
+		
+		if (trash) {
+			/* Find the trash */
+			ret =
+		    		gnome_vfs_find_directory (node->uri,
+					      GNOME_VFS_DIRECTORY_KIND_TRASH,
+					      &trash_uri, FALSE, TRUE,
+					      0777);
+
+			if (ret == GNOME_VFS_ERROR_NOT_FOUND || trash_uri == NULL) {
+				if (trash_uri != NULL)
+					gnome_vfs_uri_unref (trash_uri);
+					
+				result = GEDIT_FILE_BROWSER_STORE_RESULT_NO_TRASH;
+				break;
+			} else {
+				uris = g_list_append (uris, node->uri);
+				target =
+				    g_list_append (target,
+						   append_basename (trash_uri,
+								    node->uri));
+				gnome_vfs_uri_unref (trash_uri);
+			}
+		} else {
+			uris = g_list_append (uris, node->uri);
+		}
 	}
 	
-	data = g_new (AsyncData, 1);
+	if (result != GEDIT_FILE_BROWSER_STORE_RESULT_OK) {
+		if (target) {
+			g_list_foreach (target, (GFunc)gnome_vfs_uri_unref, NULL);
+			g_list_free (target);
+		}
+		
+		g_list_free (uris);
+		g_free (handle);
+		g_list_free (rows);
 
-	data->model = model;
-	data->cancellable = g_cancellable_new ();
-	data->files = files;
-	data->trash = trash;
-	data->iter = files;
-	data->removed = FALSE;
+		return result;
+	}
 	
+	if (trash) {
+		options =
+			GNOME_VFS_XFER_RECURSIVE |
+			GNOME_VFS_XFER_REMOVESOURCE;
+		sync_cb = progress_sync_callback_trash;
+	} else {
+		options =
+			GNOME_VFS_XFER_DELETE_ITEMS | GNOME_VFS_XFER_RECURSIVE;
+		sync_cb = progress_sync_callback_delete;
+	}
+
+	gnome_vfs_async_xfer (&(handle->handle), uris, target,
+			      options,
+			      GNOME_VFS_XFER_ERROR_MODE_QUERY,
+			      GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
+			      GNOME_VFS_PRIORITY_DEFAULT,
+			      progress_update_callback,
+			      handle, sync_cb, handle);
+
 	model->priv->async_handles =
-	    g_slist_prepend (model->priv->async_handles, data);
+	    g_slist_prepend (model->priv->async_handles, handle);
 
-	g_io_scheduler_push_job ((GIOSchedulerJobFunc)delete_files, 
-				 data,
-				 (GDestroyNotify)async_data_free, 
-				 G_PRIORITY_DEFAULT, 
-				 data->cancellable);
+	g_list_free (uris);
+	
+	if (target) {
+		g_list_foreach (target, (GFunc)gnome_vfs_uri_unref, NULL);
+		g_list_free (target);
+	}
+	
 	g_list_free (rows);
 	
 	return GEDIT_FILE_BROWSER_STORE_RESULT_OK;
@@ -3086,12 +3136,12 @@
 				   GtkTreeIter * parent,
 				   GtkTreeIter * iter)
 {
-	GFile * file;
-	GFileOutputStream * stream;
+	GnomeVFSURI *uri;
+	GnomeVFSHandle *handle;
+	GnomeVFSResult ret;
 	FileBrowserNodeDir *parent_node;
 	gboolean result = FALSE;
 	FileBrowserNode *node;
-	GError * error = NULL;
 
 	g_return_val_if_fail (GEDIT_IS_FILE_BROWSER_STORE (model), FALSE);
 	g_return_val_if_fail (parent != NULL, FALSE);
@@ -3102,22 +3152,19 @@
 	g_return_val_if_fail (iter != NULL, FALSE);
 
 	parent_node = FILE_BROWSER_NODE_DIR (parent->user_data);
-	file = unique_new_name (((FileBrowserNode *) parent_node)->file, _("file"));
+	uri = unique_new_name (((FileBrowserNode *) parent_node)->uri, _("file"));
 
-	stream = g_file_create (file, G_FILE_CREATE_NONE, NULL, &error);
-	
-	if (!stream)
-	{
+	ret = gnome_vfs_create_uri (&handle, uri,
+				    GNOME_VFS_OPEN_NONE |
+				    GNOME_VFS_OPEN_WRITE, FALSE, 0644);
+
+	if (ret != GNOME_VFS_OK) {
 		g_signal_emit (model, model_signals[ERROR], 0,
 			       GEDIT_FILE_BROWSER_ERROR_NEW_FILE,
-			       error->message);
-		g_error_free (error);
+			       gnome_vfs_result_to_string (ret));
 	} else {
-		g_object_unref (stream);
-		node = model_add_node_from_file (model, 
-						 (FileBrowserNode *)parent_node, 
-						 file, 
-						 NULL);
+		node = model_add_node_from_uri (model, (FileBrowserNode *)
+						parent_node, uri, NULL);
 
 		if (model_node_visibility (model, node)) {
 			iter->user_data = node;
@@ -3130,7 +3177,7 @@
 		}
 	}
 
-	g_object_unref (file);
+	gnome_vfs_uri_unref (uri);
 	return result;
 }
 
@@ -3139,11 +3186,11 @@
 					GtkTreeIter * parent,
 					GtkTreeIter * iter)
 {
-	GFile * file;
+	GnomeVFSURI *uri;
+	GnomeVFSResult ret;
 	FileBrowserNodeDir *parent_node;
-	GError * error = NULL;
-	FileBrowserNode *node;
 	gboolean result = FALSE;
+	FileBrowserNode *node;
 
 	g_return_val_if_fail (GEDIT_IS_FILE_BROWSER_STORE (model), FALSE);
 	g_return_val_if_fail (parent != NULL, FALSE);
@@ -3154,18 +3201,17 @@
 	g_return_val_if_fail (iter != NULL, FALSE);
 
 	parent_node = FILE_BROWSER_NODE_DIR (parent->user_data);
-	file = unique_new_name (((FileBrowserNode *) parent_node)->file, _("directory"));
+	uri = unique_new_name (((FileBrowserNode *) parent_node)->uri, _("directory"));
+
+	ret = gnome_vfs_make_directory_for_uri (uri, 0755);
 
-	if (!g_file_make_directory (file, NULL, &error)) {
+	if (ret != GNOME_VFS_OK) {
 		g_signal_emit (model, model_signals[ERROR], 0,
 			       GEDIT_FILE_BROWSER_ERROR_NEW_DIRECTORY,
-			       error->message);
-		g_error_free (error);
+			       gnome_vfs_result_to_string (ret));
 	} else {
-		node = model_add_node_from_file (model, 
-						 (FileBrowserNode *)parent_node, 
-						 file, 
-						 NULL);
+		node = model_add_node_from_uri (model, (FileBrowserNode *)
+						parent_node, uri, NULL);
 
 		if (model_node_visibility (model, node)) {
 			iter->user_data = node;
@@ -3174,39 +3220,42 @@
 			g_signal_emit (model, model_signals[ERROR], 0,
 				       GEDIT_FILE_BROWSER_ERROR_NEW_FILE,
 				       _
-				       ("The new directory is currently filtered out. You need to adjust your filter settings to make the directory visible"));
+				       ("The new file is currently filtered out. You need to adjust your filter settings to make the file visible"));
 		}
 	}
 
-	g_object_unref (file);
+	gnome_vfs_uri_unref (uri);
 	return result;
 }
 
 /* Signal handlers */
 static void
-on_directory_monitor_event (GFileMonitor * monitor,
-			    GFile * file,
-			    GFile * other_file,
-			    GFileMonitorEvent event_type,
+on_directory_monitor_event (GnomeVFSMonitorHandle * handle,
+			    gchar const *monitor_uri,
+			    const gchar * info_uri,
+			    GnomeVFSMonitorEventType event_type,
 			    FileBrowserNode * parent)
 {
 	FileBrowserNode *node;
 	FileBrowserNodeDir *dir = FILE_BROWSER_NODE_DIR (parent);
+	GnomeVFSURI *uri;
 
 	switch (event_type) {
-	case G_FILE_MONITOR_EVENT_DELETED:
-		node = model_file_exists (dir->model, parent, file);
+	case GNOME_VFS_MONITOR_EVENT_DELETED:
+		uri = gnome_vfs_uri_new (info_uri);
+		node = model_uri_exists (dir->model, parent, uri);
+		gnome_vfs_uri_unref (uri);
 
 		if (node != NULL) {
 			// Remove the node
 			model_remove_node (dir->model, node, NULL, TRUE);
 		}
 		break;
-	case G_FILE_MONITOR_EVENT_CREATED:
-		if (g_file_query_exists (file, NULL)) {
-			model_add_node_from_file (dir->model, parent, file, NULL);
-		}
-		
+	case GNOME_VFS_MONITOR_EVENT_CREATED:
+		uri = gnome_vfs_uri_new (info_uri);
+
+		model_add_node_from_uri (dir->model, parent, uri, NULL);
+		gnome_vfs_uri_unref (uri);
 		break;
 	default:
 		break;

Modified: branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-store.h
==============================================================================
--- branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-store.h	(original)
+++ branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-store.h	Tue May 27 12:03:55 2008
@@ -23,6 +23,7 @@
 #define __GEDIT_FILE_BROWSER_STORE_H__
 
 #include <gtk/gtk.h>
+#include <libgnomevfs/gnome-vfs.h>
 
 G_BEGIN_DECLS
 #define GEDIT_TYPE_FILE_BROWSER_STORE			(gedit_file_browser_store_get_type ())
@@ -103,8 +104,6 @@
 	void (*error)                (GeditFileBrowserStore * model, 
 	                              guint code,
 		                      gchar * message);
-	gboolean (*no_trash)	     (GeditFileBrowserStore * model,
-				      GList * files);
 };
 
 GType gedit_file_browser_store_get_type               (void) G_GNUC_CONST;

Modified: branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-utils.c
==============================================================================
--- branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-utils.c	(original)
+++ branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-utils.c	Tue May 27 12:03:55 2008
@@ -1,26 +1,33 @@
 #include <libgnomeui/libgnomeui.h>
+#include <libgnomevfs/gnome-vfs.h>
 
 #include "gedit-file-browser-utils.h"
 
-static GdkPixbuf *
-process_icon_pixbuf (GdkPixbuf * pixbuf,
-		     gchar const * name, 
-		     gint size, 
-		     GError * error)
+GdkPixbuf *
+gedit_file_browser_utils_pixbuf_from_theme (gchar const *name,
+                                            GtkIconSize size)
 {
-	GdkPixbuf * scale;
+	GtkIconTheme *theme;
+	gint width;
+	GError *error = NULL;
+	GdkPixbuf *scale;
+	GdkPixbuf *pixbuf;
+
+	theme = gtk_icon_theme_get_default ();
+	gtk_icon_size_lookup (size, &width, NULL);
+
+	pixbuf = gtk_icon_theme_load_icon (theme, name, width, 0, &error);
 
 	if (error != NULL) {
-		g_warning ("Could not load theme icon %s: %s",
-			   name,
+		g_warning ("Could not load theme icon %s: %s", name,
 			   error->message);
 		g_error_free (error);
 	}
 	
-	if (pixbuf && gdk_pixbuf_get_width (pixbuf) > size) {
+	if (pixbuf && gdk_pixbuf_get_width (pixbuf) > width) {
 		scale = gdk_pixbuf_scale_simple (pixbuf, 
-		                                 size, 
-		                                 size, 
+		                                 width, 
+		                                 width, 
 		                                 GDK_INTERP_BILINEAR);
 		g_object_unref (pixbuf);
 		pixbuf = scale;
@@ -30,149 +37,39 @@
 }
 
 GdkPixbuf *
-gedit_file_browser_utils_pixbuf_from_theme (gchar const * name,
-                                            GtkIconSize size)
+gedit_file_browser_utils_pixbuf_from_mime_type (gchar const *uri,
+                                                gchar const *mime,
+                                                GtkIconSize size)
 {
-	gint width;
-	GError *error = NULL;
+	GtkIconTheme *theme;
 	GdkPixbuf *pixbuf;
+	gchar *name;
 
-	gtk_icon_size_lookup (size, &width, NULL);
-
-	pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), 
-					   name, 
-					   width, 
-					   0, 
-					   &error);
-
-	pixbuf = process_icon_pixbuf (pixbuf, name, width, error);
+	theme = gtk_icon_theme_get_default ();
 
-	return pixbuf;
-}
-
-static GdkPixbuf *
-pixbuf_from_theme_icon (GThemedIcon * icon, gint size)
-{
-	gchar **names;
-	GtkIconInfo * info;
-	GdkPixbuf * pixbuf;
-	GError * error = NULL;
-	gchar * name;
-	
-	// Get the icon theme names
-	g_object_get (icon, "names", &names, NULL);
-	info = gtk_icon_theme_choose_icon (gtk_icon_theme_get_default (), 
-					   (gchar const **)names, 
-					   size, 
-					   0);
-	
-	pixbuf = gtk_icon_info_load_icon (info, &error);
-	gtk_icon_info_free (info);
-	
-	name = g_strjoinv (", ", names);
-	pixbuf = process_icon_pixbuf (pixbuf, name, size, error);
+	name =
+	    gnome_icon_lookup (theme, NULL, uri, NULL, NULL, mime,
+			       GNOME_ICON_LOOKUP_FLAGS_NONE,
+			       GNOME_ICON_LOOKUP_RESULT_FLAGS_NONE);
 
+	pixbuf = gedit_file_browser_utils_pixbuf_from_theme (name, size);
 	g_free (name);
-	g_strfreev (names);
-
-	return pixbuf;	
-}
-
-static GdkPixbuf *
-pixbuf_from_loadable_icon (GLoadableIcon * icon, gint size)
-{
-	// TODO: actual implement this
-	return NULL;
-}
-
-GdkPixbuf *
-gedit_file_browser_utils_pixbuf_from_icon (GIcon * icon,
-                                           GtkIconSize size)
-{
-	GdkPixbuf * ret = NULL;
-	gint width;
-	
-	if (!icon)
-		return NULL;
-
-	gtk_icon_size_lookup (size, &width, NULL);
-	
-	if (G_IS_THEMED_ICON (icon))
-		ret = pixbuf_from_theme_icon (G_THEMED_ICON (icon), width);
-	else if (G_IS_LOADABLE_ICON (icon))
-		ret = pixbuf_from_loadable_icon (G_LOADABLE_ICON (icon), width);
-	
-	return ret;
-}
-
-GdkPixbuf *
-gedit_file_browser_utils_pixbuf_from_file (GFile * file,
-                                           GtkIconSize size)
-{
-	GIcon * icon;
-	GFileInfo * info;
-	GdkPixbuf * ret = NULL;
-
-	info = g_file_query_info (file, 
-				  G_FILE_ATTRIBUTE_STANDARD_ICON, 
-				  G_FILE_QUERY_INFO_NONE,
-				  NULL, 
-				  NULL);
-	
-	if (!info)
-		return NULL;
-
-	icon = g_file_info_get_icon (info);
-	ret = gedit_file_browser_utils_pixbuf_from_icon (icon, size);
-	g_object_unref (info);
-	
-	return ret;
-}
-
-gchar *
-gedit_file_browser_utils_file_display (GFile * file)
-{
-	gchar * ret;
 	
-	GFileInfo * info = g_file_query_info (file,
-					     G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, 
-					     G_FILE_QUERY_INFO_NONE,
-					     NULL, 
-					     NULL);
-	
-	if (!info)
-		return NULL;
-
-	ret = g_strdup(g_file_info_get_display_name (info));
-	g_object_unref (info);
-	
-	return ret;
-}
-
-gchar *
-gedit_file_browser_utils_file_basename (GFile * file)
-{
-	gchar * display = gedit_file_browser_utils_file_display (file);
-	gchar * ret;
-
-	if (!display)
-		return NULL;
-
-	ret = g_path_get_basename (display);
-	
-	g_free (display);
-	return ret;
+	return pixbuf;
 }
 
 gchar *
 gedit_file_browser_utils_uri_basename (gchar const * uri)
 {
-	GFile * file = g_file_new_for_uri (uri);
-	gchar * ret = gedit_file_browser_utils_file_basename (file);
+	gchar * basename;
+	gchar * normal;
+	
+	basename = g_filename_display_basename (uri);
+	normal = gnome_vfs_unescape_string_for_display (basename);
 	
-	g_object_unref (file);
+	g_free (basename);
 	
-	return ret;
+	return normal;
 }
 
 gboolean
@@ -225,17 +122,3 @@
 
 	return (ret == GTK_RESPONSE_OK);
 }
-
-gboolean
-_gedit_file_browser_utils_file_has_parent (GFile * file)
-{
-	GFile * parent = g_file_get_parent (file);
-	
-	if (!parent)
-		return FALSE;
-	
-	g_object_unref (parent);
-	return TRUE;
-}
-
-// ex:ts=8:noet:

Modified: branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-utils.h
==============================================================================
--- branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-utils.h	(original)
+++ branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-utils.h	Tue May 27 12:03:55 2008
@@ -2,29 +2,18 @@
 #define __GEDIT_FILE_BROWSER_UTILS_H__
 
 #include <gedit/gedit-window.h>
-#include <gio/gio.h>
 
 GdkPixbuf *gedit_file_browser_utils_pixbuf_from_theme     (gchar const *name,
                                                            GtkIconSize size);
 
-GdkPixbuf *gedit_file_browser_utils_pixbuf_from_icon	  (GIcon * icon,
+GdkPixbuf *gedit_file_browser_utils_pixbuf_from_mime_type (gchar const *uri,
+                                                           gchar const *mime,
                                                            GtkIconSize size);
-GdkPixbuf *gedit_file_browser_utils_pixbuf_from_file	  (GFile * file,
-                                                           GtkIconSize size);
-
-gchar * gedit_file_browser_utils_file_display		  (GFile * file);
-gchar * gedit_file_browser_utils_file_basename		  (GFile * file);
 gchar * gedit_file_browser_utils_uri_basename             (gchar const * uri);
-
 gboolean gedit_file_browser_utils_confirmation_dialog     (GeditWindow * window,
                                                            GtkMessageType type,
                                                            gchar const *message,
 		                                           gchar const *secondary, 
 		                                           gchar const * button_stock, 
 		                                           gchar const * button_label);
-
-gboolean _gedit_file_browser_utils_file_has_parent	  (GFile * file);
-
 #endif /* __GEDIT_FILE_BROWSER_UTILS_H__ */
-
-// ex:ts=8:noet:

Modified: branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-view.c
==============================================================================
--- branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-view.c	(original)
+++ branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-view.c	Tue May 27 12:03:55 2008
@@ -937,30 +937,28 @@
 on_cell_edited (GtkCellRendererText * cell, gchar * path, gchar * new_text,
 		GeditFileBrowserView * tree_view)
 {
-	GtkTreePath * treepath;
+	GtkTreePath *treepath;
 	GtkTreeIter iter;
-	gboolean ret;
-	GError * error = NULL;
-	
+	GError *error = NULL;
+
 	gtk_tree_path_free (tree_view->priv->editable);
 	tree_view->priv->editable = NULL;
 
 	if (new_text == NULL || *new_text == '\0')
 		return;
-		
+
 	treepath = gtk_tree_path_new_from_string (path);
-	ret = gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_view->priv->model), &iter, treepath);
+	gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_view->priv->model),
+				 &iter, treepath);
 	gtk_tree_path_free (treepath);
 
-	if (ret) {
-		if (!gedit_file_browser_store_rename
-		    (GEDIT_FILE_BROWSER_STORE (tree_view->priv->model), &iter,
-		     new_text, &error)) {
-			if (error) {
-				g_signal_emit (tree_view, signals[ERROR], 0,
-					       error->code, error->message);
-				g_error_free (error);
-			}
+	if (!gedit_file_browser_store_rename
+	    (GEDIT_FILE_BROWSER_STORE (tree_view->priv->model), &iter,
+	     new_text, &error)) {
+		if (error) {
+			g_signal_emit (tree_view, signals[ERROR], 0,
+				       error->code, error->message);
+			g_error_free (error);
 		}
 	}
 }

Modified: branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-widget.c
==============================================================================
--- branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-widget.c	(original)
+++ branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-widget.c	Tue May 27 12:03:55 2008
@@ -26,10 +26,10 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <string.h>
-#include <glib.h>
 #include <glib/gi18n-lib.h>
-#include <libgnome/gnome-url.h>
 #include <gdk/gdkkeysyms.h>
+#include <libgnomevfs/gnome-vfs.h>
+#include <libgnomeui/libgnomeui.h>
 #include <gedit/gedit-utils.h>
 #include <gedit/gedit-plugin.h>
 
@@ -60,7 +60,7 @@
 	COLUMN_INDENT,
 	COLUMN_ICON,
 	COLUMN_NAME,
-	COLUMN_FILE,
+	COLUMN_OBJECT,
 	COLUMN_ID,
 	N_COLUMNS
 };
@@ -101,8 +101,8 @@
 
 typedef struct 
 {
-	GFile *root;
-	GFile *virtual_root;
+	gchar *root;
+	gchar *virtual_root;
 } Location;
 
 typedef struct
@@ -163,9 +163,6 @@
 						guint code,
 						gchar * message,
 						GeditFileBrowserWidget * obj);
-static gboolean on_file_store_no_trash 	       (GeditFileBrowserStore * store, 
-						GList * files, 
-						GeditFileBrowserWidget * obj);
 static void on_combo_changed                   (GtkComboBox * combo,
 						GeditFileBrowserWidget * obj);
 static gboolean on_treeview_popup_menu         (GeditFileBrowserView * treeview,
@@ -190,9 +187,6 @@
                                                 GtkTreePath * path,
                                                 GtkTreeIter * iter,
                                                 GeditFileBrowserWidget * obj);
-static void on_bookmarks_row_deleted           (GtkTreeModel * model, 
-                                                GtkTreePath * path,
-                                                GeditFileBrowserWidget * obj);
 static void on_filter_mode_changed	       (GeditFileBrowserStore * model,
                                                 GParamSpec * param,
                                                 GeditFileBrowserWidget * obj);
@@ -261,12 +255,8 @@
 static void
 location_free (Location * loc)
 {
-	if (loc->root)
-		g_object_unref (loc->root);
-	
-	if (loc->virtual_root)
-		g_object_unref (loc->virtual_root);
-
+	g_free (loc->root);
+	g_free (loc->virtual_root);
 	g_free (loc);
 }
 
@@ -297,9 +287,16 @@
 remove_path_items (GeditFileBrowserWidget * obj)
 {
 	GtkTreeIter iter;
+	gchar *uri;
+
+	while (combo_find_by_id (obj, PATH_ID, &iter)) {
+		gtk_tree_model_get (GTK_TREE_MODEL
+				    (obj->priv->combo_model), &iter,
+				    COLUMN_OBJECT, &uri, -1);
+		g_free (uri);
 
-	while (combo_find_by_id (obj, PATH_ID, &iter))
 		gtk_tree_store_remove (obj->priv->combo_model, &iter);
+	}
 }
 
 static void
@@ -329,6 +326,7 @@
 	g_list_free (obj->priv->locations);
 
 	g_hash_table_destroy (obj->priv->bookmarks_hash);
+
 	G_OBJECT_CLASS (gedit_file_browser_widget_parent_class)->finalize (object);
 }
 
@@ -437,9 +435,10 @@
 	                                   confirm_no_trash),
 	                  g_signal_accumulator_true_handled,
 	                  NULL,
-	                  gedit_file_browser_marshal_BOOL__POINTER,
+	                  gedit_file_browser_marshal_BOOL__OBJECT_POINTER,
 	                  G_TYPE_BOOLEAN,
-	                  1,
+	                  2,
+	                  G_TYPE_OBJECT,
 	                  GTK_TYPE_POINTER);
 
 	g_type_class_add_private (object_class,
@@ -458,6 +457,33 @@
 	    g_slist_prepend (obj->priv->signal_pool, node);
 }
 
+/*static void
+remove_signal_by_func(GeditFileBrowserWidget *obj, gpointer object, gpointer func, 
+		gpointer data) {
+	gulong id;
+	GSList *item;
+	SignalNode *node;
+
+	id = g_signal_handler_find(object, 
+			G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
+			0, 0, NULL, func, data);
+	
+	if (id != 0) {
+		for (item = obj->priv->signal_pool; item; item = item->next) {
+			node = (SignalNode *)(item->data);
+			
+			if (node->id == id) {
+				g_signal_handler_disconnect(node->object, node->id);
+
+				obj->priv->signal_pool = g_slist_remove_link(
+						obj->priv->signal_pool, item);
+				g_free(node);
+				break;
+			}
+		}
+	}
+}*/
+
 static void
 clear_signals (GeditFileBrowserWidget * obj)
 {
@@ -486,13 +512,13 @@
 }
 
 static gboolean
-get_from_bookmark_file (GeditFileBrowserWidget * obj, GFile * file,
+get_from_bookmark_uri (GeditFileBrowserWidget * obj, GnomeVFSURI * guri,
 		       gchar ** name, GdkPixbuf ** icon)
 {
 	gpointer data;
 	NameIcon * item;
 
-	data = g_hash_table_lookup (obj->priv->bookmarks_hash, file);
+	data = g_hash_table_lookup (obj->priv->bookmarks_hash, GUINT_TO_POINTER (gnome_vfs_uri_hash (guri)));
 	
 	if (data == NULL)
 		return FALSE;
@@ -505,34 +531,63 @@
 	return TRUE;
 }
 
+static gboolean
+get_from_bookmark (GeditFileBrowserWidget * obj, gchar const *uri,
+		   gchar ** name, GdkPixbuf ** icon)
+{
+	GnomeVFSURI *guri;
+	gboolean result;
+
+	guri = gnome_vfs_uri_new (uri);
+
+	if (guri == NULL)
+		return FALSE;
+	
+	result = get_from_bookmark_uri (obj, guri, name, icon);
+	gnome_vfs_uri_unref (guri);
+	
+	return result;
+}
+
 static void
 insert_path_item (GeditFileBrowserWidget * obj, 
-                  GFile * file,
+                  GnomeVFSURI * uri,
 		  GtkTreeIter * after, 
 		  GtkTreeIter * iter, 
 		  guint indent)
 {
-	gchar * unescape;
+	gchar *str2;
+	gchar *unescape;
+	gchar *str;
 	GdkPixbuf * icon = NULL;
 
-	/* Try to get the icon and name from the bookmarks hash */
-	if (!get_from_bookmark_file (obj, file, &unescape, &icon)) {
-		/* It's not a bookmark, fetch the name and the icon ourselves */
-		unescape = gedit_file_browser_utils_file_basename (file);
+	if (!get_from_bookmark_uri (obj, uri, &unescape, &icon)) {
+		str = gnome_vfs_uri_to_string (uri, 
+	        	                       GNOME_VFS_URI_HIDE_PASSWORD |
+	                	               GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD | 
+	                        	       GNOME_VFS_URI_HIDE_FRAGMENT_IDENTIFIER);
+		unescape = gedit_file_browser_utils_uri_basename (str);
+		g_free (str);
 		
 		/* Get the icon */
-		icon = gedit_file_browser_utils_pixbuf_from_file (file, GTK_ICON_SIZE_MENU);
+		str = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
+		str2 = gnome_vfs_get_mime_type (str);
+		icon = gedit_file_browser_utils_pixbuf_from_mime_type (str, 
+		                                                       str2, 
+		                                                       GTK_ICON_SIZE_MENU);
+
+		g_free (str);
+		g_free (str2);
 	}
 
 	gtk_tree_store_insert_after (obj->priv->combo_model, iter, NULL,
 				     after);
-	
 	gtk_tree_store_set (obj->priv->combo_model, 
 	                    iter, 
 	                    COLUMN_INDENT, indent,
 	                    COLUMN_ICON, icon, 
 	                    COLUMN_NAME, unescape, 
-	                    COLUMN_FILE, file,
+	                    COLUMN_OBJECT, gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE),
 			    COLUMN_ID, PATH_ID, 
 			    -1);
 
@@ -565,25 +620,27 @@
 }
 
 static guint
-uri_num_parents (GFile * from, GFile * to)
+uri_num_parents (GnomeVFSURI * from, GnomeVFSURI * to)
 {
-	/* Determine the number of 'levels' to get from #from to #to. */
 	guint parents = 0;
-	GFile * parent;
+	GnomeVFSURI * tmp;
 
 	if (from == NULL)
 		return 0;
-
-	g_object_ref (from);
 	
-	while ((parent = g_file_get_parent (from)) && !(to && g_file_equal (from, to))) {
-		g_object_unref (from);
-		from = parent;
+	from = gnome_vfs_uri_dup (from);
+	
+	while (gnome_vfs_uri_has_parent (from) && 
+	       !(to && gnome_vfs_uri_equal (from, to))) {
+		tmp = gnome_vfs_uri_get_parent (from);
+		gnome_vfs_uri_unref (from);
+		from = tmp;
 		
 		++parents;
 	}
 	
-	g_object_unref (from);	
+	gnome_vfs_uri_unref (from);
+	
 	return parents;
 }
 
@@ -591,8 +648,10 @@
 insert_location_path (GeditFileBrowserWidget * obj)
 {
 	Location *loc;
-	GFile *current = NULL;
-	GFile * tmp;
+	GnomeVFSURI *virtual_root;
+	GnomeVFSURI *root;
+	GnomeVFSURI *current = NULL;
+	GnomeVFSURI * tmp;
 	GtkTreeIter separator;
 	GtkTreeIter iter;
 	guint indent;
@@ -604,15 +663,18 @@
 
 	loc = (Location *) (obj->priv->current_location->data);
 
-	current = loc->virtual_root;
+	virtual_root = gnome_vfs_uri_new (loc->virtual_root);
+	root = gnome_vfs_uri_new (loc->root);
+	current = virtual_root;
+
 	combo_find_by_id (obj, SEPARATOR_ID, &separator);
 	
-	indent = uri_num_parents (loc->virtual_root, loc->root);
+	indent = uri_num_parents (virtual_root, root);
 
 	while (current != NULL) {
 		insert_path_item (obj, current, &separator, &iter, indent--);
 
-		if (current == loc->virtual_root) {
+		if (current == virtual_root) {
 			g_signal_handlers_block_by_func (obj->priv->combo,
 							 on_combo_changed,
 							 obj);
@@ -625,19 +687,22 @@
 							   obj);
 		}
 
-		if (g_file_equal (current, loc->root) || !_gedit_file_browser_utils_file_has_parent (current)) {
-			if (current != loc->virtual_root)
-				g_object_unref (current);
+		if (gnome_vfs_uri_equal (current, root) || !gnome_vfs_uri_has_parent (current)) {
+			if (current != virtual_root)
+				gnome_vfs_uri_unref (current);
 			break;
 		}
 
-		tmp = g_file_get_parent (current);
+		tmp = gnome_vfs_uri_get_parent (current);
 		
-		if (current != loc->virtual_root)
-			g_object_unref (current);
+		if (current != virtual_root)
+			gnome_vfs_uri_unref (current);
 
 		current = tmp;
 	}
+
+	gnome_vfs_uri_unref (virtual_root);
+	gnome_vfs_uri_unref (root);
 }
 
 static void
@@ -674,6 +739,17 @@
 			    COLUMN_ID, BOOKMARKS_ID, -1);
 	g_object_unref (icon);
 
+#if 0
+	icon = gedit_file_browser_utils_pixbuf_from_theme (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
+
+	gtk_tree_store_append (store, &iter, NULL);
+	gtk_tree_store_set (store, &iter,
+			    COLUMN_ICON, icon,
+			    COLUMN_NAME, _("Recent Files"),
+			    COLUMN_ID, RECENTS_ID, -1);
+	g_object_unref (icon);
+#endif
+
 	gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (obj->priv->combo),
 					      separator_func, obj, NULL);
 	gtk_combo_box_set_active (GTK_COMBO_BOX (obj->priv->combo), 0);
@@ -710,7 +786,7 @@
 						     G_TYPE_UINT,
 						     GDK_TYPE_PIXBUF,
 						     G_TYPE_STRING,
-						     G_TYPE_FILE,
+						     G_TYPE_POINTER,
 						     G_TYPE_UINT);
 	obj->priv->combo =
 	    gtk_combo_box_new_with_model (GTK_TREE_MODEL
@@ -1006,25 +1082,28 @@
 	GdkPixbuf * pixbuf;
 	gchar * name;
 	gchar * uri;
-	GFile * file;
+	GnomeVFSURI * guri;
 	NameIcon * item;
 
 	model = GTK_TREE_MODEL (obj->priv->bookmarks_store);
 
 	uri = gedit_file_bookmarks_store_get_uri (obj->priv->
-						  bookmarks_store,
-						  iter);
+					    	          bookmarks_store,
+							  iter);
 	
 	if (uri == NULL)
 		return;
 	
-	file = g_file_new_for_uri (uri);
+	guri = gnome_vfs_uri_new (uri);
 	g_free (uri);
+	
+	if (guri == NULL)
+		return;
 
 	gtk_tree_model_get (model, iter,
-			    GEDIT_FILE_BOOKMARKS_STORE_COLUMN_ICON,
+			    GEDIT_FILE_BROWSER_STORE_COLUMN_ICON,
 			    &pixbuf,
-			    GEDIT_FILE_BOOKMARKS_STORE_COLUMN_NAME,
+			    GEDIT_FILE_BROWSER_STORE_COLUMN_NAME,
 			    &name, -1);	
 	
 	item = g_new (NameIcon, 1);
@@ -1032,8 +1111,10 @@
 	item->icon = pixbuf;
 
 	g_hash_table_insert (obj->priv->bookmarks_hash,
-			     file,
+			     GUINT_TO_POINTER (gnome_vfs_uri_hash (guri)),
 			     item);
+
+	gnome_vfs_uri_unref (guri);
 }
 
 static void
@@ -1055,11 +1136,6 @@
 		          "row-inserted",
 		          G_CALLBACK (on_bookmarks_row_inserted),
 		          obj);
-
-	g_signal_connect (obj->priv->bookmarks_store,
-		          "row-deleted",
-		          G_CALLBACK (on_bookmarks_row_deleted),
-		          obj);
 }
 
 static void
@@ -1147,14 +1223,26 @@
 	gtk_container_add (GTK_CONTAINER (expander), vbox);
 }
 
+static guint
+uint_hash (gconstpointer key)
+{
+	return GPOINTER_TO_UINT (key);
+}
+
+static gboolean
+uint_equal (gconstpointer a, gconstpointer b)
+{
+	return GPOINTER_TO_UINT (a) == GPOINTER_TO_UINT (b);
+}
+
 static void
 gedit_file_browser_widget_init (GeditFileBrowserWidget * obj)
 {
 	obj->priv = GEDIT_FILE_BROWSER_WIDGET_GET_PRIVATE (obj);
 
-	obj->priv->bookmarks_hash = g_hash_table_new_full (g_file_hash,
-			                                   (GEqualFunc)g_file_equal,
-			                                   g_object_unref,
+	obj->priv->bookmarks_hash = g_hash_table_new_full (uint_hash,
+			                                   uint_equal,
+			                                   NULL,
 			                                   free_name_icon);
 
 	create_toolbar (obj);
@@ -1360,6 +1448,14 @@
 
 	result = gedit_file_browser_store_delete_all (GEDIT_FILE_BROWSER_STORE (model),
 						      rows, trash);
+
+	if (result == GEDIT_FILE_BROWSER_STORE_RESULT_NO_TRASH) {
+		g_signal_emit (obj, signals[CONFIRM_NO_TRASH], 0, model, rows, &confirm);
+		
+		if (confirm)
+			result = gedit_file_browser_store_delete_all (GEDIT_FILE_BROWSER_STORE (model),
+								      rows, FALSE);
+	}
 	
 	g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
 	g_list_free (rows);
@@ -1367,28 +1463,17 @@
 	return result == GEDIT_FILE_BROWSER_STORE_RESULT_OK;
 }
 
-static gboolean
-on_file_store_no_trash (GeditFileBrowserStore * store, 
-			GList * files, 
-			GeditFileBrowserWidget * obj)
-{
-	gboolean confirm = FALSE;
-	
-	g_signal_emit (obj, signals[CONFIRM_NO_TRASH], 0, files, &confirm);
-	
-	return confirm;
-}
-
-static GFile *
-get_topmost_file (GFile * file)
+static GnomeVFSURI *
+get_topmost_uri (GnomeVFSURI const *uri)
 {
-	GFile * tmp;
-	GFile * current;
+	GnomeVFSURI * tmp;
+	GnomeVFSURI * current;
 	
-	current = g_object_ref (file);
+	current = gnome_vfs_uri_dup (uri);
 	
-	while ((tmp = g_file_get_parent (current)) != NULL) {
-		g_object_unref (current);
+	while (gnome_vfs_uri_has_parent (current)) {
+		tmp = gnome_vfs_uri_get_parent (current);
+		gnome_vfs_uri_unref (current);
 		current = tmp;
 	}
 	
@@ -1401,14 +1486,29 @@
 {
 	GtkWidget *result;
 	GtkWidget *image;
+	gchar *base;
 	gchar *unescape;
 	GdkPixbuf *pixbuf;
 	Location *loc;
 
 	loc = (Location *) (item->data);
 
-	if (!get_from_bookmark_file (obj, loc->virtual_root, &unescape, &pixbuf)) {
-		unescape = gedit_file_browser_utils_file_basename (loc->virtual_root);
+	if (!get_from_bookmark (obj, loc->virtual_root,
+				&unescape, &pixbuf)) {
+
+		if (gedit_utils_uri_has_file_scheme (loc->virtual_root)) {
+			unescape =
+			    gnome_vfs_get_local_path_from_uri (loc->
+							       virtual_root);
+			base = g_path_get_basename (unescape);
+			g_free (unescape);
+		} else {
+			base = g_path_get_basename (loc->virtual_root);
+		}
+
+		unescape = gnome_vfs_unescape_string_for_display (base);
+		g_free (base);
+
 		pixbuf = g_object_ref (icon);
 	}
 
@@ -1460,8 +1560,6 @@
 	GList *(*iter_func) (GList *);
 	GtkWidget *menu_from;
 	GtkWidget *menu_to;
-	gchar *root;
-	gchar *virtual_root;
 
 	if (!obj->priv->locations)
 		return;
@@ -1520,16 +1618,11 @@
 	loc = (Location *) (obj->priv->current_location->data);
 
 	/* Set the new root + virtual root */
-	root = g_file_get_uri (loc->root);
-	virtual_root = g_file_get_uri (loc->virtual_root);
-	
 	gedit_file_browser_widget_set_root_and_virtual_root (obj,
-							     root,
+							     loc->root,
+							     loc->
 							     virtual_root);
 
-	g_free (root);
-	g_free (virtual_root);
-
 	obj->priv->changing_location = FALSE;
 }
 
@@ -1690,7 +1783,8 @@
 }
 
 void
-gedit_file_browser_widget_set_root_and_virtual_root (GeditFileBrowserWidget *obj,
+gedit_file_browser_widget_set_root_and_virtual_root (GeditFileBrowserWidget
+						     * obj,
 						     gchar const *root,
 						     gchar const *virtual_root)
 {
@@ -1718,31 +1812,39 @@
 				    gchar const *root, 
 				    gboolean virtual_root)
 {
-	GFile *file;
-	GFile *parent;
+	GnomeVFSURI *uri;
+	GnomeVFSURI *parent;
 	gchar *str;
 
 	if (!virtual_root) {
 		gedit_file_browser_widget_set_root_and_virtual_root (obj,
 								     root,
 								     NULL);
-		return;
-	}
-
-	if (!root)
-		return;
-
-	file = g_file_new_for_uri (root);
-	parent = get_topmost_file (file);
-	str = g_file_get_uri (parent);
-
-	gedit_file_browser_widget_set_root_and_virtual_root
-	    (obj, str, root);
+	} else {
+		uri = gnome_vfs_uri_new (root);
 
-	g_free (str);
-	
-	g_object_unref (file);
-	g_object_unref (parent);
+		if (uri) {
+			parent = get_topmost_uri (uri);
+			str =
+			    gnome_vfs_uri_to_string (parent,
+						     GNOME_VFS_URI_HIDE_NONE);
+
+			gedit_file_browser_widget_set_root_and_virtual_root
+			    (obj, str, root);
+
+			g_free (str);
+			gnome_vfs_uri_unref (uri);
+			gnome_vfs_uri_unref (parent);
+		} else {
+			str =
+			    g_strconcat (_("Invalid uri"), ": ", root,
+					 NULL);
+			g_signal_emit (obj, signals[ERROR], 0,
+				       GEDIT_FILE_BROWSER_ERROR_SET_ROOT,
+				       str);
+			g_free (str);
+		}
+	}
 }
 
 GeditFileBrowserStore *
@@ -1854,7 +1956,7 @@
 }
 
 guint
-gedit_file_browser_widget_get_num_selected_files_or_directories (GeditFileBrowserWidget *obj) {
+gedit_file_browser_widget_get_num_selected_files_or_directories(GeditFileBrowserWidget *obj) {
 	GList *rows, *row;
 	GtkTreePath *path;
 	GtkTreeIter iter;
@@ -1989,9 +2091,8 @@
 				    (model);
 
 				loc = g_new (Location, 1);
-				loc->root = g_file_new_for_uri (root_uri);
-				loc->virtual_root = g_file_new_for_uri (uri);
-				g_free (root_uri);
+				loc->root = root_uri;
+				loc->virtual_root = g_strdup (uri);
 
 				if (obj->priv->current_location) {
 					/* Add current location to the menu so we can go back
@@ -2119,12 +2220,6 @@
 			    g_signal_connect (model, "error",
 					      G_CALLBACK
 					      (on_file_store_error), obj));
-
-		add_signal (obj, model,
-			    g_signal_connect (model, "no-trash",
-			    		      G_CALLBACK
-			    		      (on_file_store_no_trash), obj));
-
 		gtk_widget_set_sensitive (obj->priv->filter_expander, TRUE);
 	}
 
@@ -2150,8 +2245,7 @@
 {
 	GtkTreeIter iter;
 	guint id;
-	gchar * uri;
-	GFile * file;
+	gchar *uri;
 
 	if (!gtk_combo_box_get_active_iter (combo, &iter))
 		return;
@@ -2167,14 +2261,9 @@
 	case PATH_ID:
 		gtk_tree_model_get (GTK_TREE_MODEL
 				    (obj->priv->combo_model), &iter,
-				    COLUMN_FILE, &file, -1);
-		
-		uri = g_file_get_uri (file);
+				    COLUMN_OBJECT, &uri, -1);
 		gedit_file_browser_store_set_virtual_root_from_string
 		    (obj->priv->file_store, uri);
-		
-		g_free (uri);
-		g_object_unref (file);
 		break;
 	}
 }
@@ -2348,30 +2437,6 @@
 	add_bookmark_hash (obj, iter);
 }
 
-static void
-on_bookmarks_row_deleted (GtkTreeModel * model, 
-                          GtkTreePath * path,
-                          GeditFileBrowserWidget *obj)
-{
-	GtkTreeIter iter;
-	gchar * uri;
-	GFile * file;
-	
-	if (!gtk_tree_model_get_iter (model, &iter, path))
-		return;
-
-	uri = gedit_file_bookmarks_store_get_uri (obj->priv->bookmarks_store, &iter);
-	
-	if (!uri)
-		return;
-
-	file = g_file_new_for_uri (uri);
-	g_hash_table_remove (obj->priv->bookmarks_hash, file);
-
-	g_object_unref (file);
-	g_free (uri);
-}
-
 static void 
 on_filter_mode_changed (GeditFileBrowserStore * model,
                         GParamSpec * param,
@@ -2550,8 +2615,7 @@
 {
 	GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
 	GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj->priv->treeview));	
-	GList *rows;
-	GList *row;
+	GList *rows, *row;
 	gboolean directory_opened = FALSE;
 	GtkTreeIter iter;
 	GtkTreePath *path;

Modified: branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-widget.h
==============================================================================
--- branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-widget.h	(original)
+++ branches/gnome-2-22/plugins/filebrowser/gedit-file-browser-widget.h	Tue May 27 12:03:55 2008
@@ -23,6 +23,7 @@
 #define __GEDIT_FILE_BROWSER_WIDGET_H__
 
 #include <gtk/gtk.h>
+#include <libgnomevfs/gnome-vfs.h>
 #include "gedit-file-browser-store.h"
 #include "gedit-file-bookmarks-store.h"
 #include "gedit-file-browser-view.h"
@@ -67,6 +68,7 @@
 	                              GeditFileBrowserStore * model,
 	                              GList *list);
 	gboolean (*confirm_no_trash) (GeditFileBrowserWidget * widget,
+                                      GeditFileBrowserStore * model,
 	                              GList *list);
 };
 



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