diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 35e94e8faf..f178905132 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -47,7 +47,7 @@
* calling gtk_css_provider_load_from_file() and adding the provider with
* gtk_style_context_add_provider() or gtk_style_context_add_provider_for_screen().
* In addition, certain files will be read when GTK+ is initialized. First,
- * the file HOME/.gtk-3.0.css
+ * the file XDG_CONFIG_HOME/gtk-3.0/gtk.css
* is loaded if it exists. Then, GTK+ tries to load
* HOME/.themes/theme-name/gtk-3.0/gtk.css,
* falling back to
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 58fd2c1f4d..f57924b65e 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -1354,18 +1354,19 @@ settings_init_style (GtkSettings *settings)
/* Add provider for user file */
if (G_UNLIKELY (!css_provider))
{
- GFile *home_dir, *css_file;
+ gchar *css_path;
css_provider = gtk_css_provider_new ();
+ css_path = g_build_filename (g_get_user_config_dir (),
+ "gtk-3.0",
+ "gtk.css",
+ NULL);
- home_dir = g_file_new_for_path (g_get_home_dir ());
- css_file = g_file_get_child (home_dir, ".gtk-3.0.css");
+ if (g_file_test (css_path,
+ G_FILE_TEST_IS_REGULAR))
+ gtk_css_provider_load_from_path (css_provider, css_path, NULL);
- if (g_file_query_exists (css_file, NULL))
- gtk_css_provider_load_from_file (css_provider, css_file, NULL);
-
- g_object_unref (home_dir);
- g_object_unref (css_file);
+ g_free (css_path);
}
gtk_style_context_add_provider_for_screen (settings->screen,
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index c458c244b4..65255402ff 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -390,7 +390,8 @@
* If you are using custom styling on an applications, you probably want then
* to make your style information prevail to the theme's, so you must use
* a #GtkStyleProvider with the %GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
- * priority, keep in mind that the user settings in $HOME/.gtk-3.0.css will
+ * priority, keep in mind that the user settings in
+ * XDG_CONFIG_HOME/gtk-3.0/gtk.css will
* still take precedence over your changes, as it uses the
* %GTK_STYLE_PROVIDER_PRIORITY_USER priority.
*
diff --git a/gtk/gtkstyleprovider.h b/gtk/gtkstyleprovider.h
index 1e59989bd1..731c346007 100644
--- a/gtk/gtkstyleprovider.h
+++ b/gtk/gtkstyleprovider.h
@@ -72,7 +72,7 @@ G_BEGIN_DECLS
* GTK_STYLE_PROVIDER_PRIORITY_USER:
*
* The priority used for the style information from
- * ~/.gtk-3.0.css.
+ * XDG_CONFIG_HOME/gtk-3.0/gtk.css
*
* You should not use priorities higher than this, to
* give the user the last word.