about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/config')
-rw-r--r--src/config/accounts.c4
-rw-r--r--src/config/files.c29
-rw-r--r--src/config/files.h7
-rw-r--r--src/config/preferences.c25
-rw-r--r--src/config/scripts.c8
-rw-r--r--src/config/theme.c2
-rw-r--r--src/config/tlscerts.c2
7 files changed, 40 insertions, 37 deletions
diff --git a/src/config/accounts.c b/src/config/accounts.c
index 84671b74..d087bbb9 100644
--- a/src/config/accounts.c
+++ b/src/config/accounts.c
@@ -858,7 +858,7 @@ _save_accounts(void)
 {
     gsize g_data_size;
     gchar *g_accounts_data = g_key_file_to_data(accounts, &g_data_size, NULL);
-    gchar *xdg_data = xdg_get_data_home();
+    gchar *xdg_data = files_get_xdg_data_home();
     GString *base_str = g_string_new(xdg_data);
     g_string_append(base_str, "/profanity/");
     gchar *true_loc = get_file_or_linked(accounts_loc, base_str->str);
@@ -873,7 +873,7 @@ _save_accounts(void)
 static gchar*
 _get_accounts_file(void)
 {
-    gchar *xdg_data = xdg_get_data_home();
+    gchar *xdg_data = files_get_xdg_data_home();
     GString *logfile = g_string_new(xdg_data);
     g_string_append(logfile, "/profanity/accounts");
     gchar *result = strdup(logfile->str);
diff --git a/src/config/files.c b/src/config/files.c
index 5f57f691..7b8759b1 100644
--- a/src/config/files.c
+++ b/src/config/files.c
@@ -45,8 +45,8 @@
 void
 files_create_directories(void)
 {
-    gchar *xdg_config = xdg_get_config_home();
-    gchar *xdg_data = xdg_get_data_home();
+    gchar *xdg_config = files_get_xdg_config_home();
+    gchar *xdg_data = files_get_xdg_data_home();
 
     GString *themes_dir = g_string_new(xdg_config);
     g_string_append(themes_dir, "/profanity/themes");
@@ -86,7 +86,28 @@ files_create_directories(void)
 }
 
 gchar*
-xdg_get_config_home(void)
+files_get_inputrc_path(void)
+{
+    gchar *xdg_config = files_get_xdg_config_home();
+    GString *inputrc_file = g_string_new(xdg_config);
+    g_free(xdg_config);
+
+    g_string_append(inputrc_file, "/profanity/inputrc");
+
+    if (g_file_test(inputrc_file->str, G_FILE_TEST_IS_REGULAR)) {
+        gchar *result = strdup(inputrc_file->str);
+        g_string_free(inputrc_file, TRUE);
+
+        return result;
+    }
+
+    g_string_free(inputrc_file, TRUE);
+
+    return NULL;
+}
+
+gchar*
+files_get_xdg_config_home(void)
 {
     gchar *xdg_config_home = getenv("XDG_CONFIG_HOME");
     if (xdg_config_home)
@@ -105,7 +126,7 @@ xdg_get_config_home(void)
 }
 
 gchar*
-xdg_get_data_home(void)
+files_get_xdg_data_home(void)
 {
     gchar *xdg_data_home = getenv("XDG_DATA_HOME");
     if (xdg_data_home)
diff --git a/src/config/files.h b/src/config/files.h
index 431229f7..ff50cc1d 100644
--- a/src/config/files.h
+++ b/src/config/files.h
@@ -37,8 +37,11 @@
 
 #include <glib.h>
 
-gchar* xdg_get_config_home(void);
-gchar* xdg_get_data_home(void);
 void files_create_directories(void);
 
+gchar* files_get_inputrc_path(void);
+
+gchar* files_get_xdg_config_home(void);
+gchar* files_get_xdg_data_home(void);
+
 #endif
diff --git a/src/config/preferences.c b/src/config/preferences.c
index 3fd32586..d2d3b8ce 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -1121,27 +1121,6 @@ prefs_get_aliases(void)
     }
 }
 
-gchar*
-prefs_get_inputrc(void)
-{
-    gchar *xdg_config = xdg_get_config_home();
-    GString *inputrc_file = g_string_new(xdg_config);
-    g_free(xdg_config);
-
-    g_string_append(inputrc_file, "/profanity/inputrc");
-
-    if (g_file_test(inputrc_file->str, G_FILE_TEST_IS_REGULAR)) {
-        gchar *result = strdup(inputrc_file->str);
-        g_string_free(inputrc_file, TRUE);
-
-        return result;
-    }
-
-    g_string_free(inputrc_file, TRUE);
-
-    return NULL;
-}
-
 void
 _free_alias(ProfAlias *alias)
 {
@@ -1161,7 +1140,7 @@ _save_prefs(void)
 {
     gsize g_data_size;
     gchar *g_prefs_data = g_key_file_to_data(prefs, &g_data_size, NULL);
-    gchar *xdg_config = xdg_get_config_home();
+    gchar *xdg_config = files_get_xdg_config_home();
     GString *base_str = g_string_new(xdg_config);
     g_string_append(base_str, "/profanity/");
     gchar *true_loc = get_file_or_linked(prefs_loc, base_str->str);
@@ -1176,7 +1155,7 @@ _save_prefs(void)
 static gchar*
 _get_preferences_file(void)
 {
-    gchar *xdg_config = xdg_get_config_home();
+    gchar *xdg_config = files_get_xdg_config_home();
     GString *prefs_file = g_string_new(xdg_config);
     g_string_append(prefs_file, "/profanity/profrc");
     gchar *result = strdup(prefs_file->str);
diff --git a/src/config/scripts.c b/src/config/scripts.c
index 91dbe4df..8ab2684c 100644
--- a/src/config/scripts.c
+++ b/src/config/scripts.c
@@ -51,7 +51,7 @@
 void
 scripts_init(void)
 {
-    gchar *data_home = xdg_get_data_home();
+    gchar *data_home = files_get_xdg_data_home();
     GString *scriptsdir = g_string_new(data_home);
     free(data_home);
 
@@ -75,7 +75,7 @@ scripts_init(void)
 GSList*
 scripts_list(void)
 {
-    gchar *data_home = xdg_get_data_home();
+    gchar *data_home = files_get_xdg_data_home();
     GString *scriptsdir = g_string_new(data_home);
     free(data_home);
     g_string_append(scriptsdir, "/profanity/scripts");
@@ -99,7 +99,7 @@ scripts_list(void)
 GSList*
 scripts_read(const char *const script)
 {
-    gchar *data_home = xdg_get_data_home();
+    gchar *data_home = files_get_xdg_data_home();
     GString *scriptpath = g_string_new(data_home);
     free(data_home);
 
@@ -137,7 +137,7 @@ scripts_read(const char *const script)
 gboolean
 scripts_exec(const char *const script)
 {
-    gchar *data_home = xdg_get_data_home();
+    gchar *data_home = files_get_xdg_data_home();
     GString *scriptpath = g_string_new(data_home);
     free(data_home);
 
diff --git a/src/config/theme.c b/src/config/theme.c
index fb208279..55698ed6 100644
--- a/src/config/theme.c
+++ b/src/config/theme.c
@@ -535,7 +535,7 @@ _load_preferences(void)
 static gchar*
 _get_themes_dir(void)
 {
-    gchar *xdg_config = xdg_get_config_home();
+    gchar *xdg_config = files_get_xdg_config_home();
     GString *themes_dir = g_string_new(xdg_config);
     g_free(xdg_config);
     g_string_append(themes_dir, "/profanity/themes");
diff --git a/src/config/tlscerts.c b/src/config/tlscerts.c
index 03a8bd97..8a93ed51 100644
--- a/src/config/tlscerts.c
+++ b/src/config/tlscerts.c
@@ -432,7 +432,7 @@ tlscerts_close(void)
 static gchar*
 _get_tlscerts_file(void)
 {
-    gchar *xdg_data = xdg_get_data_home();
+    gchar *xdg_data = files_get_xdg_data_home();
     GString *tlscerts_file = g_string_new(xdg_data);
     g_string_append(tlscerts_file, "/profanity/tlscerts");
     gchar *result = strdup(tlscerts_file->str);