1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 08:43:02 +01:00

properly set default user settings

This commit is contained in:
Jfreegman 2014-05-29 13:57:15 -04:00
parent b0a66706bd
commit ab1c97fb2b

View File

@ -96,6 +96,17 @@ static void uset_hst_size(struct user_settings *s, int val)
s->history_size = (val > MAX_HISTORY || val < MIN_HISTORY) ? DFLT_HST_SIZE : val;
}
static void set_default_settings(struct user_settings *s)
{
uset_autolog(s, AUTOLOG_OFF);
uset_time(s, TIME_24);
uset_alerts(s, ALERTS_ENABLED);
uset_colours(s, DFLT_COLS);
uset_ain_dev(s, 0);
uset_aout_dev(s, 0);
uset_hst_size(s, DFLT_HST_SIZE);
}
int settings_load(struct user_settings *s, char *path)
{
char *user_config_dir = get_user_config_dir();
@ -111,7 +122,7 @@ int settings_load(struct user_settings *s, char *path)
free(user_config_dir);
uset_hst_size(s, DFLT_HST_SIZE); /* must be forced in case no setting specified */
set_default_settings(s);
if (fp == NULL && !path) {
if ((fp = fopen(dflt_path, "w")) == NULL)