diff options
author | James Booth <boothj5@gmail.com> | 2013-02-02 22:23:34 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-02-02 22:23:34 +0000 |
commit | 7398d565d7aa764a69274f5163c394966b7fcc3e (patch) | |
tree | 17755179bde5a8aae7e387046aafb234151b2110 /src/config | |
parent | 1247d1c7eec97b33677fb17a3863fdd5fb5a2f09 (diff) | |
download | profani-tty-7398d565d7aa764a69274f5163c394966b7fcc3e.tar.gz |
Moved function to get theme dir to theme.c
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/theme.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/config/theme.c b/src/config/theme.c index ec061ce4..0f18d4c6 100644 --- a/src/config/theme.c +++ b/src/config/theme.c @@ -32,10 +32,10 @@ #include <ncurses.h> #endif -#include "theme.h" - +#include "common.h" #include "files.h" #include "log.h" +#include "theme.h" static GString *theme_loc; static GKeyFile *theme; @@ -92,6 +92,7 @@ static NCURSES_COLOR_T _lookup_colour(const char * const colour); static void _set_colour(gchar *val, NCURSES_COLOR_T *pref, NCURSES_COLOR_T def); static void _load_colours(void); +static gchar * _get_themes_dir(void); void theme_init(const char * const theme_name) @@ -100,7 +101,7 @@ theme_init(const char * const theme_name) theme = g_key_file_new(); if (theme_name != NULL) { - gchar *themes_dir = files_get_themes_dir(); + gchar *themes_dir = _get_themes_dir(); theme_loc = g_string_new(themes_dir); g_free(themes_dir); g_string_append(theme_loc, "/"); @@ -116,7 +117,7 @@ GSList * theme_list(void) { GSList *result = NULL; - gchar *themes_dir = files_get_themes_dir(); + gchar *themes_dir = _get_themes_dir(); GDir *themes = g_dir_open(themes_dir, 0, NULL); if (themes != NULL) { const gchar *theme = g_dir_read_name(themes); @@ -143,7 +144,7 @@ theme_load(const char * const theme_name) _load_colours(); return TRUE; } else { - gchar *themes_dir = files_get_themes_dir(); + gchar *themes_dir = _get_themes_dir(); GString *new_theme_file = g_string_new(themes_dir); g_free(themes_dir); g_string_append(new_theme_file, "/"); @@ -358,3 +359,16 @@ _load_colours(void) _set_colour(them_val, &colour_prefs.them, COLOR_GREEN); g_free(them_val); } + +static gchar * +_get_themes_dir(void) +{ + gchar *xdg_config = xdg_get_config_home(); + GString *themes_dir = g_string_new(xdg_config); + g_string_append(themes_dir, "/profanity/themes"); + gchar *result = strdup(themes_dir->str); + g_free(xdg_config); + g_string_free(themes_dir, TRUE); + + return result; +} |