Use $XDG_DATA_HOME/themes for themes search, not just $HOME/.themes
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Sat, 30 May 2015 15:43:27 +0000 (18:43 +0300)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Sat, 30 May 2015 16:15:55 +0000 (19:15 +0300)
The XDG specification was updated back in 2012, we should conform with it.

src/color-scheme.c
src/widget-theme.c

index 9901643..4955ebd 100644 (file)
@@ -255,10 +255,20 @@ void color_scheme_update()
     if(app.widget_theme)
     {
         gboolean file_found;
-        char* gtkrc = g_build_filename(g_get_home_dir(), ".themes", app.widget_theme, "gtk-2.0/gtkrc", NULL);
-        /* if the theme is found in user-custom theme dir */
+        char *gtkrc;
+
+        /* search in userdata theme dir first */
+        gtkrc = g_build_filename(g_get_user_data_dir(), "themes", app.widget_theme, "gtk-2.0/gtkrc", NULL);
         file_found = gtkrc_file_get_color_scheme(gtkrc, app.default_color_scheme_hash);
         g_free(gtkrc);
+        if (!file_found)
+        {
+            /* search in the home dir as old-style fallback */
+            gtkrc = g_build_filename(g_get_home_dir(), ".themes", app.widget_theme, "gtk-2.0/gtkrc", NULL);
+            /* if the theme is found in user-custom theme dir */
+            file_found = gtkrc_file_get_color_scheme(gtkrc, app.default_color_scheme_hash);
+            g_free(gtkrc);
+        }
 
         if(!file_found)
         {
index 3211d42..0a17326 100644 (file)
@@ -70,7 +70,12 @@ static void load_themes()
     GtkTreeIter sel_it = {0};
     GtkTreeSelection* tree_sel;
 
-    /* load user dir */
+    /* load from userdata theme dir first */
+    dir = g_build_filename(g_get_user_data_dir(), "themes", NULL);
+    themes = load_themes_in_dir(dir, themes);
+    g_free(dir);
+
+    /* load from ~/.themes dir as old style */
     dir = g_build_filename(g_get_home_dir(), ".themes", NULL);
     themes = load_themes_in_dir(dir, themes);
     g_free(dir);