diff --git a/configure.ac b/configure.ac
index 8b35484..a96f9cd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,10 +57,16 @@ AC_CHECK_FUNC(mkdtemp,
     mkdtemp_missing=true)
 AM_CONDITIONAL(MKDTEMP_MISSING, test x$mkdtemp_missing = xtrue)
 
+PKG_CHECK_MODULES(GLIB_TESTS, glib-2.0)
+SAVE_LIBS=$LIBS
+LIBS="$GLIB_TESTS_LIBS $LIBS"
 AC_CHECK_LIB(glib-2.0, g_utf8_collate_key_for_filename,
     [AC_DEFINE([HAVE_COLLATE_KEY_FILENAME], 1, [Have glib function to collate filename sort keys])])
 AC_CHECK_LIB(glib-2.0, g_mapped_file_new,
     [AC_DEFINE([HAVE_G_MAPPED_FILE], 1, [Have glib mmap wrapper])])
+AC_CHECK_LIB(glib-2.0, g_get_user_special_dir,
+    [AC_DEFINE([HAVE_G_GET_USER_SPECIAL_DIR], 1, [Have glib function to find user special dirs])])
+LIBS=$SAVE_LIBS
 
 PKG_PROG_PKG_CONFIG
 
diff --git a/lib/rb-file-helpers.c b/lib/rb-file-helpers.c
index f6a5a95..33a9a29 100644
--- a/lib/rb-file-helpers.c
+++ b/lib/rb-file-helpers.c
@@ -38,7 +38,9 @@
 static GHashTable *files = NULL;
 
 static char *dot_dir = NULL;
+#ifndef HAVE_G_GET_USER_SPECIAL_DIR
 static char *music_dir = NULL;
+#endif
 
 const char *
 rb_file (const char *filename)
@@ -91,6 +93,9 @@ rb_dot_dir (void)
 	return dot_dir;
 }
 
+
+#ifndef HAVE_G_GET_USER_SPECIAL_DIR
+
 /* Copied from xdg-user-dir-lookup.c */
 #include <stdlib.h>
 
@@ -222,6 +227,25 @@ rb_music_dir (void)
 	return (const char *) music_dir;
 }
 
+#else		/* HAVE_G_GET_USER_SPECIAL_DIR */
+
+const char *
+rb_music_dir (void)
+{
+	const char *dir;
+	dir = g_get_user_special_dir (G_USER_DIRECTORY_MUSIC);
+	if (dir == NULL) {
+		dir = getenv ("HOME");
+		if (dir == NULL) {
+			dir = "/tmp";
+		}
+	}
+	rb_debug ("user music dir: %s", dir);
+	return dir;
+}
+
+#endif
+
 void
 rb_file_helpers_init (void)
 {
