3a03f1398032896178d5fffc35d46e58b9838662
diff --git a/gedit/gedit-document-loader.c b/gedit/gedit-document-loader.c
index 9b45181..255a936 100644
--- a/gedit/gedit-document-loader.c
+++ b/gedit/gedit-document-loader.c
@@ -64,7 +64,7 @@ enum
 {
 	PROP_0,
 	PROP_DOCUMENT,
-	PROP_URI,
+	PROP_FILE,
 	PROP_ENCODING,
 };
 
@@ -82,9 +82,13 @@ gedit_document_loader_set_property (GObject      *object,
 			g_return_if_fail (loader->document == NULL);
 			loader->document = g_value_get_object (value);
 			break;
-		case PROP_URI:
-			g_return_if_fail (loader->uri == NULL);
-			loader->uri = g_value_dup_string (value);
+		case PROP_FILE:
+			g_return_if_fail (loader->file == NULL);
+			loader->file = g_value_get_object (value);
+			g_object_ref (loader->file);
+
+			/* FIXME: legacy loaders */
+			loader->uri = g_file_get_uri (loader->file);
 			break;
 		case PROP_ENCODING:
 			g_return_if_fail (loader->encoding == NULL);
@@ -109,8 +113,8 @@ gedit_document_loader_get_property (GObject    *object,
 		case PROP_DOCUMENT:
 			g_value_set_object (value, loader->document);
 			break;
-		case PROP_URI:
-			g_value_set_string (value, loader->uri);
+		case PROP_FILE:
+			g_value_set_object (value, loader->file);
 			break;
 		case PROP_ENCODING:
 			g_value_set_boxed (value, gedit_document_loader_get_encoding (loader));
@@ -126,6 +130,7 @@ gedit_document_loader_finalize (GObject *object)
 {
 	GeditDocumentLoader *loader = GEDIT_DOCUMENT_LOADER (object);
 
+	g_object_unref (loader->file);
 	g_free (loader->uri);
 
 	G_OBJECT_CLASS (gedit_document_loader_parent_class)->finalize (object);
@@ -151,13 +156,14 @@ gedit_document_loader_class_init (GeditDocumentLoaderClass *klass)
 							      G_PARAM_STATIC_STRINGS));
 
 	g_object_class_install_property (object_class,
-					 PROP_URI,
-					 g_param_spec_string ("uri",
-							      "URI",
-							      "The URI this GeditDocumentLoader loads the document from",
-							      "",
+					 PROP_FILE,
+					 g_param_spec_object ("file",
+							      "File",
+							      "The GFile this GeditDocumentLoader loads the document from",
+							      G_TYPE_FILE,
 							      G_PARAM_READWRITE |
-							      G_PARAM_CONSTRUCT_ONLY));
+							      G_PARAM_CONSTRUCT_ONLY |
+							      G_PARAM_STATIC_STRINGS));
 
 	g_object_class_install_property (object_class,
 					 PROP_ENCODING,
@@ -338,12 +344,12 @@ gedit_document_loader_loading (GeditDocumentLoader *loader,
 }
 
 static const GeditEncoding *
-get_metadata_encoding (const gchar *uri)
+get_metadata_encoding (GFile *file)
 {
 	const GeditEncoding *enc;
 	gchar *charset;
-
-	charset = gedit_metadata_manager_get (uri, "encoding");
+	
+	charset = gedit_metadata_manager_get (file, "encoding");
 
 	if (charset == NULL)
 		return NULL;
@@ -357,7 +363,7 @@ get_metadata_encoding (const gchar *uri)
 
 GeditDocumentLoader *
 gedit_document_loader_new (GeditDocument       *doc,
-			   const gchar         *uri,
+			   GFile               *file,
 			   const GeditEncoding *encoding)
 {
 	GeditDocumentLoader *loader;
@@ -375,7 +381,7 @@ gedit_document_loader_new (GeditDocument       *doc,
 
 	loader = GEDIT_DOCUMENT_LOADER (g_object_new (loader_type,
 						      "document", doc,
-						      "uri", uri,
+						      "file", file,
 						      "encoding", encoding,
 						      NULL));
 
@@ -395,7 +401,7 @@ gedit_document_loader_load (GeditDocumentLoader *loader)
 	loader->used = TRUE;
 
 	if (loader->encoding == NULL)
-		loader->metadata_encoding = get_metadata_encoding (loader->uri);
+		loader->metadata_encoding = get_metadata_encoding (loader->file);
 
 	GEDIT_DOCUMENT_LOADER_GET_CLASS (loader)->load (loader);
 }
@@ -410,13 +416,12 @@ gedit_document_loader_cancel (GeditDocumentLoader *loader)
 	return GEDIT_DOCUMENT_LOADER_GET_CLASS (loader)->cancel (loader);
 }
 
-/* Returns STDIN_URI if loading from stdin */
-const gchar *
-gedit_document_loader_get_uri (GeditDocumentLoader *loader)
+GFile *
+gedit_document_loader_get_file (GeditDocumentLoader *loader)
 {
 	g_return_val_if_fail (GEDIT_IS_DOCUMENT_LOADER (loader), NULL);
 
-	return loader->uri;
+	return loader->file;
 }
 
 /* it may return NULL, it's up to gedit-document handle it */
@@ -437,7 +442,7 @@ gedit_document_loader_get_mtime (GeditDocumentLoader *loader)
 }
 
 /* Returns 0 if file size is unknown */
-GnomeVFSFileSize
+goffset
 gedit_document_loader_get_file_size (GeditDocumentLoader *loader)
 {
 	g_return_val_if_fail (GEDIT_IS_DOCUMENT_LOADER (loader), 0);
@@ -445,7 +450,7 @@ gedit_document_loader_get_file_size (GeditDocumentLoader *loader)
 	return GEDIT_DOCUMENT_LOADER_GET_CLASS (loader)->get_file_size (loader);
 }
 
-GnomeVFSFileSize
+goffset
 gedit_document_loader_get_bytes_read (GeditDocumentLoader *loader)
 {
 	g_return_val_if_fail (GEDIT_IS_DOCUMENT_LOADER (loader), 0);
diff --git a/gedit/gedit-document-loader.h b/gedit/gedit-document-loader.h
index f80a613..12fa95b 100644
--- a/gedit/gedit-document-loader.h
+++ b/gedit/gedit-document-loader.h
@@ -33,7 +33,6 @@
 #define __GEDIT_DOCUMENT_LOADER_H__
 
 #include <gedit/gedit-document.h>
-#include <libgnomevfs/gnome-vfs-file-size.h>
 
 G_BEGIN_DECLS
 
@@ -63,6 +62,7 @@ struct _GeditDocumentLoader
 	gboolean		  used;
 
 	/* Info on the current file */
+	GFile			 *file;
 	gchar			 *uri;
 	const GeditEncoding	 *encoding;
 	const GeditEncoding	 *metadata_encoding;
@@ -88,8 +88,8 @@ struct _GeditDocumentLoaderClass
 	gboolean		(* cancel)		(GeditDocumentLoader *loader);
 	const gchar *		(* get_mime_type)	(GeditDocumentLoader *loader);
 	time_t			(* get_mtime)		(GeditDocumentLoader *loader);
-	GnomeVFSFileSize	(* get_file_size)	(GeditDocumentLoader *loader);
-	GnomeVFSFileSize	(* get_bytes_read)	(GeditDocumentLoader *loader);
+	goffset			(* get_file_size)	(GeditDocumentLoader *loader);
+	goffset			(* get_bytes_read)	(GeditDocumentLoader *loader);
 	gboolean		(* get_readonly)	(GeditDocumentLoader *loader);
 };
 
@@ -100,7 +100,7 @@ GType 		 	 gedit_document_loader_get_type		(void) G_GNUC_CONST;
 
 /* If enconding == NULL, the encoding will be autodetected */
 GeditDocumentLoader 	*gedit_document_loader_new 		(GeditDocument       *doc,
-								 const gchar         *uri,
+								 GFile               *file,
 								 const GeditEncoding *encoding);
 
 gboolean		 gedit_document_loader_update_document_contents
@@ -118,10 +118,7 @@ gboolean		 gedit_document_loader_load_from_stdin	(GeditDocumentLoader *loader);
 #endif		 
 gboolean		 gedit_document_loader_cancel		(GeditDocumentLoader *loader);
 
-
-/* Returns STDIN_URI if loading from stdin */
-#define STDIN_URI "stdin:" 
-const gchar		*gedit_document_loader_get_uri		(GeditDocumentLoader *loader);
+GFile			*gedit_document_loader_get_file		(GeditDocumentLoader *loader);
 
 const gchar		*gedit_document_loader_get_mime_type	(GeditDocumentLoader *loader);
 
@@ -134,10 +131,9 @@ gboolean		 gedit_document_loader_get_readonly	(GeditDocumentLoader *loader);
 const GeditEncoding	*gedit_document_loader_get_encoding	(GeditDocumentLoader *loader);
 
 /* Returns 0 if file size is unknown */
-/* FIXME: change GnomeVFSFileSize to what glib provides. */
-GnomeVFSFileSize	 gedit_document_loader_get_file_size	(GeditDocumentLoader *loader);
+goffset			 gedit_document_loader_get_file_size	(GeditDocumentLoader *loader);
 
-GnomeVFSFileSize	 gedit_document_loader_get_bytes_read	(GeditDocumentLoader *loader);
+goffset			 gedit_document_loader_get_bytes_read	(GeditDocumentLoader *loader);
 
 
 G_END_DECLS
diff --git a/gedit/gedit-document-saver.c b/gedit/gedit-document-saver.c
index 93926cd..e923846 100644
--- a/gedit/gedit-document-saver.c
+++ b/gedit/gedit-document-saver.c
@@ -63,7 +63,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
 enum {
 	PROP_0,
 	PROP_DOCUMENT,
-	PROP_URI,
+	PROP_FILE,
 	PROP_ENCODING,
 	PROP_FLAGS
 };
@@ -82,9 +82,13 @@ gedit_document_saver_set_property (GObject      *object,
 			g_return_if_fail (saver->document == NULL);
 			saver->document = g_value_get_object (value);
 			break;
-		case PROP_URI:
-			g_return_if_fail (saver->uri == NULL);
-			saver->uri = g_value_dup_string (value);
+		case PROP_FILE:
+			g_return_if_fail (saver->file == NULL);
+			saver->file = g_value_get_object (value);
+			g_object_ref (saver->file);
+
+			/* FIXME: legacy savers */
+			saver->uri = g_file_get_uri (saver->file);
 			break;
 		case PROP_ENCODING:
 			g_return_if_fail (saver->encoding == NULL);
@@ -112,8 +116,8 @@ gedit_document_saver_get_property (GObject    *object,
 		case PROP_DOCUMENT:
 			g_value_set_object (value, saver->document);
 			break;
-		case PROP_URI:
-			g_value_set_string (value, saver->uri);
+		case PROP_FILE:
+			g_value_set_object (value, saver->file);
 			break;
 		case PROP_ENCODING:
 			g_value_set_boxed (value, saver->encoding);
@@ -133,6 +137,7 @@ gedit_document_saver_finalize (GObject *object)
 {
 	GeditDocumentSaver *saver = GEDIT_DOCUMENT_SAVER (object);
 
+	g_object_unref (saver->file);
 	g_free (saver->uri);
 	g_free (saver->backup_ext);
 
@@ -159,11 +164,11 @@ gedit_document_saver_class_init (GeditDocumentSaverClass *klass)
 							      G_PARAM_STATIC_STRINGS));
 
 	g_object_class_install_property (object_class,
-					 PROP_URI,
-					 g_param_spec_string ("uri",
-							      "URI",
-							      "The URI this GeditDocumentSaver saves the document to",
-							      "",
+					 PROP_FILE,
+					 g_param_spec_object ("file",
+							      "File",
+							      "The GFile this GeditDocumentSaver saves the document to",
+							      G_TYPE_FILE,
 							      G_PARAM_READWRITE |
 							      G_PARAM_CONSTRUCT_ONLY |
 							      G_PARAM_STATIC_STRINGS));
@@ -171,7 +176,7 @@ gedit_document_saver_class_init (GeditDocumentSaverClass *klass)
 	g_object_class_install_property (object_class,
 					 PROP_ENCODING,
 					 g_param_spec_boxed ("encoding",
-							     "URI",
+							     "Encoding",
 							     "The encoding of the saved file",
 							     GEDIT_TYPE_ENCODING,
 							     G_PARAM_READWRITE |
@@ -186,7 +191,8 @@ gedit_document_saver_class_init (GeditDocumentSaverClass *klass)
 							     GEDIT_TYPE_DOCUMENT_SAVE_FLAGS,
 							     0,
 							     G_PARAM_READWRITE |
-							     G_PARAM_CONSTRUCT_ONLY));
+							     G_PARAM_CONSTRUCT_ONLY |
+							     G_PARAM_STATIC_STRINGS));
 
 	signals[SAVING] =
 		g_signal_new ("saving",
@@ -209,7 +215,7 @@ gedit_document_saver_init (GeditDocumentSaver *saver)
 
 GeditDocumentSaver *
 gedit_document_saver_new (GeditDocument       *doc,
-			  const gchar         *uri,
+			  GFile               *file,
 			  const GeditEncoding *encoding,
 			  GeditDocumentSaveFlags flags)
 {
@@ -218,7 +224,7 @@ gedit_document_saver_new (GeditDocument       *doc,
 
 	g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
 
-	if (gedit_utils_uri_has_file_scheme (uri))
+	if (g_file_is_native (file))
 		saver_type = GEDIT_TYPE_LOCAL_DOCUMENT_SAVER;
 	else
 		saver_type = GEDIT_TYPE_GNOMEVFS_DOCUMENT_SAVER;
@@ -228,7 +234,7 @@ gedit_document_saver_new (GeditDocument       *doc,
 
 	saver = GEDIT_DOCUMENT_SAVER (g_object_new (saver_type,
 						    "document", doc,
-						    "uri", uri,
+						    "file", file,
 						    "encoding", encoding,
 						    "flags", flags,
 						    NULL));
@@ -396,13 +402,12 @@ gedit_document_saver_save (GeditDocumentSaver     *saver,
 	gedit_debug (DEBUG_SAVER);
 
 	g_return_if_fail (GEDIT_IS_DOCUMENT_SAVER (saver));
-	g_return_if_fail (saver->uri != NULL && strlen (saver->uri) > 0);
+	g_return_if_fail (G_IS_FILE (saver->file));
 
 	g_return_if_fail (saver->used == FALSE);
 	saver->used = TRUE;
 
 	// CHECK:
-	// - sanity check a max len for the uri?
 	// report async (in an idle handler) or sync (bool ret)
 	// async is extra work here, sync is special casing in the caller
 
@@ -422,11 +427,11 @@ gedit_document_saver_save (GeditDocumentSaver     *saver,
 }
 
 const gchar *
-gedit_document_saver_get_uri (GeditDocumentSaver *saver)
+gedit_document_saver_get_file (GeditDocumentSaver *saver)
 {
 	g_return_val_if_fail (GEDIT_IS_DOCUMENT_SAVER (saver), NULL);
 
-	return saver->uri;
+	return saver->file;
 }
 
 const gchar *
@@ -446,7 +451,7 @@ gedit_document_saver_get_mtime (GeditDocumentSaver *saver)
 }
 
 /* Returns 0 if file size is unknown */
-GnomeVFSFileSize
+goffset
 gedit_document_saver_get_file_size (GeditDocumentSaver *saver)
 {
 	g_return_val_if_fail (GEDIT_IS_DOCUMENT_SAVER (saver), 0);
@@ -454,7 +459,7 @@ gedit_document_saver_get_file_size (GeditDocumentSaver *saver)
 	return GEDIT_DOCUMENT_SAVER_GET_CLASS (saver)->get_file_size (saver);
 }
 
-GnomeVFSFileSize
+goffset
 gedit_document_saver_get_bytes_written (GeditDocumentSaver *saver)
 {
 	g_return_val_if_fail (GEDIT_IS_DOCUMENT_SAVER (saver), 0);
diff --git a/gedit/gedit-document-saver.h b/gedit/gedit-document-saver.h
index 077e995..e3aed00 100644
--- a/gedit/gedit-document-saver.h
+++ b/gedit/gedit-document-saver.h
@@ -33,7 +33,6 @@
 #define __GEDIT_DOCUMENT_SAVER_H__
 
 #include <gedit/gedit-document.h>
-#include <libgnomevfs/gnome-vfs-file-size.h>
 
 G_BEGIN_DECLS
 
@@ -60,6 +59,7 @@ struct _GeditDocumentSaver
 	GeditDocument		 *document;
 	gboolean		  used;
 
+	GFile                    *file;
 	gchar			 *uri;
 	const GeditEncoding      *encoding;
 
@@ -85,12 +85,12 @@ struct _GeditDocumentSaverClass
 			 const GError        *error);
 
 	/* VTable */
-	void			(* save)		(GeditDocumentSaver *saver,
-							 time_t              old_mtime);
-	const gchar *		(* get_mime_type)	(GeditDocumentSaver *saver);
-	time_t			(* get_mtime)		(GeditDocumentSaver *saver);
-	GnomeVFSFileSize	(* get_file_size)	(GeditDocumentSaver *saver);
-	GnomeVFSFileSize	(* get_bytes_written)	(GeditDocumentSaver *saver);
+	void		(* save)		(GeditDocumentSaver *saver,
+						 time_t              old_mtime);
+	const gchar *	(* get_mime_type)	(GeditDocumentSaver *saver);
+	time_t		(* get_mtime)		(GeditDocumentSaver *saver);
+	goffset		(* get_file_size)	(GeditDocumentSaver *saver);
+	goffset		(* get_bytes_written)	(GeditDocumentSaver *saver);
 };
 
 /*
@@ -100,7 +100,7 @@ GType 		 	 gedit_document_saver_get_type		(void) G_GNUC_CONST;
 
 /* If enconding == NULL, the encoding will be autodetected */
 GeditDocumentSaver 	*gedit_document_saver_new 		(GeditDocument        *doc,
-								 const gchar          *uri,
+								 GFile                *file,
 								 const GeditEncoding  *encoding,
 								 GeditDocumentSaveFlags flags);
 
@@ -119,7 +119,7 @@ void			 gedit_document_saver_save		(GeditDocumentSaver  *saver,
 void			 gedit_document_saver_cancel		(GeditDocumentSaver  *saver);
 #endif
 
-const gchar		*gedit_document_saver_get_uri		(GeditDocumentSaver  *saver);
+const gchar		*gedit_document_saver_get_file		(GeditDocumentSaver  *saver);
 
 /* If backup_uri is NULL no backup will be made */
 const gchar		*gedit_document_saver_get_backup_uri	(GeditDocumentSaver  *saver);
@@ -131,9 +131,9 @@ const gchar		*gedit_document_saver_get_mime_type	(GeditDocumentSaver  *saver);
 time_t			 gedit_document_saver_get_mtime		(GeditDocumentSaver  *saver);
 
 /* Returns 0 if file size is unknown */
-GnomeVFSFileSize	 gedit_document_saver_get_file_size	(GeditDocumentSaver  *saver);
+goffset			 gedit_document_saver_get_file_size	(GeditDocumentSaver  *saver);
 
-GnomeVFSFileSize	 gedit_document_saver_get_bytes_written	(GeditDocumentSaver  *saver);
+goffset			 gedit_document_saver_get_bytes_written	(GeditDocumentSaver  *saver);
 
 
 G_END_DECLS
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index 64da6ea..26748aa 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -75,12 +75,12 @@ PROFILE (static GTimer *timer = NULL)
 #define GEDIT_DOCUMENT_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), GEDIT_TYPE_DOCUMENT, GeditDocumentPrivate))
 
 static void	gedit_document_load_real	(GeditDocument          *doc,
-						 const gchar            *uri,
+						 GFile                  *file,
 						 const GeditEncoding    *encoding,
 						 gint                    line_pos,
 						 gboolean                create);
 static void	gedit_document_save_real	(GeditDocument          *doc,
-						 const gchar            *uri,
+						 GFile                  *file,
 						 const GeditEncoding    *encoding,
 						 GeditDocumentSaveFlags  flags);
 static void	gedit_document_set_readonly	(GeditDocument *doc,
@@ -105,11 +105,9 @@ struct _GeditDocumentPrivate
 	gint         stop_cursor_moved_emission : 1;
 	gint         dispose_has_run : 1;
 
-	gchar	    *uri;
+	GFile       *file;
 	gint 	     untitled_number;
 
-	GnomeVFSURI *vfs_uri;
-
 	const GeditEncoding *encoding;
 
 	gchar	    *mime_type;
@@ -222,20 +220,20 @@ gedit_document_dispose (GObject *object)
 	 * because the language is gone by the time finalize runs.
 	 * beside if some plugin prevents proper finalization by
 	 * holding a ref to the doc, we still save the metadata */
-	if ((!doc->priv->dispose_has_run) && (doc->priv->uri != NULL))
+	if (!doc->priv->dispose_has_run && doc->priv->file != NULL)
 	{
 		GtkTextIter iter;
 		gchar *position;
 
 		gtk_text_buffer_get_iter_at_mark (
-				GTK_TEXT_BUFFER (doc),			
+				GTK_TEXT_BUFFER (doc),
 				&iter,
 				gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (doc)));
 
 		position = g_strdup_printf ("%d", 
 					    gtk_text_iter_get_offset (&iter));
 
-		gedit_metadata_manager_set (doc->priv->uri,
+		gedit_metadata_manager_set (doc->priv->file,
 					    "position",
 					    position);
 		g_free (position);
@@ -246,7 +244,7 @@ gedit_document_dispose (GObject *object)
 
 			lang = gedit_document_get_language (doc);
 
-			gedit_metadata_manager_set (doc->priv->uri,
+			gedit_metadata_manager_set (doc->priv->file,
 				    "language",
 				    (lang == NULL) ? "_NORMAL_" : gtk_source_language_get_id (lang));
 		}
@@ -272,13 +270,12 @@ gedit_document_finalize (GObject *object)
 
 	if (doc->priv->untitled_number > 0)
 	{
-		g_return_if_fail (doc->priv->uri == NULL);
+		g_return_if_fail (doc->priv->file == NULL);
 		release_untitled_number (doc->priv->untitled_number);
 	}
 
-	g_free (doc->priv->uri);
-	if (doc->priv->vfs_uri != NULL)
-		gnome_vfs_uri_unref (doc->priv->vfs_uri);
+	if (doc->priv->file != NULL)
+		g_object_unref (doc->priv->file);
 
 	g_free (doc->priv->mime_type);
 	g_free (doc->priv->search_text);
@@ -303,7 +300,7 @@ gedit_document_get_property (GObject    *object,
 	switch (prop_id)
 	{
 		case PROP_URI:
-			g_value_set_string (value, doc->priv->uri);
+			g_value_take_string (value, g_file_get_uri (doc->priv->file));
 			break;
 		case PROP_SHORTNAME:
 			g_value_take_string (value, gedit_document_get_short_name_for_display (doc));
@@ -477,7 +474,7 @@ gedit_document_class_init (GeditDocumentClass *klass)
 	/**
 	 * GeditDocument::load:
 	 * @document: the #GeditDocument.
-	 * @uri: the uri where to load the document from.
+	 * @file: the file where to load the document from.
 	 * @encoding: the #GeditEncoding to encode the document.
 	 * @line_pos: the line to show.
 	 * @create: whether the document should be created if it doesn't exist.
@@ -492,10 +489,10 @@ gedit_document_class_init (GeditDocumentClass *klass)
 			      G_SIGNAL_RUN_LAST,
 			      G_STRUCT_OFFSET (GeditDocumentClass, load),
 			      NULL, NULL,
-			      gedit_marshal_VOID__STRING_BOXED_INT_BOOLEAN,
+			      gedit_marshal_VOID__OBJECT_BOXED_INT_BOOLEAN,
 			      G_TYPE_NONE,
 			      4,
-			      G_TYPE_STRING,
+			      G_TYPE_FILE,
 			      /* we rely on the fact that the GeditEncoding pointer stays
 			       * the same forever */
 			      GEDIT_TYPE_ENCODING | G_SIGNAL_TYPE_STATIC_SCOPE,
@@ -529,7 +526,7 @@ gedit_document_class_init (GeditDocumentClass *klass)
 	/**
 	 * GeditDocument::save:
 	 * @document: the #GeditDocument.
-	 * @uri: the uri where the document is about to be saved.
+	 * @file: the file where the document is about to be saved.
 	 * @encoding: the #GeditEncoding used to save the document.
 	 * @flags: the #GeditDocumentSaveFlags for the save operation.
 	 *
@@ -543,10 +540,10 @@ gedit_document_class_init (GeditDocumentClass *klass)
 			      G_SIGNAL_RUN_LAST,
 			      G_STRUCT_OFFSET (GeditDocumentClass, save),
 			      NULL, NULL,
-			      gedit_marshal_VOID__STRING_BOXED_FLAGS,
+			      gedit_marshal_VOID__OBJECT_BOXED_FLAGS,
 			      G_TYPE_NONE,
 			      3,
-			      G_TYPE_STRING,
+			      G_TYPE_FILE,
 			      /* we rely on the fact that the GeditEncoding pointer stays
 			       * the same forever */
 			      GEDIT_TYPE_ENCODING | G_SIGNAL_TYPE_STATIC_SCOPE,
@@ -613,9 +610,9 @@ set_language (GeditDocument     *doc,
 		gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (doc), 
 				 FALSE);
 
-	if (set_by_user && (doc->priv->uri != NULL))
+	if (set_by_user && doc->priv->file != NULL)
 	{
-		gedit_metadata_manager_set (doc->priv->uri,
+		gedit_metadata_manager_set (doc->priv->file,
 			    "language",
 			    (lang == NULL) ? "_NORMAL_" : gtk_source_language_get_id (lang));
 	}
@@ -640,10 +637,9 @@ set_encoding (GeditDocument       *doc,
 	if (set_by_user)
 	{
 		const gchar *charset;
-
 		charset = gedit_encoding_get_charset (encoding);
 
-		gedit_metadata_manager_set (doc->priv->uri,
+		gedit_metadata_manager_set (doc->priv->file,
 					    "encoding",
 					    charset);
 	}
@@ -687,8 +683,7 @@ gedit_document_init (GeditDocument *doc)
 
 	doc->priv = GEDIT_DOCUMENT_GET_PRIVATE (doc);
 
-	doc->priv->uri = NULL;
-	doc->priv->vfs_uri = NULL;
+	doc->priv->file = NULL;
 	doc->priv->untitled_number = get_untitled_number ();
 
 	doc->priv->mime_type = g_strdup ("text/plain");
@@ -742,30 +737,27 @@ gedit_document_new (void)
 }
 
 /* If mime type is null, we guess from the filename */
-/* If uri is null, we only set the mime-type */
+/* If file is null, we only set the mime-type */
 static void
-set_uri (GeditDocument *doc,
-	 const gchar   *uri,
-	 const gchar   *mime_type)
+set_file (GeditDocument *doc,
+	  GFile         *file,
+	  const gchar   *mime_type)
 {
 	gedit_debug (DEBUG_DOCUMENT);
 
-	g_return_if_fail ((uri == NULL) || gedit_utils_is_valid_uri (uri));
+	g_return_if_fail (file == NULL || G_IS_FILE (file));
 
-	if (uri != NULL)
+	if (file != NULL)
 	{
-		if (doc->priv->uri == uri)
-			return;
-
-		g_free (doc->priv->uri);
-		doc->priv->uri = g_strdup (uri);
-
-		if (doc->priv->vfs_uri != NULL)
-			gnome_vfs_uri_unref (doc->priv->vfs_uri);
+		if (doc->priv->file != NULL)
+		{
+			if (g_file_equal (doc->priv->file, file))
+				return;
+			g_object_unref (doc->priv->file);
+		}
 
-		/* Note: vfs_uri may be NULL for some valid but
-		 * unsupported uris */
-		doc->priv->vfs_uri = gnome_vfs_uri_new (uri);
+		doc->priv->file = file;
+		g_object_ref (file);
 
 		if (doc->priv->untitled_number > 0)
 		{
@@ -781,23 +773,35 @@ set_uri (GeditDocument *doc,
 	}
 	else
 	{
-		gchar *base_name = NULL;
+		gchar *basename = NULL;
 
 		/* Guess the mime type from file extension or fallback to "text/plain" */
-		if (doc->priv->vfs_uri != NULL)
-			base_name = gnome_vfs_uri_extract_short_path_name (doc->priv->vfs_uri);
-		if (base_name != NULL)
-		{
-			const gchar *detected_mime;
+		if (doc->priv->file != NULL)
+			basename = g_file_get_basename (doc->priv->file);
 
-			detected_mime = gnome_vfs_get_mime_type_for_name (base_name);
-			if (detected_mime == NULL ||
-			    strcmp (GNOME_VFS_MIME_TYPE_UNKNOWN, detected_mime) == 0)
-				detected_mime = "text/plain";
+		if (basename != NULL)
+		{
+			GFileInfo *info;
 
-			doc->priv->mime_type = g_strdup (detected_mime);
+			info = g_file_query_info (doc->priv->file,
+						  "standard::fast-content-type",
+						  G_FILE_QUERY_INFO_NONE,
+						  NULL, NULL);
+			
+			if (info != NULL)
+			{
+				const gchar *detected_mime;
+				detected_mime = g_file_info_get_attribute_string (info,
+										  "standard::fast-content-type");
+				doc->priv->mime_type = g_strdup (detected_mime);
+				g_object_unref (info);
+			}
+			else
+			{
+				doc->priv->mime_type = g_strdup ("text/plain");
+			}
 
-			g_free (base_name);
+			g_free (basename);
 		}
 		else
 		{
@@ -810,7 +814,7 @@ set_uri (GeditDocument *doc,
 		gchar *data;
 		GtkSourceLanguage *language = NULL;
 
-		data = gedit_metadata_manager_get (doc->priv->uri, "language");
+		data = gedit_metadata_manager_get (doc->priv->file, "language");
 
 		if (data != NULL)
 		{
@@ -849,7 +853,10 @@ gedit_document_get_uri (GeditDocument *doc)
 {
 	g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
 
-	return g_strdup (doc->priv->uri);
+	if (doc->priv->file != NULL)
+		return g_file_get_uri (doc->priv->file);
+	else
+		return NULL;
 }
 
 /* Never returns NULL */
@@ -858,47 +865,32 @@ gedit_document_get_uri_for_display (GeditDocument *doc)
 {
 	g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), "");
 
-	if (doc->priv->uri == NULL)
+	if (doc->priv->file == NULL)
 		return g_strdup_printf (_("Unsaved Document %d"),
 					doc->priv->untitled_number);
-	else if (doc->priv->vfs_uri == NULL)
-		return gnome_vfs_format_uri_for_display (doc->priv->uri);
 	else
-	{	
-		gchar *name;
-		gchar *uri_for_display;
-		
-		name = gnome_vfs_uri_to_string (doc->priv->vfs_uri, GNOME_VFS_URI_HIDE_PASSWORD);
-		g_return_val_if_fail (name != NULL, gnome_vfs_format_uri_for_display (doc->priv->uri));
-		
-		uri_for_display = gnome_vfs_format_uri_for_display (name);
-		g_free (name);
-		
-		return uri_for_display;
-	}
+		return g_file_get_parse_name (doc->priv->file);
 }
 
 /* move to gedit-utils? */
 static gchar *
-get_uri_shortname_for_display (GnomeVFSURI *uri)
+get_uri_shortname_for_display (GFile *file)
 {
-	gchar *name;	
-	gboolean  validated;
+	gchar *name;
+	gboolean validated;
 
 	validated = FALSE;
 
-	name = gnome_vfs_uri_extract_short_name (uri);
-	
+	name = g_file_get_basename (file);
+
 	if (name == NULL)
 	{
-		name = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_PASSWORD);
+		name = g_file_get_parse_name (file);
 	}
-	else if (g_ascii_strcasecmp (uri->method_string, "file") == 0)
+	else if (g_file_is_native (file))
 	{
-		gchar *text_uri;
 		gchar *local_file;
-		text_uri = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_PASSWORD);
-		local_file = gnome_vfs_get_local_path_from_uri (text_uri);
+		local_file = g_file_get_path (file);
 
 		if (local_file != NULL)
 		{
@@ -908,30 +900,6 @@ get_uri_shortname_for_display (GnomeVFSURI *uri)
 		}
 
 		g_free (local_file);
-		g_free (text_uri);
-	} 
-	else if (!gnome_vfs_uri_has_parent (uri)) 
-	{
-		const gchar *method;
-
-		method = uri->method_string;
-
-		if (name == NULL ||
-		    strcmp (name, GNOME_VFS_URI_PATH_STR) == 0) 
-		{
-			g_free (name);
-			name = g_strdup (method);
-		} 
-		/*
-		else 
-		{
-			gchar *tmp;
-
-			tmp = name;
-			name = g_strdup_printf ("%s: %s", method, name);
-			g_free (tmp);
-		}
-		*/
 	}
 
 	if (!validated && !g_utf8_validate (name, -1, NULL)) 
@@ -950,23 +918,21 @@ get_uri_shortname_for_display (GnomeVFSURI *uri)
 gchar *
 gedit_document_get_short_name_for_display (GeditDocument *doc)
 {
-	g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), "");
+	g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), g_strdup (""));
 
-	if (doc->priv->uri == NULL)
+	if (doc->priv->file == NULL)
 		return g_strdup_printf (_("Unsaved Document %d"),
 					doc->priv->untitled_number);	      
-	else if (doc->priv->vfs_uri == NULL)
-		return g_strdup (doc->priv->uri);
 	else
-		return get_uri_shortname_for_display (doc->priv->vfs_uri);
+		return get_uri_shortname_for_display (doc->priv->file);
 }
 
 /* Never returns NULL */
 gchar *
 gedit_document_get_mime_type (GeditDocument *doc)
 {
-	g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), "text/plain");
-	g_return_val_if_fail (doc->priv->mime_type != NULL, "text/plain");
+	g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), g_strdup ("text/plain"));
+	g_return_val_if_fail (doc->priv->mime_type != NULL, g_strdup ("text/plain"));
 
  	return g_strdup (doc->priv->mime_type);
 }
@@ -1010,38 +976,26 @@ gedit_document_get_readonly (GeditDocument *doc)
 gboolean
 _gedit_document_check_externally_modified (GeditDocument *doc)
 {
-	GnomeVFSFileInfo *info;
-	GnomeVFSResult result;
-	gboolean res = FALSE;
+	GFileInfo *info;
+	GTimeVal tv;
 
 	g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
 
-	if (doc->priv->uri == NULL)
-	{
+	if (doc->priv->file == NULL)
 		return FALSE;
-	}
-
-	info = gnome_vfs_file_info_new ();
 
-	result = gnome_vfs_get_file_info_uri (doc->priv->vfs_uri,
-					      info,
-					      GNOME_VFS_FILE_INFO_DEFAULT|
-					      GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
-	if (result != GNOME_VFS_OK)
-	{
-		gnome_vfs_file_info_unref (info);
+	info = g_file_query_info (doc->priv->file,
+				  "time::changed",
+				  G_FILE_QUERY_INFO_NONE,
+				  NULL, NULL);
 
+	if (info == NULL)
 		return FALSE;
-	}
-
-	if (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MTIME)
-	{
-		res = info->mtime > doc->priv->mtime;
-	}
 
-	gnome_vfs_file_info_unref (info);
+	g_file_info_get_modification_time (info, &tv);
+	g_object_unref (info);
 
-	return res;
+	return tv.tv_sec > doc->priv->mtime;
 }
 
 static void
@@ -1080,7 +1034,7 @@ document_loader_loaded (GeditDocumentLoader *loader,
 			      (doc->priv->requested_encoding != NULL));
 		      
 		/* We already set the uri */
-		set_uri (doc, NULL, mime_type);
+		set_file (doc, NULL, mime_type);
 
 		/* move the cursor at the requested line if any */
 		if (doc->priv->requested_line_pos > 0)
@@ -1095,8 +1049,9 @@ document_loader_loaded (GeditDocumentLoader *loader,
 		{
 			gchar *pos;
 			gint offset;
+			gchar *uri;
 
-			pos = gedit_metadata_manager_get (doc->priv->uri,
+			pos = gedit_metadata_manager_get (doc->priv->file,
 							  "position");
 
 			offset = pos ? atoi (pos) : 0;
@@ -1127,8 +1082,8 @@ document_loader_loaded (GeditDocumentLoader *loader,
 
 	/* special case creating a named new doc */
 	else if (doc->priv->create &&
-	         (error->code == GNOME_VFS_ERROR_NOT_FOUND) &&
-	         (gedit_utils_uri_has_file_scheme (doc->priv->uri)))
+	         error->code == GNOME_VFS_ERROR_NOT_FOUND &&
+	         g_file_is_native (doc->priv->file))
 	{
 		reset_temp_loading_data (doc);
 
@@ -1176,15 +1131,16 @@ document_loader_loading (GeditDocumentLoader *loader,
 
 static void
 gedit_document_load_real (GeditDocument       *doc,
-			  const gchar         *uri,
+			  GFile               *file,
 			  const GeditEncoding *encoding,
 			  gint                 line_pos,
 			  gboolean             create)
 {
 	g_return_if_fail (doc->priv->loader == NULL);
+	g_return_if_fail (file != NULL);
 
 	/* create a loader. It will be destroyed when loading is completed */
-	doc->priv->loader = gedit_document_loader_new (doc, uri, encoding);
+	doc->priv->loader = gedit_document_loader_new (doc, file, encoding);
 
 	g_signal_connect (doc->priv->loader,
 			  "loading",
@@ -1195,7 +1151,7 @@ gedit_document_load_real (GeditDocument       *doc,
 	doc->priv->requested_encoding = encoding;
 	doc->priv->requested_line_pos = line_pos;
 
-	set_uri (doc, uri, NULL);
+	set_file (doc, file, NULL);
 
 	gedit_document_loader_load (doc->priv->loader);
 }
@@ -1217,11 +1173,16 @@ gedit_document_load (GeditDocument       *doc,
 		     gint                 line_pos,
 		     gboolean             create)
 {
+	GFile *file;
+
 	g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
 	g_return_if_fail (uri != NULL);
 	g_return_if_fail (gedit_utils_is_valid_uri (uri));
 
-	g_signal_emit (doc, document_signals[LOAD], 0, uri, encoding, line_pos, create);
+	file = g_file_new_for_uri (uri);
+	g_print ("%s\n", g_file_get_uri (file));
+
+	g_signal_emit (doc, document_signals[LOAD], 0, file, encoding, line_pos, create);
 }
 
 gboolean
@@ -1248,10 +1209,10 @@ document_saver_saving (GeditDocumentSaver *saver,
 		/* save was successful */
 		if (error == NULL)
 		{
-			const gchar *uri;
 			const gchar *mime_type;
+			GFile *file;
 
-			uri = gedit_document_saver_get_uri (saver);
+			file = gedit_document_saver_get_file (saver);
 			mime_type = gedit_document_saver_get_mime_type (saver);
 
 			doc->priv->mtime = gedit_document_saver_get_mtime (saver);
@@ -1263,7 +1224,7 @@ document_saver_saving (GeditDocumentSaver *saver,
 			gtk_text_buffer_set_modified (GTK_TEXT_BUFFER (doc),
 						      FALSE);
 
-			set_uri (doc, uri, mime_type);
+			set_file (doc, file, mime_type);
 
 			set_encoding (doc, 
 				      doc->priv->requested_encoding, 
@@ -1299,14 +1260,14 @@ document_saver_saving (GeditDocumentSaver *saver,
 
 static void
 gedit_document_save_real (GeditDocument          *doc,
-			  const gchar            *uri,
+			  GFile                  *file,
 			  const GeditEncoding    *encoding,
 			  GeditDocumentSaveFlags  flags)
 {
 	g_return_if_fail (doc->priv->saver == NULL);
 
 	/* create a saver, it will be destroyed once saving is complete */
-	doc->priv->saver = gedit_document_saver_new (doc, uri, encoding, flags);
+	doc->priv->saver = gedit_document_saver_new (doc, file, encoding, flags);
 
 	g_signal_connect (doc->priv->saver,
 			  "saving",
@@ -1332,12 +1293,12 @@ gedit_document_save (GeditDocument          *doc,
 		     GeditDocumentSaveFlags  flags)
 {
 	g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
-	g_return_if_fail (doc->priv->uri != NULL);
+	g_return_if_fail (doc->priv->file != NULL);
 
 	g_signal_emit (doc,
 		       document_signals[SAVE],
 		       0,
-		       doc->priv->uri,
+		       doc->priv->file,
 		       doc->priv->encoding,
 		       flags);
 }
@@ -1358,16 +1319,20 @@ gedit_document_save_as (GeditDocument          *doc,
 			const GeditEncoding    *encoding,
 			GeditDocumentSaveFlags  flags)
 {
+	GFile *file;
+
 	g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
 	g_return_if_fail (uri != NULL);
 	g_return_if_fail (encoding != NULL);
 
+	file = g_file_new_for_uri (uri);
+
 	/* priv->mtime refers to the the old uri (if any). Thus, it should be
 	 * ignored when saving as. */
 	g_signal_emit (doc,
 		       document_signals[SAVE],
 		       0,
-		       uri,
+		       file,
 		       encoding,
 		       flags | GEDIT_DOCUMENT_SAVE_IGNORE_MTIME);
 }
@@ -1393,8 +1358,8 @@ gedit_document_is_untouched (GeditDocument *doc)
 {
 	g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), TRUE);
 
-	return (doc->priv->uri == NULL) && 
-		(!gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc)));
+	return doc->priv->file == NULL && 
+			!gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc));
 }
 
 gboolean 
@@ -1402,7 +1367,7 @@ gedit_document_is_untitled (GeditDocument *doc)
 {
 	g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), TRUE);
 
-	return (doc->priv->uri == NULL);
+	return (doc->priv->file == NULL);
 }
 
 gboolean
@@ -1410,12 +1375,7 @@ gedit_document_is_local (GeditDocument *doc)
 {
 	g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
 
-	if (doc->priv->uri == NULL)
-	{
-		return FALSE;
-	}
-
-	return gedit_utils_uri_has_file_scheme (doc->priv->uri);
+	return doc->priv->file != NULL && g_file_is_native (doc->priv->file);
 }
 
 gboolean
@@ -1423,10 +1383,10 @@ gedit_document_get_deleted (GeditDocument *doc)
 {
 	g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
 
-	if (doc->priv->uri == NULL || doc->priv->vfs_uri == NULL)
+	if (doc->priv->file == NULL)
 		return FALSE;
-		
-	return !gnome_vfs_uri_exists (doc->priv->vfs_uri);
+
+	return !g_file_query_exists (doc->priv->file, NULL);
 }
 
 /*
diff --git a/gedit/gedit-document.h b/gedit/gedit-document.h
index 74e88dd..f0457fa 100644
--- a/gedit/gedit-document.h
+++ b/gedit/gedit-document.h
@@ -103,7 +103,7 @@ struct _GeditDocumentClass
 
 	/* Document load */
 	void (* load)			(GeditDocument       *document,
-					 const gchar         *uri,
+					 GFile               *file,
 					 const GeditEncoding *encoding,
 					 gint                 line_pos,
 					 gboolean             create);
@@ -117,7 +117,7 @@ struct _GeditDocumentClass
 
 	/* Document save */
 	void (* save)			(GeditDocument          *document,
-					 const gchar            *uri,
+					 GFile                  *file,
 					 const GeditEncoding    *encoding,
 					 GeditDocumentSaveFlags  flags);
 
diff --git a/gedit/gedit-gio-document-loader.c b/gedit/gedit-gio-document-loader.c
index 7f924cb..e39ce46 100644
--- a/gedit/gedit-gio-document-loader.c
+++ b/gedit/gedit-gio-document-loader.c
@@ -45,17 +45,14 @@ static void		 gedit_gio_document_loader_load			(GeditDocumentLoader *loader);
 static gboolean		 gedit_gio_document_loader_cancel		(GeditDocumentLoader *loader);
 static const gchar	*gedit_gio_document_loader_get_mime_type	(GeditDocumentLoader *loader);
 static time_t		 gedit_gio_document_loader_get_mtime		(GeditDocumentLoader *loader);
-static GnomeVFSFileSize	 gedit_gio_document_loader_get_file_size	(GeditDocumentLoader *loader);
-static GnomeVFSFileSize	 gedit_gio_document_loader_get_bytes_read	(GeditDocumentLoader *loader);
+static goffset		 gedit_gio_document_loader_get_file_size	(GeditDocumentLoader *loader);
+static goffset		 gedit_gio_document_loader_get_bytes_read	(GeditDocumentLoader *loader);
 static gboolean		 gedit_gio_document_loader_get_readonly		(GeditDocumentLoader *loader);
 
 #define READ_CHUNK_SIZE 8192
 
 struct _GeditGIODocumentLoaderPrivate
 {
-	/* Info on the current file */
-	GFile                *file;
-
 	GFileInfo            *info;
 	GInputStream         *stream;
 	GCancellable         *cancellable;
@@ -80,9 +77,6 @@ gedit_gio_document_loader_finalize (GObject *object)
 
 	g_free (priv->buffer);
 
-	if (priv->file)
-		g_object_unref (priv->file);
-
 	if (priv->cancellable)
 		g_object_unref (priv->cancellable);
 
@@ -247,17 +241,13 @@ gedit_gio_document_loader_load (GeditDocumentLoader *loader)
 {
 	GeditGIODocumentLoader *gloader = GEDIT_GIO_DOCUMENT_LOADER (loader);
 
-	gloader->priv->file = g_file_new_for_uri (loader->uri);
-
-	g_file_read_async (gloader->priv->file,
+	g_file_read_async (loader->file,
 			   G_PRIORITY_DEFAULT,
 			   gloader->priv->cancellable,
 			   (GAsyncReadyCallback) async_open_callback,
 			   gloader);
 
-	gedit_document_loader_loading (GEDIT_DOCUMENT_LOADER (gloader),
-				       FALSE,
-				       NULL);
+	gedit_document_loader_loading (loader, FALSE, NULL);
 }
 
 static const gchar *
@@ -287,7 +277,7 @@ gedit_gio_document_loader_get_mtime (GeditDocumentLoader *loader)
 }
 
 /* Returns 0 if file size is unknown */
-static GnomeVFSFileSize
+static goffset
 gedit_gio_document_loader_get_file_size (GeditDocumentLoader *loader)
 {
 	GeditGIODocumentLoader *gloader = GEDIT_GIO_DOCUMENT_LOADER (loader);
@@ -298,7 +288,7 @@ gedit_gio_document_loader_get_file_size (GeditDocumentLoader *loader)
 		return 0;
 }
 
-static GnomeVFSFileSize
+static goffset
 gedit_gio_document_loader_get_bytes_read (GeditDocumentLoader *loader)
 {
 	GeditGIODocumentLoader *gloader = GEDIT_GIO_DOCUMENT_LOADER (loader);
diff --git a/gedit/gedit-gnomevfs-document-loader.c b/gedit/gedit-gnomevfs-document-loader.c
index f9aea33..9e2064b 100644
--- a/gedit/gedit-gnomevfs-document-loader.c
+++ b/gedit/gedit-gnomevfs-document-loader.c
@@ -53,8 +53,8 @@ static void		 gedit_gnomevfs_document_loader_load		(GeditDocumentLoader *loader)
 static gboolean		 gedit_gnomevfs_document_loader_cancel		(GeditDocumentLoader *loader);
 static const gchar	*gedit_gnomevfs_document_loader_get_mime_type	(GeditDocumentLoader *loader);
 static time_t		 gedit_gnomevfs_document_loader_get_mtime	(GeditDocumentLoader *loader);
-static GnomeVFSFileSize	 gedit_gnomevfs_document_loader_get_file_size	(GeditDocumentLoader *loader);
-static GnomeVFSFileSize	 gedit_gnomevfs_document_loader_get_bytes_read	(GeditDocumentLoader *loader);
+static goffset		 gedit_gnomevfs_document_loader_get_file_size	(GeditDocumentLoader *loader);
+static goffset		 gedit_gnomevfs_document_loader_get_bytes_read	(GeditDocumentLoader *loader);
 static gboolean		 gedit_gnomevfs_document_loader_get_readonly	(GeditDocumentLoader *loader);
 
 
@@ -436,21 +436,21 @@ gedit_gnomevfs_document_loader_get_mtime (GeditDocumentLoader *loader)
 }
 
 /* Returns 0 if file size is unknown */
-static GnomeVFSFileSize
+static goffset
 gedit_gnomevfs_document_loader_get_file_size (GeditDocumentLoader *loader)
 {
 	GeditGnomeVFSDocumentLoader *gvloader = GEDIT_GNOMEVFS_DOCUMENT_LOADER (loader);
 
 	if (gvloader->priv->info == NULL)
-		return (GnomeVFSFileSize) 0;
+		return (goffset) 0;
 
-	return (GnomeVFSFileSize) gvloader->priv->info->size;
+	return (goffset) gvloader->priv->info->size;
 }
 
-static GnomeVFSFileSize
+static goffset
 gedit_gnomevfs_document_loader_get_bytes_read (GeditDocumentLoader *loader)
 {
-	return GEDIT_GNOMEVFS_DOCUMENT_LOADER (loader)->priv->bytes_read;
+	return (goffset) GEDIT_GNOMEVFS_DOCUMENT_LOADER (loader)->priv->bytes_read;
 }
 
 static gboolean
diff --git a/gedit/gedit-gnomevfs-document-saver.c b/gedit/gedit-gnomevfs-document-saver.c
index a435a70..ead8254 100644
--- a/gedit/gedit-gnomevfs-document-saver.c
+++ b/gedit/gedit-gnomevfs-document-saver.c
@@ -46,8 +46,8 @@ static void		 gedit_gnomevfs_document_saver_save			(GeditDocumentSaver *saver,
 										 time_t              old_mtime);
 static const gchar 	*gedit_gnomevfs_document_saver_get_mime_type		(GeditDocumentSaver *saver);
 static time_t		 gedit_gnomevfs_document_saver_get_mtime		(GeditDocumentSaver *saver);
-static GnomeVFSFileSize	 gedit_gnomevfs_document_saver_get_file_size		(GeditDocumentSaver *saver);
-static GnomeVFSFileSize	 gedit_gnomevfs_document_saver_get_bytes_written	(GeditDocumentSaver *saver);
+static goffset		 gedit_gnomevfs_document_saver_get_file_size		(GeditDocumentSaver *saver);
+static goffset		 gedit_gnomevfs_document_saver_get_bytes_written	(GeditDocumentSaver *saver);
 
 struct _GeditGnomeVFSDocumentSaverPrivate
 {
@@ -526,14 +526,14 @@ gedit_gnomevfs_document_saver_get_mtime (GeditDocumentSaver *saver)
 	return GEDIT_GNOMEVFS_DOCUMENT_SAVER (saver)->priv->doc_mtime;
 }
 
-static GnomeVFSFileSize
+static goffset
 gedit_gnomevfs_document_saver_get_file_size (GeditDocumentSaver *saver)
 {
-	return GEDIT_GNOMEVFS_DOCUMENT_SAVER (saver)->priv->size;
+	return (goffset) GEDIT_GNOMEVFS_DOCUMENT_SAVER (saver)->priv->size;
 }
 
-static GnomeVFSFileSize
+static goffset
 gedit_gnomevfs_document_saver_get_bytes_written (GeditDocumentSaver *saver)
 {
-	return GEDIT_GNOMEVFS_DOCUMENT_SAVER (saver)->priv->bytes_written;
+	return (goffset) GEDIT_GNOMEVFS_DOCUMENT_SAVER (saver)->priv->bytes_written;
 }
diff --git a/gedit/gedit-local-document-saver.c b/gedit/gedit-local-document-saver.c
index f743e7b..b1ceb87 100644
--- a/gedit/gedit-local-document-saver.c
+++ b/gedit/gedit-local-document-saver.c
@@ -61,22 +61,22 @@ static void		 gedit_local_document_saver_save		(GeditDocumentSaver *saver,
 									 time_t              old_mtime);
 static const gchar 	*gedit_local_document_saver_get_mime_type	(GeditDocumentSaver *saver);
 static time_t		 gedit_local_document_saver_get_mtime		(GeditDocumentSaver *saver);
-static GnomeVFSFileSize	 gedit_local_document_saver_get_file_size	(GeditDocumentSaver *saver);
-static GnomeVFSFileSize	 gedit_local_document_saver_get_bytes_written	(GeditDocumentSaver *saver);
+static goffset		 gedit_local_document_saver_get_file_size	(GeditDocumentSaver *saver);
+static goffset		 gedit_local_document_saver_get_bytes_written	(GeditDocumentSaver *saver);
 
 
 struct _GeditLocalDocumentSaverPrivate
 {
-	GnomeVFSFileSize	  size;
-	GnomeVFSFileSize	  bytes_written;
+	goffset	  size;
+	goffset	  bytes_written;
 
 	/* temp data for local files */
-	gint			  fd;
-	gchar			 *local_path;
-	gchar                    *mime_type; //CHECK use FileInfo instead?
-	time_t                    doc_mtime;
+	gint	  fd;
+	gchar	 *local_path;
+	gchar	 *mime_type; //CHECK use FileInfo instead?
+	time_t	  doc_mtime;
 
-	GError                   *error;
+	GError	 *error;
 };
 
 G_DEFINE_TYPE(GeditLocalDocumentSaver, gedit_local_document_saver, GEDIT_TYPE_DOCUMENT_SAVER)
@@ -873,13 +873,13 @@ gedit_local_document_saver_get_mtime (GeditDocumentSaver *saver)
 	return GEDIT_LOCAL_DOCUMENT_SAVER (saver)->priv->doc_mtime;
 }
 
-static GnomeVFSFileSize
+static goffset
 gedit_local_document_saver_get_file_size (GeditDocumentSaver *saver)
 {
 	return GEDIT_LOCAL_DOCUMENT_SAVER (saver)->priv->size;
 }
 
-static GnomeVFSFileSize
+static goffset
 gedit_local_document_saver_get_bytes_written (GeditDocumentSaver *saver)
 {
 	return GEDIT_LOCAL_DOCUMENT_SAVER (saver)->priv->bytes_written;
diff --git a/gedit/gedit-marshal.list b/gedit/gedit-marshal.list
index b998403..5a75ce9 100644
--- a/gedit/gedit-marshal.list
+++ b/gedit/gedit-marshal.list
@@ -5,8 +5,8 @@ VOID:BOOLEAN,POINTER
 VOID:BOXED,BOXED
 VOID:OBJECT
 VOID:POINTER
-VOID:STRING,BOXED,FLAGS
-VOID:STRING,BOXED,INT,BOOLEAN
+VOID:OBJECT,BOXED,FLAGS
+VOID:OBJECT,BOXED,INT,BOOLEAN
 VOID:UINT,POINTER
 VOID:UINT64,UINT64
 VOID:VOID
diff --git a/gedit/gedit-metadata-manager.c b/gedit/gedit-metadata-manager.c
index 3dd34ac..0353936 100644
--- a/gedit/gedit-metadata-manager.c
+++ b/gedit/gedit-metadata-manager.c
@@ -298,17 +298,16 @@ load_values ()
 }
 
 gchar *
-gedit_metadata_manager_get (const gchar *uri,
+gedit_metadata_manager_get (GFile       *file,
 			    const gchar *key)
 {
+	gchar *uri;
 	Item *item;
 	gchar *value;
 
-	g_return_val_if_fail (uri != NULL, NULL);
+	g_return_val_if_fail (G_IS_FILE (file), NULL);
 	g_return_val_if_fail (key != NULL, NULL);
 
-	gedit_debug_message (DEBUG_METADATA, "URI: %s --- key: %s", uri, key );
-
 	gedit_metadata_manager_init ();
 
 	if (!gedit_metadata_manager->values_loaded)
@@ -321,8 +320,11 @@ gedit_metadata_manager_get (const gchar *uri,
 			return NULL;
 	}
 
+	uri = g_file_get_uri (file);
+	gedit_debug_message (DEBUG_METADATA, "URI: %s --- key: %s", uri, key );
 	item = (Item *)g_hash_table_lookup (gedit_metadata_manager->items,
 					    uri);
+	g_free (uri);
 
 	if (item == NULL)
 		return NULL;
@@ -341,17 +343,16 @@ gedit_metadata_manager_get (const gchar *uri,
 }
 
 void
-gedit_metadata_manager_set (const gchar *uri,
+gedit_metadata_manager_set (GFile       *file,
 			    const gchar *key,
 			    const gchar *value)
 {
+	gchar *uri;
 	Item *item;
 
-	g_return_if_fail (uri != NULL);
+	g_return_if_fail (G_IS_FILE (file));
 	g_return_if_fail (key != NULL);
 
-	gedit_debug_message (DEBUG_METADATA, "URI: %s --- key: %s --- value: %s", uri, key, value);
-	
 	gedit_metadata_manager_init ();
 
 	if (!gedit_metadata_manager->values_loaded)
@@ -364,6 +365,8 @@ gedit_metadata_manager_set (const gchar *uri,
 			return;
 	}
 
+	uri = g_file_get_uri (file);
+	gedit_debug_message (DEBUG_METADATA, "URI: %s --- key: %s --- value: %s", uri, key, value);
 	item = (Item *)g_hash_table_lookup (gedit_metadata_manager->items,
 					    uri);
 
@@ -375,7 +378,9 @@ gedit_metadata_manager_set (const gchar *uri,
 				     g_strdup (uri),
 				     item);
 	}
-	
+
+	g_free (uri);
+
 	if (item->values == NULL)
 		 item->values = g_hash_table_new_full (g_str_hash, 
 				 		       g_str_equal, 
diff --git a/gedit/gedit-metadata-manager.h b/gedit/gedit-metadata-manager.h
index 6ee324f..ee50008 100644
--- a/gedit/gedit-metadata-manager.h
+++ b/gedit/gedit-metadata-manager.h
@@ -31,6 +31,7 @@
 #define __GEDIT_METADATA_MANAGER_H__
 
 #include <glib.h>
+#include <gio/gio.h>
 
 G_BEGIN_DECLS
 
@@ -39,9 +40,9 @@ G_BEGIN_DECLS
 void		 gedit_metadata_manager_shutdown 	(void);
 
 
-gchar		*gedit_metadata_manager_get 		(const gchar *uri,
+gchar		*gedit_metadata_manager_get 		(GFile       *file,
 					     		 const gchar *key);
-void		 gedit_metadata_manager_set		(const gchar *uri,
+void		 gedit_metadata_manager_set		(GFile       *file,
 							 const gchar *key,
 							 const gchar *value);
 
diff --git a/gedit/gedit-mmap-document-loader.c b/gedit/gedit-mmap-document-loader.c
index 116e5bb..9dd06b0 100644
--- a/gedit/gedit-mmap-document-loader.c
+++ b/gedit/gedit-mmap-document-loader.c
@@ -64,8 +64,8 @@ static void		 gedit_mmap_document_loader_load		(GeditDocumentLoader *loader);
 static gboolean		 gedit_mmap_document_loader_cancel		(GeditDocumentLoader *loader);
 static const gchar	*gedit_mmap_document_loader_get_mime_type	(GeditDocumentLoader *loader);
 static time_t		 gedit_mmap_document_loader_get_mtime		(GeditDocumentLoader *loader);
-static GnomeVFSFileSize	 gedit_mmap_document_loader_get_file_size	(GeditDocumentLoader *loader);
-static GnomeVFSFileSize	 gedit_mmap_document_loader_get_bytes_read	(GeditDocumentLoader *loader);
+static goffset		 gedit_mmap_document_loader_get_file_size	(GeditDocumentLoader *loader);
+static goffset		 gedit_mmap_document_loader_get_bytes_read	(GeditDocumentLoader *loader);
 static gboolean		 gedit_mmap_document_loader_get_readonly	(GeditDocumentLoader *loader);
 
 struct _GeditMmapDocumentLoaderPrivate
@@ -74,7 +74,7 @@ struct _GeditMmapDocumentLoaderPrivate
 	gchar            *mime_type;
 	guint             statbuf_filled : 1;
 
-	GnomeVFSFileSize  bytes_read;
+	goffset           bytes_read;
 
 	gint              fd;
 	gchar            *local_file_name;
@@ -398,17 +398,17 @@ gedit_mmap_document_loader_get_mtime (GeditDocumentLoader *loader)
 	return mloader->priv->statbuf.st_mtime;
 }
 
-static GnomeVFSFileSize
+static goffset
 gedit_mmap_document_loader_get_file_size (GeditDocumentLoader *loader)
 {
 	GeditMmapDocumentLoader *mloader = GEDIT_MMAP_DOCUMENT_LOADER (loader);
 
 	if (!mloader->priv->statbuf_filled)
-		return (GnomeVFSFileSize) 0;
-	return (GnomeVFSFileSize) mloader->priv->statbuf.st_size;
+		return 0;
+	return mloader->priv->statbuf.st_size;
 }
 
-static GnomeVFSFileSize
+static goffset
 gedit_mmap_document_loader_get_bytes_read (GeditDocumentLoader *loader)
 {
 	return GEDIT_MMAP_DOCUMENT_LOADER (loader)->priv->bytes_read;
