From c1b2fc5324522f74a14a5cfa210c95e1509a6e7f Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 15 Sep 2003 19:20:05 +0000 Subject: make openbox base-dir spec compliant, and change the theme dir structure, so that themes go in $XDG_DATA_DIRS/themes/ with gtk/metacity/whateverelse themes --- render/theme.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'render/theme.c') diff --git a/render/theme.c b/render/theme.c index 907fd0b5..8ad8c841 100644 --- a/render/theme.c +++ b/render/theme.c @@ -4,6 +4,7 @@ #include "mask.h" #include "theme.h" #include "icon.h" +#include "parser/parse.h" #include #include @@ -1059,21 +1060,29 @@ void RrThemeFree(RrTheme *theme) static XrmDatabase loaddb(RrTheme *theme, char *name) { - XrmDatabase db; + GSList *it; + XrmDatabase db = NULL; + gchar *s; - char *s = g_build_filename(g_get_home_dir(), ".openbox", "themes", - name, "themerc", NULL); - if ((db = XrmGetFileDatabase(s))) - theme->path = g_path_get_dirname(s); - g_free(s); - if (db == NULL) { - char *s = g_build_filename(THEMEDIR, name, "themerc", NULL); + if (name[0] == '/') { + s = g_build_filename(name, "openbox-3", "themerc", NULL); if ((db = XrmGetFileDatabase(s))) theme->path = g_path_get_dirname(s); - g_free(s); + g_free(s); + } else { + for (it = parse_xdg_data_dir_paths(); !db && it; + it = g_slist_next(it)) + { + s = g_build_filename(it->data, "themes", name, + "openbox-3", "themerc", NULL); + if ((db = XrmGetFileDatabase(s))) + theme->path = g_path_get_dirname(s); + g_free(s); + } } + if (db == NULL) { - char *s = g_build_filename(name, "themerc", NULL); + s = g_build_filename(name, "themerc", NULL); if ((db = XrmGetFileDatabase(s))) theme->path = g_path_get_dirname(s); g_free(s); -- cgit v1.2.3