Index: lib/ephy-file-helpers.c
===================================================================
--- lib/ephy-file-helpers.c	(revision 7115)
+++ lib/ephy-file-helpers.c	(working copy)
@@ -98,8 +98,8 @@ ephy_file_tmp_dir (void)
 	return tmp_dir;
 }
 
+#if !GLIB_CHECK_VERSION (2, 13, 4)
 /* Copied from xdg-user-dir-lookup.c */
-
 static char *
 xdg_user_dir_lookup (const char *type)
 {
@@ -114,7 +114,7 @@ xdg_user_dir_lookup (const char *type)
   home_dir = getenv ("HOME");
 
   if (home_dir == NULL)
-    return strdup ("/tmp");
+    return g_strdup ("/tmp");
 
   config_home = getenv ("XDG_CONFIG_HOME");
   if (config_home == NULL || config_home[0] == 0)
@@ -216,8 +216,9 @@ xdg_user_dir_lookup (const char *type)
       return user_dir;
     }
   else
-    return strdup (home_dir);
+    return g_strdup (home_dir);
 }
+#endif
 
 static char *
 ephy_file_downloads_dir_from_xdg (void)
@@ -229,14 +230,21 @@ ephy_file_downloads_dir_from_xdg (void)
 	 * from xdg_user_dir_lookup, otherwise we might have a
 	 * mismatch in the string comparison below */
 	home_dir = getenv ("HOME");
+	#if GLIB_CHECK_VERSION (2, 13, 4)
+	downloads_dir = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD));
+	g_print("g_get_user_special_dir\n");
+	#else
 	downloads_dir = xdg_user_dir_lookup ("DOWNLOAD");
+	#endif
+
+	g_print("downloads_dir = %s; home_dir = %s \n", downloads_dir, home_dir);
 
 	/* No home directory, it will use /tmp then */
 	if (home_dir == NULL)
 		return downloads_dir;
 	/* If the dir lookup fellback on the home dir,
 	 * we don't want it, we have our own fall back code */
-	if (strcmp (downloads_dir, home_dir) == 0) {
+	if (downloads_dir && strcmp (downloads_dir, home_dir) == 0) {
 		g_free (downloads_dir);
 		return NULL;
 	}
