diff --git a/configure.ac b/configure.ac
index a43c3ac..476fefa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,6 +86,11 @@ if test x$have_totem_plparser != xyes; then
    AC_MSG_ERROR([totem playlist parsing library not found or too old])
 fi
 
+PKG_CHECK_MODULES(GIO, gio-2.0, have_gio=yes, have_gio=no)
+if test x$have_gio == "xyes"; then
+  AC_DEFINE(HAVE_GIO, 1, [Define to use gio instead of gnome-vfs (for trash only)])
+fi
+
 AC_ARG_WITH(hal,
 	      AC_HELP_STRING([--without-hal],
 			     [Disable HAL support]))
diff --git a/rhythmdb/Makefile.am b/rhythmdb/Makefile.am
index c12c7d0..af50cd5 100644
--- a/rhythmdb/Makefile.am
+++ b/rhythmdb/Makefile.am
@@ -15,7 +15,8 @@ INCLUDES = 						\
 	-I$(top_srcdir)/metadata			\
 	-I$(top_builddir)/lib                           \
 	$(GDA_CFLAGS)					\
-	$(RHYTHMBOX_CFLAGS)
+	$(RHYTHMBOX_CFLAGS)				\
+	$(GIO_CFLAGS)
 
 librhythmdb_la_SOURCES =				\
 	rb-refstring.c					\
diff --git a/rhythmdb/rhythmdb.c b/rhythmdb/rhythmdb.c
index 4d8c2b3..52cab2d 100644
--- a/rhythmdb/rhythmdb.c
+++ b/rhythmdb/rhythmdb.c
@@ -36,6 +36,10 @@
 #include <gdk/gdk.h>
 #include <gconf/gconf-client.h>
 
+#if defined(HAVE_GIO)
+#include <gio/gio.h>
+#endif
+
 #include "rb-marshal.h"
 #include "rb-file-helpers.h"
 #include "rb-debug.h"
@@ -3264,6 +3268,40 @@ rhythmdb_entry_delete (RhythmDB *db,
 	db->priv->dirty = TRUE;
 }
 
+#if defined(HAVE_GIO)
+
+void
+rhythmdb_entry_move_to_trash (RhythmDB *db,
+			      RhythmDBEntry *entry)
+{
+	const char *uri;
+	GFile *file;
+	GError *error = NULL;
+
+	uri = rb_refstring_get (entry->location);
+	file = g_file_new_for_uri (uri);
+
+	g_file_trash (file, NULL, &error);
+	if (error != NULL) {
+		GValue value = {0,};
+
+		g_value_init (&value, G_TYPE_STRING);
+		g_value_set_string (&value, error->message);
+		rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_PLAYBACK_ERROR, &value);
+		g_value_unset (&value);
+
+		rb_debug ("trashing %s failed: %s",
+			  uri, error->message);
+		g_error_free (error);
+	} else {
+		rhythmdb_entry_set_visibility (db, entry, FALSE);
+	}
+
+	g_object_unref (file);
+}
+
+#else
+
 static gint
 rhythmdb_entry_move_to_trash_cb (GnomeVFSXferProgressInfo *info,
 				 gpointer data)
@@ -3381,6 +3419,8 @@ rhythmdb_entry_move_to_trash (RhythmDB *db,
 	gnome_vfs_uri_unref (uri);
 }
 
+#endif
+
 /**
  * rhythmdb_entry_delete_by_type:
  * @db: a #RhythmDB.
