Index: rsvg-image.c
===================================================================
--- rsvg-image.c	(revision 1141)
+++ rsvg-image.c	(working copy)
@@ -26,11 +26,16 @@
             Caleb Moore <c.moore@student.unsw.edu.au>
 */
 
+#include "config.h"
+
 #include "rsvg-image.h"
 #include <string.h>
 #include <math.h>
 #include <errno.h>
 #include "rsvg-css.h"
+#ifdef HAVE_GIO
+#include <gio/gio.h>
+#endif
 
 static const char s_UTF8_B64Alphabet[64] = {
     0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
@@ -292,66 +297,51 @@
     return array;
 }
 
-#ifdef HAVE_GNOME_VFS
+#ifdef HAVE_GIO
 
-#include <libgnomevfs/gnome-vfs.h>
-
 static GByteArray *
 rsvg_acquire_vfs_resource (const char *filename, const char *base_uri, GError ** error)
 {
     GByteArray *array;
 
-    guchar buffer[4096];
-    GnomeVFSFileSize length;
-    GnomeVFSHandle *f = NULL;
-    GnomeVFSResult res;
+    GFile *file;
+    char *data;
+    gsize size;
+    gboolean res;
 
     rsvg_return_val_if_fail (filename != NULL, NULL, error);
-    rsvg_return_val_if_fail (gnome_vfs_initialized (), NULL, error);
 
-    res = gnome_vfs_open (&f, filename, GNOME_VFS_OPEN_READ);
+    file = g_file_new_for_uri (filename);
 
-    if (res != GNOME_VFS_OK) {
-        if (base_uri) {
-            GnomeVFSURI *base = gnome_vfs_uri_new (base_uri);
-            if (base) {
-                GnomeVFSURI *uri = gnome_vfs_uri_resolve_relative (base, filename);
-                if (uri) {
-                    res = gnome_vfs_open_uri (&f, uri, GNOME_VFS_OPEN_READ);
-                    gnome_vfs_uri_unref (uri);
-                }
+    if (!(res = g_file_load_contents (file, NULL, &data, &size, NULL, error))) {
+        if (base_uri != NULL) {
+            GFile *base;
 
-                gnome_vfs_uri_unref (base);
-            }
+            g_error_free (*error);
+            *error = NULL;
+
+            g_object_unref (file);
+            base = g_file_new_for_uri (base_uri);
+            file = g_file_resolve_relative_path (base, filename);
+            g_object_unref (base);
+
+            res = g_file_load_contents (file, NULL, &data, &size, NULL, error);
         }
     }
 
-    if (res != GNOME_VFS_OK) {
-        g_set_error (error, rsvg_error_quark (), (gint) res, gnome_vfs_result_to_string (res));
-        return NULL;
-    }
+    g_object_unref (file);
 
-    /* TODO: an optimization is to use the file's size */
-    array = g_byte_array_new ();
+    if (res) {
+        array = g_byte_array_new ();
 
-    while (TRUE) {
-        res = gnome_vfs_read (f, buffer, sizeof (buffer), &length);
-        if (res == GNOME_VFS_OK && length > 0) {
-            if (g_byte_array_append (array, buffer, length) == NULL) {
-                gnome_vfs_close (f);
-                g_byte_array_free (array, TRUE);
-                return NULL;
-            }
-        } else {
-            break;
-        }
+        g_byte_array_append (array, (guint8 *)data, size);
+        g_free (data);
+    } else {
+        return NULL;
     }
 
-    gnome_vfs_close (f);
-
     return array;
 }
-
 #endif
 
 GByteArray *
@@ -368,7 +358,7 @@
     if (!arr)
         arr = rsvg_acquire_file_resource (href, base_uri, NULL);
 
-#ifdef HAVE_GNOME_VFS
+#ifdef HAVE_GIO
     if (!arr)
         arr = rsvg_acquire_vfs_resource (href, base_uri, NULL);
 #endif
Index: configure.in
===================================================================
--- configure.in	(revision 1141)
+++ configure.in	(working copy)
@@ -5,6 +5,7 @@
 FONTCONFIG_REQUIRED=1.0.1	dnl Same as in Pango, ???
 GDK_PIXBUF_REQUIRED=1.3.7
 GLIB_REQUIRED=2.12.0
+GIO_REQUIRED=2.15.4
 LIBXML_REQUIRED=2.4.7
 CAIRO_REQUIRED=1.2.0
 PANGOFT2_REQUIRED=1.2.0
@@ -12,6 +13,7 @@
 
 AC_SUBST(GDK_PIXBUF_REQUIRED)
 AC_SUBST(GLIB_REQUIRED)
+AC_SUBST(GIO_REQUIRED)
 AC_SUBST(CAIRO_REQUIRED)
 AC_SUBST(LIBXML_REQUIRED)
 AC_SUBST(PANGOFT2_REQUIRED)
@@ -77,9 +79,19 @@
 
 dnl ===========================================================================
 
-PKG_CHECK_MODULES(GLIB, \
+test_gio=true
+PKG_CHECK_EXISTS(gio-2.0 >= $GIO_REQUIRED, [
+	PKG_CHECK_MODULES(GLIB, \
 		glib-2.0 >= $GLIB_REQUIRED \
+		gthread-2.0 >= $GLIB_REQUIRED \
+		gio-2.0 >= $GIO_REQUIRED)
+	AC_DEFINE(HAVE_GIO, 1, [Defined if gio is avaiable])
+],[
+	PKG_CHECK_MODULES(GLIB, \
+		glib-2.0 >= $GLIB_REQUIRED \
 		gthread-2.0 >= $GLIB_REQUIRED)
+	test_gio=false
+])
 AC_SUBST(GLIB_LIBS)
 AC_SUBST(GLIB_CFLAGS)	
 
@@ -130,34 +142,6 @@
 
 dnl ===========================================================================
 
-LIBGNOME_VFS_CFLAGS=""
-LIBGNOME_VFS_LIBS=""
-
-LIBGNOME_VFS_PKG=""
-AC_ARG_ENABLE([gnome-vfs],
-        [AS_HELP_STRING([--enable-gnome-vfs],[Use Gnome VFS for reading remote files (default = auto)])],
-        [],[enable_gnome_vfs=auto])
-
-if test "$enable_gnome_vfs" != "no"; then
-	PKG_CHECK_MODULES([LIBGNOME_VFS],[gnome-vfs-2.0 >= 1.9.16],[enable_gnome_vfs=yes],[enable_gnome_vfs=no])
-fi
-
-if test "$enable_gnome_vfs" = "yes"; then
-	LIBGNOME_VFS_CFLAGS="$LIBGNOME_VFS_CFLAGS -DHAVE_GNOME_VFS=1"
-	LIBGNOME_VFS_PKG="gnome-vfs-2.0"
-else
-	AC_MSG_WARN([Gnome VFS support disabled, as requested (Use --enable-gnome-vfs to enable)])
-fi
-AM_CONDITIONAL([WITH_LIBGNOME_VFS],[test "$enable_gnome_vfs" = "yes"])
-
-AC_SUBST([LIBGNOME_VFS_PKG])
-AC_SUBST([GNOME_VFS_SUPPORTED],[$enable_gnome_vfs])
-
-AC_SUBST(LIBGNOME_VFS_CFLAGS)
-AC_SUBST(LIBGNOME_VFS_LIBS)
-
-dnl ===========================================================================
-
 LIBCROCO_CFLAGS=""
 LIBCROCO_LIBS=""
 LIBCROCOPKG=""
@@ -389,7 +373,7 @@
 	Build theme engine:             ${enable_gtk_theme}
 	Build Netscape plugin:          ${build_mozilla_plugin}
 	Handle svgz files:              ${test_gsf}
-	Use Gnome VFS:                  ${test_gnome_vfs}
+	Use GIO:                        ${test_gio}
 	Enable printing:		${have_gnome_print}
 	Use libcroco for css parsing:   ${test_croco}
 "
Index: rsvg-base.c
===================================================================
--- rsvg-base.c	(revision 1141)
+++ rsvg-base.c	(working copy)
@@ -1598,10 +1598,6 @@
 #endif
 
     xmlInitParser ();
-
-#ifdef HAVE_GNOME_VFS
-    gnome_vfs_init ();
-#endif
 }
 
 /**
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 1141)
+++ Makefile.am	(working copy)
@@ -70,7 +70,7 @@
 	rsvg-file-util.c
 
 librsvg_2_la_LDFLAGS = -version-info @VERSION_INFO@ -export-dynamic -no-undefined -export-symbols $(srcdir)/librsvg.def
-librsvg_2_la_LIBADD = $(LIBGNOME_VFS_LIBS) $(LIBGSF_LIBS) $(LIBCROCO_LIBS) $(LIBRSVG_LIBS) $(FREETYPE_LIBS)
+librsvg_2_la_LIBADD = $(LIBGSF_LIBS) $(LIBCROCO_LIBS) $(LIBRSVG_LIBS) $(FREETYPE_LIBS)
 
 librsvgincdir = $(includedir)/librsvg-2/librsvg
 librsvginc_HEADERS = 	\
@@ -79,7 +79,6 @@
 	librsvg-enum-types.h
 
 INCLUDES =				\
-	$(LIBGNOME_VFS_CFLAGS)		\
 	$(LIBGSF_CFLAGS)		\
 	$(LIBCROCO_CFLAGS)		\
 	-I$(top_srcdir) 		\
@@ -92,7 +91,6 @@
 
 DEPS = $(top_builddir)/librsvg-2.la
 LDADDS =				\
-	$(LIBGNOME_VFS_LIBS)		\
 	$(LIBGSF_LIBS)			\
 	$(GLIB_LIBS)			\
 	$(LIBCROCO_LIBS)		\
