Index: src/totem-private.h
===================================================================
--- src/totem-private.h	(revision 5110)
+++ src/totem-private.h	(working copy)
@@ -30,7 +30,7 @@
 
 #include <gconf/gconf-client.h>
 #include <gtk/gtk.h>
-#include <libgnomevfs/gnome-vfs.h>
+#include <gio/gio.h>
 
 #include "totem-playlist.h"
 #include "bacon-message-connection.h"
@@ -138,7 +138,7 @@
 	guint recent_ui_id;
 
 	/* Monitor for playlist unmounts and drives/volumes monitoring */
-	GnomeVFSVolumeMonitor *monitor;
+	GVolumeMonitor *monitor;
 	gboolean drives_changed;
 
 	/* session */
Index: src/totem-uri.c
===================================================================
--- src/totem-uri.c	(revision 5110)
+++ src/totem-uri.c	(working copy)
@@ -25,10 +25,10 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <string.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <gio/gio.h>
 
 #include "totem-mime-types.h"
 #include "totem-uri.h"
@@ -89,25 +89,26 @@
 	return g_strdup (dir);
 }
 
-static GnomeVFSVolume *
-totem_get_volume_for_uri (GnomeVFSVolumeMonitor *monitor, const char *path)
+static GMount *
+totem_get_mount_for_uri (const char *path)
 {
-	GnomeVFSVolume *vol;
-	GnomeVFSDeviceType type;
+	GMount *mount;
+	GFile *file;
 
-	vol = gnome_vfs_volume_monitor_get_volume_for_path (monitor, path);
-	if (vol == NULL)
+	file = g_file_new_for_path (path);
+	mount = g_file_find_enclosing_mount (file, NULL, NULL);
+	g_object_unref (file);
+
+	if (mount == NULL)
 		return NULL;
 
-	type = gnome_vfs_volume_get_device_type (vol);
-	if (type != GNOME_VFS_DEVICE_TYPE_AUDIO_CD
-	    && type != GNOME_VFS_DEVICE_TYPE_VIDEO_DVD
-	    && type != GNOME_VFS_DEVICE_TYPE_CDROM) {
-	    	gnome_vfs_volume_unref (vol);
-	    	vol = NULL;
+	/* FIXME: We used to explicitly check whether it was a CD/DVD */
+	if (g_mount_can_eject (mount) == TRUE) {
+		g_object_unref (mount);
+		return NULL;
 	}
 
-	return vol;
+	return mount;
 }
 
 static char *
@@ -124,32 +125,29 @@
 	return NULL;
 }
 
-GnomeVFSVolume *
-totem_get_volume_for_media (const char *uri)
+GMount *
+totem_get_mount_for_media (const char *uri)
 {
-	GnomeVFSVolumeMonitor *monitor;
-	GnomeVFSVolume *ret;
-	char *mount;
+	GMount *ret;
+	char *mount_path;
 
 	if (uri == NULL)
 		return NULL;
 
-	mount = NULL;
-	ret = NULL;
+	mount_path = NULL;
 
 	if (g_str_has_prefix (uri, "dvd://") != FALSE)
-		mount = totem_get_mountpoint_for_dvd (uri);
+		mount_path = totem_get_mountpoint_for_dvd (uri);
 	else if (g_str_has_prefix (uri, "vcd:") != FALSE)
-		mount = totem_get_mountpoint_for_vcd (uri);
+		mount_path = totem_get_mountpoint_for_vcd (uri);
 	else if (g_str_has_prefix (uri, "file:") != FALSE)
-		mount = g_filename_from_uri (uri, NULL, NULL);
+		mount_path = g_filename_from_uri (uri, NULL, NULL);
 
-	if (mount == NULL)
+	if (mount_path == NULL)
 		return NULL;
 
-	monitor = gnome_vfs_get_volume_monitor ();
-	ret = totem_get_volume_for_uri (monitor, mount);
-	g_free (mount);
+	ret = totem_get_mount_for_uri (mount_path);
+	g_free (mount_path);
 
 	return ret;
 }
@@ -157,20 +155,18 @@
 static gboolean
 totem_is_special_mrl (const char *uri)
 {
-	GnomeVFSVolume *vol;
-	gboolean retval;
+	GMount *mount;
 
 	if (uri == NULL || g_str_has_prefix (uri, "file:") != FALSE)
 		return FALSE;
 	if (g_str_has_prefix (uri, "dvb:") != FALSE)
 		return TRUE;
 
-	vol = totem_get_volume_for_media (uri);
-	retval = (vol != NULL);
-	if (vol != NULL)
-		gnome_vfs_volume_unref (vol);
+	mount = totem_get_mount_for_media (uri);
+	if (mount != NULL)
+		g_object_unref (mount);
 
-	return retval;
+	return (mount != NULL);
 }
 
 gboolean
