From 7398d565d7aa764a69274f5163c394966b7fcc3e Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 2 Feb 2013 22:23:34 +0000 Subject: [PATCH] Moved function to get theme dir to theme.c --- src/config/theme.c | 24 +++++++++++++++++++----- src/files.c | 13 ------------- src/files.h | 1 - 3 files changed, 19 insertions(+), 19 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 #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; +} diff --git a/src/files.c b/src/files.c index 671ba309..8600e2ea 100644 --- a/src/files.c +++ b/src/files.c @@ -45,19 +45,6 @@ files_create_directories(void) _files_create_themes_directory(); } -gchar * -files_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; -} - static void _files_create_config_directory(void) { diff --git a/src/files.h b/src/files.h index 735473aa..5b88009d 100644 --- a/src/files.h +++ b/src/files.h @@ -24,6 +24,5 @@ #define FILES_H void files_create_directories(void); -gchar* files_get_themes_dir(void); #endif