From 0b4c464919d44851afd9091eaa435d3fb205e18e Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 2 Feb 2013 22:12:35 +0000 Subject: [PATCH] Moved function to get chat log dir to log.c --- src/files.c | 13 ------------- src/files.h | 1 - src/log.c | 17 ++++++++++++++++- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/files.c b/src/files.c index 9ddad69f..bb339ad8 100644 --- a/src/files.c +++ b/src/files.c @@ -45,19 +45,6 @@ files_create_directories(void) _files_create_themes_directory(); } -gchar * -files_get_chatlog_dir(void) -{ - gchar *xdg_data = xdg_get_data_home(); - GString *chatlogs_dir = g_string_new(xdg_data); - g_string_append(chatlogs_dir, "/profanity/chatlogs"); - gchar *result = strdup(chatlogs_dir->str); - g_free(xdg_data); - g_string_free(chatlogs_dir, TRUE); - - return result; -} - gchar * files_get_preferences_file(void) { diff --git a/src/files.h b/src/files.h index 9c9670fa..5c34deaa 100644 --- a/src/files.h +++ b/src/files.h @@ -24,7 +24,6 @@ #define FILES_H void files_create_directories(void); -gchar* files_get_chatlog_dir(void); gchar* files_get_preferences_file(void); gchar* files_get_log_file(void); gchar* files_get_themes_dir(void); diff --git a/src/log.c b/src/log.c index 0282f60f..1fbdf72b 100644 --- a/src/log.c +++ b/src/log.c @@ -62,6 +62,7 @@ static void _free_chat_log(struct dated_chat_log *dated_log); static gboolean _key_equals(void *key1, void *key2); static char * _get_log_filename(const char * const other, const char * const login, GDateTime *dt, gboolean create); +static gchar * _get_chatlog_dir(void); static void _rotate_log_file(void); @@ -358,7 +359,7 @@ static char * _get_log_filename(const char * const other, const char * const login, GDateTime *dt, gboolean create) { - gchar *chatlogs_dir = files_get_chatlog_dir(); + gchar *chatlogs_dir = _get_chatlog_dir(); GString *log_file = g_string_new(chatlogs_dir); g_free(chatlogs_dir); @@ -384,3 +385,17 @@ _get_log_filename(const char * const other, const char * const login, return result; } + +static gchar * +_get_chatlog_dir(void) +{ + gchar *xdg_data = xdg_get_data_home(); + GString *chatlogs_dir = g_string_new(xdg_data); + g_string_append(chatlogs_dir, "/profanity/chatlogs"); + gchar *result = strdup(chatlogs_dir->str); + g_free(xdg_data); + g_string_free(chatlogs_dir, TRUE); + + return result; +} +