@@ -196,10 +192,11 @@
 	return (S_ISBLK (buf.st_mode));
 }
 
-char*
+char *
 totem_create_full_path (const char *path)
 {
-	char *retval, *curdir, *curdir_withslash, *escaped;
+	GFile *file;
+	char *retval;
 
 	g_return_val_if_fail (path != NULL, NULL);
 
@@ -208,45 +205,28 @@
 	if (totem_is_special_mrl (path) != FALSE)
 		return NULL;
 
-	if (path[0] == G_DIR_SEPARATOR) {
-		escaped = gnome_vfs_escape_path_string (path);
+	file = g_file_new_for_commandline_arg (path);
+	retval = g_file_get_uri (file);
+	g_object_unref (file);
 
-		retval = g_strdup_printf ("file://%s", escaped);
-		g_free (escaped);
-		return retval;
-	}
-
-	curdir = g_get_current_dir ();
-	escaped = gnome_vfs_escape_path_string (curdir);
-	curdir_withslash = g_strdup_printf ("file://%s%c",
-					    escaped, G_DIR_SEPARATOR);
-	g_free (escaped);
-	g_free (curdir);
-
-	escaped = gnome_vfs_escape_path_string (path);
-	retval = gnome_vfs_uri_make_full_from_relative
-		(curdir_withslash, escaped);
-	g_free (curdir_withslash);
-	g_free (escaped);
-
 	return retval;
 }
 
 static void
-totem_action_on_unmount (GnomeVFSVolumeMonitor *vfsvolumemonitor,
-			 GnomeVFSVolume *volume,
+totem_action_on_unmount (GVolumeMonitor *volume_monitor,
+			 GMount *mount,
 			 Totem *totem)
 {
-	totem_playlist_clear_with_gnome_vfs_volume (totem->playlist, volume);
+	totem_playlist_clear_with_g_mount (totem->playlist, mount);
 }
 
 void
 totem_setup_file_monitoring (Totem *totem)
 {
-	totem->monitor = gnome_vfs_get_volume_monitor ();
+	totem->monitor = g_volume_monitor_get ();
 
 	g_signal_connect (G_OBJECT (totem->monitor),
-			  "volume_pre_unmount",
+			  "mount-pre-unmount",
 			  G_CALLBACK (totem_action_on_unmount),
 			  totem);
 }
@@ -265,7 +245,7 @@
 static char *
 totem_uri_get_subtitle_for_uri (const char *uri)
 {
-	GnomeVFSURI *vfsuri;
+	GFile *file;
 	char *subtitle;
 	guint len, i, suffix;
 
@@ -284,9 +264,9 @@
 			break;
 		}
 	}
-        if (suffix < 0) {
+
+        if (suffix < 0)
 		return NULL;
-	}
 
 	/* Generate a subtitle string with room at the end to store the
 	 * 3 character extensions we want to search for */
@@ -296,16 +276,16 @@
 	g_strlcpy (subtitle + suffix, ".???", 5);
 	
 	/* Search for any files with one of our known subtitle extensions */
