Index: configure.in
===================================================================
--- configure.in	(revision 2047)
+++ configure.in	(working copy)
@@ -384,6 +384,11 @@
 AC_CHECK_FUNCS(cairo_surface_set_fallback_resolution)
 LIBS=$SAVE_LIBS
 
+SAVE_LIBS=$LIBS
+LIBS="$GOFFICE_LIBS $LIBS"
+AC_CHECK_FUNCS(gsf_input_gio_new)
+LIBS=$SAVE_LIBS
+
 SAVE_CFLAGS=$CFLAGS
 SAVE_LIBS=$LIBS
 CFLAGS="$CFLAGS $GOFFICE_CFLAGS"
Index: goffice/utils/go-file.c
===================================================================
--- goffice/utils/go-file.c	(revision 2047)
+++ goffice/utils/go-file.c	(working copy)
@@ -21,6 +21,11 @@
  * USA
  */
 
+#undef GOFFICE_WITH_GNOMEVFS
+#if defined (GOFFICE_WITH_GNOME) && !defined(HAVE_GSF_INPUT_GIO_NEW)
+#define GOFFICE_WITH_GNOMEVFS
+#endif
+
 #include <goffice/goffice-config.h>
 #include "go-file.h"
 #include "go-glib-extras.h"
@@ -29,12 +34,18 @@
 #include <gsf/gsf-output-stdio.h>
 #include <glib/gstdio.h>
 #include <glib/gi18n-lib.h>
-#ifdef GOFFICE_WITH_GNOME
+#ifdef GOFFICE_WITH_GNOMEVFS
 #include <libgnomevfs/gnome-vfs-utils.h>
 #include <libgnomevfs/gnome-vfs-mime-utils.h>
 #include <libgnomevfs/gnome-vfs-mime-handlers.h>
 #include <gsf-gnome/gsf-input-gnomevfs.h>
 #include <gsf-gnome/gsf-output-gnomevfs.h>
+#endif
+#ifdef HAVE_GSF_INPUT_GIO_NEW
+#include <gsf/gsf-input-gio.h>
+#include <gsf/gsf-output-gio.h>
+#endif
+#ifdef GOFFICE_WITH_GNOME
 #include <libgnome/gnome-url.h>
 #elif defined G_OS_WIN32
 #include <urlmon.h>
@@ -61,11 +72,7 @@
 char *
 go_filename_from_uri (const char *uri)
 {
-#ifdef GOFFICE_WITH_GNOME
-	return gnome_vfs_get_local_path_from_uri (uri);
-#else
 	return g_filename_from_uri (uri, NULL, NULL);
-#endif
 }
 
 /*
@@ -79,13 +86,9 @@
 	g_return_val_if_fail (filename != NULL, NULL);
 
 	simp = go_filename_simplify (filename, GO_DOTDOT_TEST, TRUE);
-
-#ifdef GOFFICE_WITH_GNOME
-	uri = gnome_vfs_get_uri_from_local_path (simp);
-#else
 	uri = g_filename_to_uri (simp, NULL, NULL);
-#endif
 	g_free (simp);
+
 	return uri;
 }
 
@@ -291,7 +294,7 @@
 {
 	char *simp, *uri;
 
-#ifdef GOFFICE_WITH_GNOME
+#ifdef GOFFICE_WITH_GNOMEVFS
 	uri = gnome_vfs_uri_make_full_from_relative (ref_uri, rel_uri);
 #else
 	size_t len;
@@ -432,6 +435,12 @@
 char *
 go_shell_arg_to_uri (const char *arg)
 {
+#ifdef HAVE_GSF_INPUT_GIO_NEW
+	GFile *f = g_file_new_for_commandline_arg (arg);
+	char *uri = g_file_get_uri (f);
+	g_object_unref (f);
+	return uri;
+#else
 	gchar *tmp;
 	int fd;
 
@@ -452,7 +461,7 @@
 	if (is_fd_uri (arg, &fd))
 		return g_strdup (arg);
 
-#ifdef GOFFICE_WITH_GNOME
+#ifdef GOFFICE_WITH_GNOMEVFS
 	{
 		/*
 		 * oink://     --> NULL
@@ -468,6 +477,7 @@
 
 	/* Just assume it's a filename.  */
 	return go_filename_to_uri (arg);
+#endif
 }
 
 /**
@@ -481,8 +491,25 @@
 go_basename_from_uri (const char *uri)
 {
 	char *res;
-
-#ifdef GOFFICE_WITH_GNOME
+#ifdef HAVE_GSF_INPUT_GIO_NEW
+	GFile *f = g_file_new_for_uri (uri);
+	GFileInfo *fi = g_file_query_info
+		(f, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+		 G_FILE_QUERY_INFO_NONE,
+		 NULL,
+		 NULL);
+	if (fi) {
+		res = g_strdup (g_file_info_get_display_name (fi));
+		g_object_unref (fi);
+	} else {
+		/* Crude fall back.  */
+		char *basename = g_path_get_basename (uri);
+		res = basename ? g_filename_display_name (basename) : NULL;
+		g_free (basename);
+	}
+	g_object_unref (f);
+#else
+#ifdef GOFFICE_WITH_GNOMEVFS
 	char *raw_uri = gnome_vfs_unescape_string (uri, G_DIR_SEPARATOR_S);
 	char *basename = raw_uri ? g_path_get_basename (raw_uri) : NULL;
 	g_free (raw_uri);
