diff --git a/libdocument/ev-file-helpers.c b/libdocument/ev-file-helpers.c
index 80254b3..9d7822f 100644
--- a/libdocument/ev-file-helpers.c
+++ b/libdocument/ev-file-helpers.c
@@ -36,7 +36,8 @@
 
 #include "ev-file-helpers.h"
 
-static gchar *dot_dir = NULL;
+static gchar *config_dir = NULL;
+static gchar *cache_dir = NULL;
 static gchar *tmp_dir = NULL;
 static gint   count = 0;
 
@@ -57,22 +58,57 @@ ensure_dir_exists (const char *dir)
 }
 
 const gchar *
-ev_dot_dir (void)
+ev_config_dir (void)
 {
-	if (dot_dir == NULL) {
+	if (config_dir == NULL) {
 		gboolean exists;
 
-		dot_dir = g_build_filename (g_get_home_dir (),
+		config_dir = g_build_filename (g_get_home_dir (),
 					    ".gnome2",
 					    "evince",
 					    NULL);
 
-		exists = ensure_dir_exists (dot_dir);
-		if (!exists)
-			exit (1);
+		exists = g_file_test (config_dir, G_FILE_TEST_IS_DIR);
+		if (!exists) {
+			g_free (config_dir);
+			config_dir = g_build_filename (g_get_user_config_dir (),
+						    "evince",
+						    NULL);
+
+			exists = ensure_dir_exists (config_dir);
+			if (!exists)
+				exit (1);
+		}
 	}
 
-	return dot_dir;
+	return config_dir;
+}
+
+const gchar *
+ev_cache_dir (void)
+{
+	if (cache_dir == NULL) {
+		gboolean exists;
+
+		cache_dir = g_build_filename (g_get_home_dir (),
+					    ".gnome2",
+					    "evince",
+					    NULL);
+
+		exists = g_file_test (cache_dir, G_FILE_TEST_IS_DIR);
+		if (!exists) {
+			g_free (cache_dir);
+			cache_dir = g_build_filename (g_get_user_cache_dir (),
+						    "evince",
+						    NULL);
+
+			exists = ensure_dir_exists (cache_dir);
+			if (!exists)
+				exit (1);
+		}
+	}
+
+	return cache_dir;
 }
 
 const gchar *
@@ -107,9 +143,11 @@ ev_file_helpers_shutdown (void)
 		g_rmdir (tmp_dir);
 
 	g_free (tmp_dir);
-	g_free (dot_dir);
+	g_free (config_dir);
+	g_free (cache_dir);
 
-	dot_dir = NULL;
+	config_dir = NULL;
+	cache_dir = NULL;
 	tmp_dir = NULL;
 }
 
diff --git a/libdocument/ev-file-helpers.h b/libdocument/ev-file-helpers.h
index cd86320..7fbeaa3 100644
--- a/libdocument/ev-file-helpers.h
+++ b/libdocument/ev-file-helpers.h
@@ -32,7 +32,9 @@ typedef enum {
 	EV_COMPRESSION_GZIP
 } EvCompressionType;
 
-const gchar *ev_dot_dir               (void);
+const gchar *ev_config_dir            (void);
+
+const gchar *ev_cache_dir             (void);
 
 const gchar *ev_tmp_dir               (void);
 
diff --git a/shell/ev-application.c b/shell/ev-application.c
index e852561..d958a86 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -745,12 +745,28 @@ static void
 ev_application_init (EvApplication *ev_application)
 {
 	gint i;
+	gchar *config_dir;
 	const gchar *home_dir;
 	
 	ev_application_init_session (ev_application);
 
-	home_dir = g_get_home_dir ();
-	if (home_dir) {
+	ev_application->toolbars_model = egg_toolbars_model_new ();
+
+	ev_application->toolbars_file = g_build_filename
+			(ev_config_dir (), "evince_toolbar.xml", NULL);
+
+	// This test should be run after at least one ev_dot_dir call, to give 
+	// $XDG_CONFIG_HOME/evince a chance to be created
+	config_dir = g_build_filename (g_get_user_config_dir (), 
+				       "evince", 
+				       NULL);
+	home_dir = g_get_home_dir();
+	if (g_file_test (config_dir, G_FILE_TEST_IS_DIR)) {
+		ev_application->accel_map_file = g_build_filename (config_dir,
+								   "accels",
+								   NULL);
+		gtk_accel_map_load (ev_application->accel_map_file);
+	} else if (home_dir) {
 		ev_application->accel_map_file = g_build_filename (home_dir,
 								   ".gnome2",
 								   "accels"
@@ -758,12 +774,8 @@ ev_application_init (EvApplication *ev_application)
 								   NULL);
 		gtk_accel_map_load (ev_application->accel_map_file);
 	}
+	g_free (config_dir);
 	
-	ev_application->toolbars_model = egg_toolbars_model_new ();
-
-	ev_application->toolbars_file = g_build_filename
-			(ev_dot_dir (), "evince_toolbar.xml", NULL);
-
 	egg_toolbars_model_load_names (ev_application->toolbars_model,
 				       DATADIR "/evince-toolbar.xml");
 
@@ -891,7 +903,7 @@ ev_application_get_print_settings (EvApplication *application)
 #if GTK_CHECK_VERSION (2, 11, 0)
 	if (!application->print_settings_file) {
 		application->print_settings_file =
-			g_build_filename (ev_dot_dir (), "print-settings", NULL);
+			g_build_filename (ev_config_dir (), "print-settings", NULL);
 	}
 
 	if (g_file_test (application->print_settings_file, G_FILE_TEST_IS_REGULAR)) {
diff --git a/shell/ev-metadata-manager.c b/shell/ev-metadata-manager.c
index ce164ad..3e9e318 100644
--- a/shell/ev-metadata-manager.c
+++ b/shell/ev-metadata-manager.c
@@ -271,7 +271,7 @@ load_values ()
 	xmlKeepBlanksDefault (0);
 
 	/* FIXME: file locking - Paolo */
-	file_name = g_build_filename (ev_dot_dir (), METADATA_FILE, NULL);
+	file_name = g_build_filename (ev_cache_dir (), METADATA_FILE, NULL);
 	if (!g_file_test (file_name, G_FILE_TEST_EXISTS))
 	{
 		g_free (file_name);
@@ -670,7 +670,7 @@ ev_metadata_manager_save (gpointer data)
 			  (GHFunc)save_item, root);        
 
 	/* FIXME: lock file - Paolo */
-	file_name = g_build_filename (ev_dot_dir (), METADATA_FILE, NULL);
+	file_name = g_build_filename (ev_cache_dir (), METADATA_FILE, NULL);
 	xmlSaveFormatFile (file_name, doc, 1);
 	g_free (file_name);
 	
