From 9f5e580821d3181e2aa2ccfb5488d1b8ae1b0ffb Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Fri, 27 Apr 2012 12:32:18 -0400 Subject: [PATCH] Try to load css themes from the XDG config directory first Will fall back to previous locations. https://bugzilla.gnome.org/show_bug.cgi?id=646631 --- gtk/gtkcssprovider.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c index a2df0f0386..9045498ee9 100644 --- a/gtk/gtkcssprovider.c +++ b/gtk/gtkcssprovider.c @@ -2719,7 +2719,6 @@ gtk_css_provider_get_named (const gchar *name, if (!provider) { - const gchar *home_dir; gchar *subpath, *path = NULL; if (variant) @@ -2727,17 +2726,31 @@ gtk_css_provider_get_named (const gchar *name, else subpath = g_strdup ("gtk-3.0" G_DIR_SEPARATOR_S "gtk.css"); - /* First look in the users home directory + /* First look in the user's config directory */ - home_dir = g_get_home_dir (); - if (home_dir) + path = g_build_filename (g_get_user_data_dir (), "themes", name, subpath, NULL); + if (!g_file_test (path, G_FILE_TEST_EXISTS)) { - path = g_build_filename (home_dir, ".themes", name, subpath, NULL); + g_free (path); + path = NULL; + } - if (!g_file_test (path, G_FILE_TEST_EXISTS)) + /* Next look in the user's home directory + */ + if (!path) + { + const gchar *home_dir; + + home_dir = g_get_home_dir (); + if (home_dir) { - g_free (path); - path = NULL; + path = g_build_filename (home_dir, ".themes", name, subpath, NULL); + + if (!g_file_test (path, G_FILE_TEST_EXISTS)) + { + g_free (path); + path = NULL; + } } }