[gtk+] Try to load css themes from the XDG config directory first



commit 9f5e580821d3181e2aa2ccfb5488d1b8ae1b0ffb
Author: William Jon McCann <jmccann redhat com>
Date:   Fri Apr 27 12:32:18 2012 -0400

    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 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index a2df0f0..9045498 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;
+                }
             }
         }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]