-	for (i = 0; i < G_N_ELEMENTS(subtitle_ext) ; i++) {
+	for (i = 0; i < G_N_ELEMENTS (subtitle_ext) ; i++) {
 		memcpy (subtitle + suffix + 1, subtitle_ext[i], 3);
 
-		vfsuri = gnome_vfs_uri_new (subtitle);
-		if (vfsuri != NULL) {
-			if (gnome_vfs_uri_exists (vfsuri)) {
-				gnome_vfs_uri_unref (vfsuri);
+		file = g_file_new_for_uri (subtitle);
+		if (file != NULL) {
+			if (g_file_query_exists (file, NULL)) {
+				g_object_unref (file);
 				return subtitle;
 			}
-			gnome_vfs_uri_unref (vfsuri);
+			g_object_unref (file);
 		}
 	}
 	g_free (subtitle);
@@ -313,24 +293,27 @@
 }
 
 static char *
-totem_uri_get_subtitle_in_subdir (GnomeVFSURI *vfsuri, const char *subdir)
+totem_uri_get_subtitle_in_subdir (GFile *file, const char *subdir)
 {
-	char *filename, *subtitle, *fullpath_str;
-	GnomeVFSURI *parent, *fullpath, *directory;
+	char *filename, *subtitle, *full_path_str;
+	GFile *parent, *full_path, *directory;
 
-	parent = gnome_vfs_uri_get_parent (vfsuri);
-	directory = gnome_vfs_uri_append_path (parent, subdir);
-	gnome_vfs_uri_unref (parent);
+	/* Get the sibling directory @subdir of the file @file */
+	parent = g_file_get_parent (file);
+	directory = g_file_get_child (parent, subdir);
+	g_object_unref (parent);
 
-	filename = g_path_get_basename (gnome_vfs_uri_get_path (vfsuri));
-	fullpath = gnome_vfs_uri_append_string (directory, filename);
-	gnome_vfs_uri_unref (directory);
+	/* Get the file of the same name as @file in the @subdir directory */
+	filename = g_file_get_basename (file);
+	full_path = g_file_get_child (directory, filename);
+	g_object_unref (directory);
 	g_free (filename);
 
-	fullpath_str = gnome_vfs_uri_to_string (fullpath, 0);
-	gnome_vfs_uri_unref (fullpath);
-	subtitle = totem_uri_get_subtitle_for_uri (fullpath_str);
-	g_free (fullpath_str);
+	/* Get the subtitles from that URI */
+	full_path_str = g_file_get_uri (full_path);
+	g_object_unref (full_path);
+	subtitle = totem_uri_get_subtitle_for_uri (full_path_str);
+	g_free (full_path_str);
 
 	return subtitle;
 }
@@ -338,42 +321,46 @@
 char *
 totem_uri_get_subtitle_uri (const char *uri)
 {
-	GnomeVFSURI *vfsuri;
+	GFile *file;
 	char *subtitle;
 
-	if (g_str_has_prefix (uri, "http") != FALSE) {
+	if (g_str_has_prefix (uri, "http") != FALSE)
 		return NULL;
-	}
 
 	/* Has the user specified a subtitle file manually? */
-	if (strstr (uri, "#subtitle:") != NULL) {
+	if (strstr (uri, "#subtitle:") != NULL)
 		return NULL;
-	}
 
-	/* Does gnome-vfs support that scheme? */
-	vfsuri = gnome_vfs_uri_new (uri);
-	if (vfsuri == NULL)
+	/* Does the file exist? */
+	file = g_file_new_for_uri (uri);
+	if (g_file_query_exists (file, NULL) != TRUE) {
+		g_object_unref (file);
 		return NULL;
+	}
 
 	/* Try in the current directory */
 	subtitle = totem_uri_get_subtitle_for_uri (uri);
 	if (subtitle != NULL) {
-		gnome_vfs_uri_unref (vfsuri);
+		g_object_unref (file);
 		return subtitle;
 	}
 
-	subtitle = totem_uri_get_subtitle_in_subdir (vfsuri, "subtitles");
-	gnome_vfs_uri_unref (vfsuri);
+	subtitle = totem_uri_get_subtitle_in_subdir (file, "subtitles");
+	g_object_unref (file);
 
 	return subtitle;
 }
 
-char*
+char *
 totem_uri_escape_for_display (const char *uri)
 {
+	GFile *file;
 	char *disp, *tmp;
 
-	disp = gnome_vfs_unescape_string_for_display (uri);
+	file = g_file_new_for_uri (uri);
+	disp = g_file_get_parse_name (file);
+	g_object_unref (file);
+
 	/* If we don't have UTF-8, try to convert */
 	if (g_utf8_validate (disp, -1, NULL) != FALSE)
 		return disp;
Index: src/totem-menu.c
===================================================================
--- src/totem-menu.c	(revision 5110)
+++ src/totem-menu.c	(working copy)
@@ -686,13 +686,24 @@
 {
 	GtkRecentData data;
 	char *groups[] = { NULL, NULL };
+	GFile *file;
+	GFileInfo *file_info;
 
 	memset (&data, 0, sizeof (data));
 
-	data.mime_type = gnome_vfs_get_mime_type (filename);
+	file = g_file_new_for_uri (filename);
+	file_info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL);
+
+	/* Probably an unsupported URI scheme */
+	if (file_info == NULL)
+		return;
+
+	data.mime_type = g_strdup (g_file_info_get_content_type (file_info));
+	g_object_unref (file_info);
+
 	if (data.mime_type == NULL) {
 		/* No mime-type means warnings, and it breaks when adding
-		 * non-gnome-vfs supported URI schemes */
+		 * unsupported URI schemes */
 		return;
 	}
 	data.display_name = NULL;
@@ -744,7 +755,6 @@
 }
 
 /* Play DVB menu items */
-
 static void
 on_play_dvb_activate (GtkAction *action, Totem *totem)
 {
@@ -756,146 +766,104 @@
 	totem_action_play_media (totem, MEDIA_TYPE_DVB, str);
 	g_free (str);
 }
-/* A GnomeVFSDrive and GnomeVFSVolume share many similar methods, but do not
-   share a base class other than GObject. */
-static char *
-fake_gnome_vfs_device_get_something (GObject *device,
-		char *(*volume_function) (GnomeVFSVolume *),
-		char *(*drive_function) (GnomeVFSDrive *)) {
-        if (GNOME_IS_VFS_VOLUME (device)) {
-                return (*volume_function) (GNOME_VFS_VOLUME (device));
-        } else if (GNOME_IS_VFS_DRIVE (device)) {
-                return (*drive_function) (GNOME_VFS_DRIVE (device));
-        } else {
-                g_warning ("neither a GnomeVFSVolume or a GnomeVFSDrive");
-                return NULL;
-        }
-}
 
-static char *
-my_gnome_vfs_volume_get_mount_path (GnomeVFSVolume *volume)
-{
-	char *uri, *path;
-
-	uri = gnome_vfs_volume_get_activation_uri (volume);
-	path = g_filename_from_uri (uri, NULL, NULL);
-	g_free (uri);
-
-	if (path == NULL)
-		return gnome_vfs_volume_get_device_path (volume);
-	return path;
-}
-
 static void
-add_device_to_menu (GObject *device, guint position, Totem *totem)
+add_drive_to_menu (GDrive *drive, guint position, Totem *totem)
 {
-	char *name, *escaped_name, *icon_name, *device_path;
-	char *label, *activation_uri;
+	char *name, *escaped_name, *device_path, *label;
 	GtkAction *action;
 	gboolean disabled = FALSE;
+	GList *volumes, *i;
+	GMount *mount;
+	GFile *root;
+	GIcon *icon;
+	const char * const *icon_names;
 
-	/* Add devices with blank CDs and audio CDs in them, but disable them */
-	activation_uri = fake_gnome_vfs_device_get_something (device,
-		&gnome_vfs_volume_get_activation_uri,
-		&gnome_vfs_drive_get_activation_uri);
-	if (activation_uri != NULL) {
-		if (g_str_has_prefix (activation_uri, "burn://") != FALSE || g_str_has_prefix (activation_uri, "cdda://") != FALSE) {
+	/* Repeat for all the drive's volumes */
+	volumes = g_drive_get_volumes (drive);
+
+	for (i = volumes; i != NULL; i = i->next) {
+		/* Add devices with blank CDs and audio CDs in them, but disable them */
+		mount = g_volume_get_mount (i->data);
+
+		if (mount == NULL)
+			continue;
+
+		root = g_mount_get_root (mount);
+		g_object_unref (mount);
+
+		device_path = g_file_get_path (root);
+
+		if (g_file_has_uri_scheme (root, "burn") != FALSE || g_file_has_uri_scheme (root, "cdda") != FALSE)
 			disabled = TRUE;
-		}
-		g_free (activation_uri);
-	} else {
-		if (GNOME_IS_VFS_DRIVE (device)) {
-			device_path = gnome_vfs_drive_get_device_path
-				(GNOME_VFS_DRIVE (device));
+		if (root == NULL)
 			disabled = !totem_cd_has_medium (device_path);
-			g_free (device_path);
-		}
-	}
 
-	name = fake_gnome_vfs_device_get_something (device,
-		&gnome_vfs_volume_get_display_name,
-		&gnome_vfs_drive_get_display_name);
-	icon_name = fake_gnome_vfs_device_get_something (device,
-		&gnome_vfs_volume_get_icon, &gnome_vfs_drive_get_icon);
-	device_path = fake_gnome_vfs_device_get_something (device,
-		&my_gnome_vfs_volume_get_mount_path,
-		&gnome_vfs_drive_get_device_path);
+		/* Work out an icon to display */
+		icon = g_volume_get_icon (i->data);
+		icon_names = g_themed_icon_get_names (G_THEMED_ICON (icon));
 
-	g_strstrip (name);
-	escaped_name = escape_label_for_menu (name);
-	g_free (name);
-	label = g_strdup_printf (_("Play Disc '%s'"), escaped_name);
-	g_free (escaped_name);
+		/* Get the volume's pretty name for the menu label */
+		name = g_volume_get_name (i->data);
+		g_strstrip (name);
+		escaped_name = escape_label_for_menu (name);
+		g_free (name);
+		label = g_strdup_printf (_("Play Disc '%s'"), escaped_name);
+		g_free (escaped_name);
 
-	name = g_strdup_printf (_("device%d"), position);
-	action = gtk_action_new (name, label, NULL, NULL);
-	g_object_set (G_OBJECT (action), "icon-name", icon_name,
-		      "sensitive", !disabled, NULL);
-	gtk_action_group_add_action (totem->devices_action_group, action);
-	g_object_unref (action);
-	gtk_ui_manager_add_ui (totem->ui_manager, totem->devices_ui_id,
-		"/tmw-menubar/movie/devices-placeholder", name, name,
-		GTK_UI_MANAGER_MENUITEM, FALSE);
-	g_free (name);
-	g_free (label);
-	g_free (icon_name);
+		name = g_strdup_printf (_("device%d"), position);
 
-	if (disabled != FALSE) {
-		g_free (device_path);
-		return;
-	}
+		action = gtk_action_new (name, label, NULL, NULL);
+		g_object_set (G_OBJECT (action),
+			      "icon-name", icon_names[0],
+			      "sensitive", !disabled, NULL);
+		gtk_action_group_add_action (totem->devices_action_group, action);
+		g_object_unref (action);
 
-	g_object_set_data_full (G_OBJECT (action),
-				"device_path", device_path,
-				(GDestroyNotify) g_free);
+		gtk_ui_manager_add_ui (totem->ui_manager, totem->devices_ui_id,
+			"/tmw-menubar/movie/devices-placeholder", name, name,
+			GTK_UI_MANAGER_MENUITEM, FALSE);
 
-	g_signal_connect (G_OBJECT (action), "activate",
-			G_CALLBACK (on_play_disc_activate), totem);
+		g_free (name);
+		g_free (label);
+		g_object_unref (icon);
+
+		if (disabled != FALSE) {
+			g_free (device_path);
+			return;
+		}
+
+		g_object_set_data_full (G_OBJECT (action),
+					"device_path", device_path,
+					(GDestroyNotify) g_free);
+
+		g_signal_connect (G_OBJECT (action), "activate",
+				  G_CALLBACK (on_play_disc_activate), totem);
+	}
+
+	g_list_free (volumes);
 }
 
 static void
-update_drives_menu_items (GtkMenuItem *movie_menuitem, Totem *totem)
+update_drive_menu_items (GtkMenuItem *movie_menuitem, Totem *totem)
 {
-	GList *devices, *volumes, *drives, *i;
+	GList *drives, *i;
 	guint position;
 
-	/* Create a list of suitable devices */
-	devices = NULL;
+	/* Add any suitable devices to the menu */
+	position = 0;
 
-	volumes = gnome_vfs_volume_monitor_get_mounted_volumes
-		(totem->monitor);
-	for (i = volumes; i != NULL; i = i->next) {
-		if (gnome_vfs_volume_get_device_type (i->data) != GNOME_VFS_DEVICE_TYPE_CDROM)
-			continue;
-
-		gnome_vfs_volume_ref (i->data);
-		devices = g_list_append (devices, i->data);
-	}
-	gnome_vfs_drive_volume_list_free (volumes);
-
-	drives = gnome_vfs_volume_monitor_get_connected_drives (totem->monitor);
+	drives = g_volume_monitor_get_connected_drives (totem->monitor);
 	for (i = drives; i != NULL; i = i->next) {
-		if (gnome_vfs_drive_get_device_type (i->data) != GNOME_VFS_DEVICE_TYPE_CDROM)
+		/* FIXME: We used to explicitly check whether it was a CD/DVD drive */
+		if (g_drive_can_eject (i->data) == FALSE)
 			continue;
-		else if (gnome_vfs_drive_is_mounted (i->data))
-			continue;
 
-		gnome_vfs_volume_ref (i->data);
-		devices = g_list_append (devices, i->data);
-	}
-	gnome_vfs_drive_volume_list_free (drives);
-
-	/* Add the devices to the menu */
-	position = 0;
-
-	for (i = devices; i != NULL; i = i->next) {
 		position++;
-		add_device_to_menu (i->data, position, totem);
+		add_drive_to_menu (i->data, position, totem);
 	}
+	g_list_free (drives);
 
-	g_list_foreach (devices, (GFunc) g_object_unref, NULL);
-	g_list_free (devices);
-
 	totem->drives_changed = FALSE;
 }
 
@@ -944,9 +912,9 @@
 on_movie_menu_select (GtkMenuItem *movie_menuitem, Totem *totem)
 {
 	//FIXME we should check whether there's new DVB items
-/*	if (totem->drives_changed == FALSE)
+	if (totem->drives_changed == FALSE)
 		return;
-*/
+
 	/* Remove old UI */
 	gtk_ui_manager_remove_ui (totem->ui_manager, totem->devices_ui_id);
 	gtk_ui_manager_ensure_update (totem->ui_manager);
@@ -961,11 +929,9 @@
 	gtk_ui_manager_insert_action_group (totem->ui_manager,
 			totem->devices_action_group, -1);
 
+	update_drive_menu_items (movie_menuitem, totem);
 
-	if (totem->drives_changed != FALSE)
-		update_drives_menu_items (movie_menuitem, totem);
-
-	/* check for DVB */
+	/* Check for DVB */
 	/* FIXME we should only update if we have an updated as per HAL */
 	update_dvb_menu_items (movie_menuitem, totem);
 
@@ -973,9 +939,9 @@
 }
 
 static void
-on_gnome_vfs_monitor_event (GnomeVFSVolumeMonitor *monitor,
-		GnomeVFSDrive *drive,
-		Totem *totem)
+on_g_volume_monitor_event (GVolumeMonitor *monitor,
+			   gpointer *device,
+			   Totem *totem)
 {
 	totem->drives_changed = TRUE;
 }
@@ -990,17 +956,17 @@
 			G_CALLBACK (on_movie_menu_select), totem);
 
 	g_signal_connect (G_OBJECT (totem->monitor),
-			"drive-connected",
-			G_CALLBACK (on_gnome_vfs_monitor_event), totem);
+			"volume-added",
+			G_CALLBACK (on_g_volume_monitor_event), totem);
 	g_signal_connect (G_OBJECT (totem->monitor),
-			"drive-disconnected",
-			G_CALLBACK (on_gnome_vfs_monitor_event), totem);
+			"volume-removed",
+			G_CALLBACK (on_g_volume_monitor_event), totem);
 	g_signal_connect (G_OBJECT (totem->monitor),
-			"volume-mounted",
-			G_CALLBACK (on_gnome_vfs_monitor_event), totem);
+			"mount-added",
+			G_CALLBACK (on_g_volume_monitor_event), totem);
 	g_signal_connect (G_OBJECT (totem->monitor),
-			"volume-unmounted",
-			G_CALLBACK (on_gnome_vfs_monitor_event), totem);
+			"mount-removed",
+			G_CALLBACK (on_g_volume_monitor_event), totem);
 
 	totem->drives_changed = TRUE;
 }