@@ -499,6 +526,7 @@
 
 	res = basename ? g_filename_display_name (basename) : NULL;
 	g_free (basename);
+#endif
 	return res;
 }
 
@@ -513,9 +541,17 @@
 char *
 go_dirname_from_uri (const char *uri, gboolean brief)
 {
+#ifdef HAVE_GSF_INPUT_GIO_NEW
+	GFile *f = g_file_new_for_uri (uri);
+	GFile *pf = g_file_get_parent (f);
+	char *res = brief ? g_file_get_parse_name (pf) : g_file_get_uri (pf);
+	g_object_unref (pf);
+	g_object_unref (f);
+	return res;
+#else
 	char *dirname_utf8, *dirname;
 
-#ifdef GOFFICE_WITH_GNOME
+#ifdef GOFFICE_WITH_GNOMEVFS
 	char *raw_uri = gnome_vfs_unescape_string (uri, G_DIR_SEPARATOR_S);
 	dirname = raw_uri ? g_path_get_dirname (raw_uri) : NULL;
 	g_free (raw_uri);
@@ -536,6 +572,7 @@
 	dirname_utf8 = dirname ? g_filename_display_name (dirname) : NULL;
 	g_free (dirname);
 	return dirname_utf8;
+#endif
 }
 
 /* ------------------------------------------------------------------------- */
@@ -591,7 +628,9 @@
 		return result;
 	}
 
-#ifdef GOFFICE_WITH_GNOME
+#ifdef HAVE_GSF_INPUT_GIO_NEW
+	return gsf_input_gio_new_for_path (uri, err);
+#elif defined (GOFFICE_WITH_GNOMEVFS)
 	return gsf_input_gnomevfs_new (uri, err);
 #else
 	g_set_error (err, gsf_input_error (), 0,
@@ -626,7 +665,9 @@
 		return result;
 	}
 
-#ifdef GOFFICE_WITH_GNOME
+#ifdef HAVE_GSF_INPUT_GIO_NEW
+	return gsf_output_gio_new_for_uri (uri, err);
+#elif defined (GOFFICE_WITH_GNOMEVFS)
 	return gsf_output_gnomevfs_new (uri, err);
 #else
 	g_set_error (err, gsf_output_error_id (), 0,
@@ -702,7 +743,7 @@
 	char *nameutf8;
 #endif
 
-#ifdef GOFFICE_WITH_GNOME
+#ifdef GOFFICE_WITH_GNOMEVFS
 	GnomeVFSFileInfo *file_info;
 
 	GnomeVFSResult result;
@@ -782,7 +823,7 @@
 	char *nameutf8;
 #endif
 
-#ifdef GOFFICE_WITH_GNOME
+#ifdef GOFFICE_WITH_GNOMEVFS
 	GnomeVFSFileInfo *file_info;
 
 	GnomeVFSResult result;
@@ -840,7 +881,7 @@
 {
 	GOFilePermissions * file_permissions = NULL;
 
-#if defined (GOFFICE_WITH_GNOME)
+#if defined (GOFFICE_WITH_GNOMEVFS)
 	GnomeVFSFileInfo *file_info;
 	GnomeVFSResult result;
 
@@ -900,7 +941,7 @@
 void
 go_set_file_permissions (char const *uri, GOFilePermissions * file_permissions)
 {
-#if defined (GOFFICE_WITH_GNOME)
+#if defined (GOFFICE_WITH_GNOMEVFS)
 	GnomeVFSFileInfo *file_info;
 	GnomeVFSResult result;
 
@@ -1007,7 +1048,7 @@
 {
 	time_t tm = -1;
 
-#ifdef GOFFICE_WITH_GNOME
+#ifdef GOFFICE_WITH_GNOMEVFS
 	GnomeVFSFileInfo *file_info;
 
 	GnomeVFSResult result;
@@ -1286,7 +1327,15 @@
 gchar *
 go_get_mime_type (gchar const *uri)
 {
-#ifdef GOFFICE_WITH_GNOME
+#ifdef HAVE_GSF_INPUT_GIO_NEW
+	char *ctype = g_content_type_guess
+		(uri, /* Crude! */
+		 NULL, 0,
+		 NULL);
+	char *mime = g_content_type_get_mime_type (ctype);
+	g_free (ctype);
+	return mime;
+#elif defined (GOFFICE_WITH_GNOMEVFS)
 	return gnome_vfs_get_mime_type (uri);
 #elif defined(G_OS_WIN32)
 	LPWSTR wuri, mime_type;
@@ -1317,7 +1366,12 @@
 gchar *
 go_get_mime_type_for_data (gconstpointer data, int data_size)
 {
-#ifdef GOFFICE_WITH_GNOME
+#ifdef HAVE_GSF_INPUT_GIO_NEW
+	char *ctype = g_content_type_guess (NULL, data, data_size, NULL);
+	char *mime = g_content_type_get_mime_type (ctype);
+	g_free (ctype);
+	return mime;
+#elif defined (GOFFICE_WITH_GNOMEVFS)
 	return g_strdup (gnome_vfs_get_mime_type_for_data (data, data_size));
 #elif defined(G_OS_WIN32)
 	LPWSTR mime_type;
@@ -1342,7 +1396,7 @@
 gchar const *
 go_mime_type_get_description (gchar const *mime_type)
 {
-#ifdef GOFFICE_WITH_GNOME
+#ifdef GOFFICE_WITH_GNOMEVFS
 	return gnome_vfs_mime_get_description (mime_type);
 #else
 	return mime_type;
