X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=obt%2Fpaths.c;h=d99659b8c5daa6c0b87dd54651eff1026db7b20e;hb=5ca9c2e03cfdd8c5831c9b62187c7cec8fcdbfda;hp=68615433e1d9426dc58cdf462050cbe89937cf6c;hpb=965ed8907a5dd81d5ffbc93b67a672fa78833854;p=chaz%2Fopenbox diff --git a/obt/paths.c b/obt/paths.c index 68615433..d99659b8 100644 --- a/obt/paths.c +++ b/obt/paths.c @@ -37,6 +37,7 @@ struct _ObtPaths gchar *cache_home; GSList *config_dirs; GSList *data_dirs; + GSList *autostart_dirs; }; static gint slist_path_cmp(const gchar *a, const gchar *b) @@ -79,8 +80,9 @@ ObtPaths* obt_paths_new(void) { ObtPaths *p; const gchar *path; + GSList *it; - p = g_new0(ObtPaths, 1); + p = g_slice_new0(ObtPaths); p->ref = 1; path = g_getenv("XDG_CONFIG_HOME"); @@ -119,6 +121,11 @@ ObtPaths* obt_paths_new(void) g_strdup(p->config_home), (GSListFunc) g_slist_prepend); + for (it = p->config_dirs; it; it = g_slist_next(it)) { + gchar *const s = g_strdup_printf("%s/autostart", (gchar*)it->data); + p->autostart_dirs = g_slist_append(p->autostart_dirs, s); + } + path = g_getenv("XDG_DATA_DIRS"); if (path && path[0] != '\0') /* not unset or empty */ p->data_dirs = split_paths(path); @@ -159,11 +166,14 @@ void obt_paths_unref(ObtPaths *p) for (it = p->data_dirs; it; it = g_slist_next(it)) g_free(it->data); g_slist_free(p->data_dirs); + for (it = p->autostart_dirs; it; it = g_slist_next(it)) + g_free(it->data); + g_slist_free(p->autostart_dirs); g_free(p->config_home); g_free(p->data_home); g_free(p->cache_home); - obt_free0(p, ObtPaths, 1); + g_slice_free(ObtPaths, p); } } @@ -247,3 +257,8 @@ GSList* obt_paths_data_dirs(ObtPaths *p) { return p->data_dirs; } + +GSList* obt_paths_autostart_dirs(ObtPaths *p) +{ + return p->autostart_dirs; +}