Index: src/totem-uri.h
===================================================================
--- src/totem-uri.h	(revision 5110)
+++ src/totem-uri.h	(working copy)
@@ -25,24 +25,24 @@
 
 #include "totem.h"
 #include <gtk/gtkwindow.h>
-#include <libgnomevfs/gnome-vfs-volume.h>
+#include <gio/gio.h>
 
 G_BEGIN_DECLS
 
 const char *	totem_dot_dir			(void);
 char *		totem_pictures_dir		(void);
-char*		totem_create_full_path		(const char *path);
-GnomeVFSVolume*	totem_get_volume_for_media	(const char *uri);
+char *		totem_create_full_path		(const char *path);
+GMount *	totem_get_mount_for_media	(const char *uri);
 gboolean	totem_playing_dvd		(const char *uri);
 gboolean	totem_is_block_device		(const char *uri);
 void		totem_setup_file_monitoring	(Totem *totem);
 void		totem_setup_file_filters	(void);
 void		totem_destroy_file_filters	(void);
-char*		totem_uri_get_subtitle_uri	(const char *uri);
-char*		totem_uri_escape_for_display	(const char *uri);
-GSList*		totem_add_files			(GtkWindow *parent,
+char *		totem_uri_get_subtitle_uri	(const char *uri);
+char *		totem_uri_escape_for_display	(const char *uri);
+GSList *	totem_add_files			(GtkWindow *parent,
 						 const char *path);
-char*		totem_add_subtitle		(GtkWindow *parent, 
+char *		totem_add_subtitle		(GtkWindow *parent, 
 						 const char *path);
 void		totem_add_pictures_dir		(GtkWidget *chooser);
 
Index: src/plugins/publish/totem-publish.c
===================================================================
--- src/plugins/publish/totem-publish.c	(revision 5110)
+++ src/plugins/publish/totem-publish.c	(working copy)
@@ -39,6 +39,7 @@
 #include <libepc/service-monitor.h>
 
 #include <libepc-ui/progress-window.h>
+#include <libgnomevfs/gnome-vfs.h>
 
 #include "ev-sidebar.h"
 #include "totem-plugin.h"
Index: src/totem-playlist.c
===================================================================
--- src/totem-playlist.c	(revision 5110)
+++ src/totem-playlist.c	(working copy)
@@ -29,8 +29,7 @@
 #include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
 #include <gconf/gconf-client.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include <libgnomevfs/gnome-vfs-mime-utils.h>
+#include <gio/gio.h>
 #include <string.h>
 
 #include "totem-uri.h"
@@ -259,17 +258,18 @@
 	gtk_widget_show (error_dialog);
 }
 
-/* This one returns a new string, in UTF8 even if the mrl is encoded
+/* This one returns a new string, in UTF8 even if the MRL is encoded
  * in the locale's encoding
  */
 static char *
 totem_playlist_mrl_to_title (const gchar *mrl)
 {
-	char *filename_for_display, *filename, *unescaped;
+	GFile *file;
+	char *filename_for_display, *unescaped;
 
-	filename = g_path_get_basename (mrl);
-	unescaped = gnome_vfs_unescape_string_for_display (filename);
-	g_free (filename);
+	file = g_file_new_for_uri (mrl);
+	unescaped = g_file_get_basename (file);
+	g_object_unref (file);
 
 	filename_for_display = g_filename_to_utf8 (unescaped,
 			-1,             /* length */
@@ -374,28 +374,21 @@
 	 guint             time, 
 	 TotemPlaylist    *playlist)
 {
-	GList *list, *p, *file_list;
+	char **list;
+	GList *p, *file_list;
+	guint i;
 
-	list = gnome_vfs_uri_list_parse ((char *)data->data);
-
-	if (list == NULL) {
-		gtk_drag_finish (context, FALSE, FALSE, time);
-		return;
-	}
-
-	p = list;
+	list = g_uri_list_extract_uris ((char *)data->data);
 	file_list = NULL;
 
-	while (p != NULL) {
+	for (i = 0; list[i] != NULL; i++) {
 		/* We get the list in the wrong order here,
 		 * so when we insert the files at the same position
 		 * in the tree, they are in the right order.*/
-		file_list = g_list_prepend (file_list,
-					    gnome_vfs_uri_to_string ((const GnomeVFSURI*)(p->data), 0));
-		p = p->next;
+		file_list = g_list_prepend (file_list, list[i]);
 	}
 
-	gnome_vfs_uri_list_free (list);
+	g_strfreev (list);
 
 	if (file_list == NULL) {
 		gtk_drag_finish (context, FALSE, FALSE, time);
@@ -1850,35 +1843,32 @@
 }
 
 static int
-totem_playlist_compare_with_volume (gpointer a, gpointer b)
+totem_playlist_compare_with_mount (gpointer a, gpointer b)
 {
-	GnomeVFSVolume *clear_volume = (GnomeVFSVolume *) b;
+	GMount *clear_mount = (GMount *) b;
 	const char *mrl = (const char *) a;
 
-	GnomeVFSVolume *volume;
-	GnomeVFSVolumeMonitor *monitor;
+	GMount *mount;
 	gboolean retval = FALSE;
 
-	monitor = gnome_vfs_get_volume_monitor ();
+	mount = totem_get_mount_for_media (mrl);
 
-	volume = totem_get_volume_for_media (mrl);
-
-	if (volume == clear_volume)
+	if (mount == clear_mount)
 		retval = TRUE;
 
-	if (volume != NULL)
-		gnome_vfs_volume_unref (volume);
+	if (mount != NULL)
+		g_object_unref (mount);
 
 	return retval;
 }
 
 void
-totem_playlist_clear_with_gnome_vfs_volume (TotemPlaylist *playlist,
-					    GnomeVFSVolume *volume)
+totem_playlist_clear_with_g_mount (TotemPlaylist *playlist,
+				   GMount *mount)
 {
 	totem_playlist_clear_with_compare (playlist,
-					   (GCompareFunc) totem_playlist_compare_with_volume,
-					   volume);
+					   (GCompareFunc) totem_playlist_compare_with_mount,
+					   mount);
 }
 
 char *
Index: src/totem.c
===================================================================
--- src/totem.c	(revision 5110)
+++ src/totem.c	(working copy)
@@ -34,6 +34,7 @@
 #include <totem-disc.h>
 #include <stdlib.h>
 #include <math.h>
+#include <gio/gio.h>
 
 #ifndef HAVE_GTK_ONLY
 #include <gnome.h>
@@ -262,8 +263,6 @@
 
 	g_object_unref (totem);
 
-	gnome_vfs_shutdown ();
-
 	exit (0);
 }
 
@@ -346,10 +345,10 @@
 void
 totem_action_eject (Totem *totem)
 {
-	GnomeVFSVolume *volume;
+	GMount *mount;
 
-	volume = totem_get_volume_for_media (totem->mrl);
-	if (volume == NULL)
+	mount = totem_get_mount_for_media (totem->mrl);
+	if (mount == NULL)
 		return;
 
 	g_free (totem->mrl);
@@ -357,9 +356,9 @@
 	bacon_video_widget_close (totem->bvw);
 	totem_file_closed (totem);
 
-	/* the volume monitoring will take care of removing the items */
-	gnome_vfs_volume_eject (volume, NULL, NULL);
-	gnome_vfs_volume_unref (volume);
+	/* The volume monitoring will take care of removing the items */
+	g_mount_eject (mount, G_MOUNT_UNMOUNT_NONE, NULL, NULL, NULL);
+	g_object_unref (mount);
 }
 
 void
@@ -1248,26 +1247,19 @@
 totem_action_drop_files (Totem *totem, GtkSelectionData *data,
 		int drop_type, gboolean empty_pl)
 {
-	GList *list, *p, *file_list;
+	char **list;
+	guint i;
+	GList *p, *file_list;
 	gboolean cleared = FALSE;
 
-	list = gnome_vfs_uri_list_parse ((const char *)data->data);
-
-	if (list == NULL)
-		return FALSE;
-
-	p = list;
+	list = g_uri_list_extract_uris ((const char *)data->data);
 	file_list = NULL;
 
-	while (p != NULL)
-	{
-		file_list = g_list_prepend (file_list, 
-				gnome_vfs_uri_to_string
-				((const GnomeVFSURI*)(p->data), 0));
-		p = p->next;
-	}
+	for (i = 0; list[i] != NULL; ++i)
+		file_list = g_list_prepend (file_list, list[i]);
 
-	gnome_vfs_uri_list_free (list);
+	g_strfreev (list);
+
 	if (file_list == NULL)
 		return FALSE;
 
@@ -1375,33 +1367,33 @@
 
 static void
 drag_video_cb (GtkWidget *widget,
-		GdkDragContext *context,
-		GtkSelectionData *selection_data,
-		guint info,
-		guint32 time,
-		gpointer callback_data)
+	       GdkDragContext *context,
+	       GtkSelectionData *selection_data,
+	       guint info,
+	       guint32 time,
+	       gpointer callback_data)
 {
 	Totem *totem = (Totem *) callback_data;
 	char *text;
 	int len;
+	GFile *file;
 
 	g_assert (selection_data != NULL);
 
 	if (totem->mrl == NULL)
 		return;
 
-	if (totem->mrl[0] == '/')
-		text = gnome_vfs_get_uri_from_local_path (totem->mrl);
-	else
-		text = g_strdup (totem->mrl);
+	/* Canonicalise the MRL as a proper URI */
+	file = g_file_new_for_commandline_arg (totem->mrl);
+	text = g_file_get_uri (file);
+	g_object_unref (file);
 
 	g_return_if_fail (text != NULL);
 
 	len = strlen (text);
 
-	gtk_selection_data_set (selection_data,
-			selection_data->target,
-			8, (guchar *) text, len);
+	gtk_selection_data_set (selection_data, selection_data->target,
+				8, (guchar *) text, len);
 
 	g_free (text);
 }
@@ -2657,7 +2649,7 @@
 static void
 update_media_menu_items (Totem *totem)
 {
-	GnomeVFSVolume *volume;
+	GMount *mount;
 	gboolean playing;
 
 	playing = totem_playing_dvd (totem->mrl);
@@ -2670,10 +2662,10 @@
 	/* FIXME we should only show that if we have multiple angles */
 	totem_action_set_sensitivity ("next-angle", playing);
 
-	volume = totem_get_volume_for_media (totem->mrl);
-	totem_action_set_sensitivity ("eject", volume != NULL);
-	if (volume != NULL)
-		gnome_vfs_volume_unref (volume);
+	mount = totem_get_mount_for_media (totem->mrl);
+	totem_action_set_sensitivity ("eject", mount != NULL);
+	if (mount != NULL)
+		g_object_unref (mount);
 }
 
 static void
@@ -3137,8 +3129,6 @@
 	g_set_application_name (_("Totem Movie Player"));
 	gtk_window_set_default_icon_name ("totem");
 
-	gnome_vfs_init ();
-
 	gc = gconf_client_get_default ();
 	if (gc == NULL)
 	{
Index: src/totem-playlist.h
===================================================================
--- src/totem-playlist.h	(revision 5110)
+++ src/totem-playlist.h	(working copy)
@@ -24,8 +24,8 @@
 #define TOTEM_PLAYLIST_H
 
 #include <gtk/gtkvbox.h>
-#include <libgnomevfs/gnome-vfs-volume.h>
 #include <totem-pl-parser.h>
+#include <gio/gio.h>
 
 G_BEGIN_DECLS
 
@@ -96,8 +96,8 @@
 /* totem_playlist_clear doesn't emit the current_removed signal, even if it does
  * because the caller should know what to do after it's done with clearing */
 gboolean   totem_playlist_clear (TotemPlaylist *playlist);
-void       totem_playlist_clear_with_gnome_vfs_volume (TotemPlaylist *playlist,
-						       GnomeVFSVolume *volume);
+void       totem_playlist_clear_with_g_mount (TotemPlaylist *playlist,
+					      GMount *mount);
 char      *totem_playlist_get_current_mrl (TotemPlaylist *playlist,
 					   char **subtitle);
 char      *totem_playlist_get_current_title (TotemPlaylist *playlist,
