mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Moved function to get accouts files to accounts.c
This commit is contained in:
parent
c58aca5640
commit
1247d1c7ee
@ -44,6 +44,7 @@ static gchar *string_keys[] = {"jid", "server", "resource", "presence.last", "pr
|
||||
|
||||
static void _fix_legacy_accounts(const char * const account_name);
|
||||
static void _save_accounts(void);
|
||||
static gchar * _get_accounts_file(void);
|
||||
|
||||
void
|
||||
accounts_load(void)
|
||||
@ -51,7 +52,7 @@ accounts_load(void)
|
||||
log_info("Loading accounts");
|
||||
all_ac = autocomplete_new();
|
||||
enabled_ac = autocomplete_new();
|
||||
accounts_loc = files_get_accounts_file();
|
||||
accounts_loc = _get_accounts_file();
|
||||
|
||||
accounts = g_key_file_new();
|
||||
g_key_file_load_from_file(accounts, accounts_loc, G_KEY_FILE_KEEP_COMMENTS,
|
||||
@ -530,3 +531,17 @@ _save_accounts(void)
|
||||
char *g_accounts_data = g_key_file_to_data(accounts, &g_data_size, NULL);
|
||||
g_file_set_contents(accounts_loc, g_accounts_data, g_data_size, NULL);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
_get_accounts_file(void)
|
||||
{
|
||||
gchar *xdg_data = xdg_get_data_home();
|
||||
GString *logfile = g_string_new(xdg_data);
|
||||
g_string_append(logfile, "/profanity/accounts");
|
||||
gchar *result = strdup(logfile->str);
|
||||
g_free(xdg_data);
|
||||
g_string_free(logfile, TRUE);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
13
src/files.c
13
src/files.c
@ -45,19 +45,6 @@ files_create_directories(void)
|
||||
_files_create_themes_directory();
|
||||
}
|
||||
|
||||
gchar *
|
||||
files_get_accounts_file(void)
|
||||
{
|
||||
gchar *xdg_data = xdg_get_data_home();
|
||||
GString *logfile = g_string_new(xdg_data);
|
||||
g_string_append(logfile, "/profanity/accounts");
|
||||
gchar *result = strdup(logfile->str);
|
||||
g_free(xdg_data);
|
||||
g_string_free(logfile, TRUE);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
gchar *
|
||||
files_get_themes_dir(void)
|
||||
{
|
||||
|
@ -25,6 +25,5 @@
|
||||
|
||||
void files_create_directories(void);
|
||||
gchar* files_get_themes_dir(void);
|
||||
gchar* files_get_accounts_file(void);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user