Index: lib/ephy-file-helpers.c
===================================================================
--- lib/ephy-file-helpers.c	(revision 7071)
+++ lib/ephy-file-helpers.c	(working copy)
@@ -98,8 +98,9 @@ ephy_file_tmp_dir (void)
 	return tmp_dir;
 }
 
+#if GLIB_CHECK_VERSION (2, 11, 3)
+#else
 /* Copied from xdg-user-dir-lookup.c */
-
 static char *
 xdg_user_dir_lookup (const char *type)
 {
@@ -218,25 +219,35 @@ xdg_user_dir_lookup (const char *type)
   else
     return strdup (home_dir);
 }
+#endif
 
 static char *
 ephy_file_downloads_dir_from_xdg (void)
 {
 	const char *home_dir;
 	char *downloads_dir;
+	const char *downloads_tmp;
 
 	/* We use getenv to exactly match the default output
 	 * 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, 11, 3)
+	/* This one shouldn't be freed */
+	downloads_tmp = g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD);
+	downloads_dir = g_strdup (downloads_tmp);
+	#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;
 	}
