1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-06-20 10:26:37 +02:00

add setting to disable welcome message

This commit is contained in:
Jfreegman
2014-09-19 01:06:18 -04:00
parent daf4614ba6
commit 9ee7a48910
8 changed files with 27 additions and 7 deletions

View File

@ -464,7 +464,8 @@ static void prompt_onInit(ToxWindow *self, Tox *m)
scrollok(ctx->history, 0);
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
print_welcome_msg(self);
if (user_settings_->show_welcome_msg == SHOW_WELCOME_MSG_ON)
print_welcome_msg(self);
}
ToxWindow new_prompt(void)

View File

@ -54,6 +54,7 @@ static struct _ui_strings {
const char* history_size;
const char* show_typing_self;
const char* show_typing_other;
const char* show_welcome_msg;
} ui_strings = {
"ui",
"timestamps",
@ -64,6 +65,7 @@ static struct _ui_strings {
"history_size",
"show_typing_self",
"show_typing_other",
"show_welcome_msg",
};
static void ui_defaults(struct user_settings* settings)
@ -76,6 +78,7 @@ static void ui_defaults(struct user_settings* settings)
settings->history_size = 700;
settings->show_typing_self = SHOW_TYPING_ON;
settings->show_typing_other = SHOW_TYPING_ON;
settings->show_welcome_msg = SHOW_WELCOME_MSG_ON;
}
static const struct _keys_strings {
@ -250,6 +253,7 @@ int settings_load(struct user_settings *s, const char *patharg)
config_setting_lookup_int(setting, ui_strings.history_size, &s->history_size);
config_setting_lookup_bool(setting, ui_strings.show_typing_self, &s->show_typing_self);
config_setting_lookup_bool(setting, ui_strings.show_typing_other, &s->show_typing_other);
config_setting_lookup_bool(setting, ui_strings.show_welcome_msg, &s->show_welcome_msg);
config_setting_lookup_int(setting, ui_strings.time_format, &s->time);
s->time = s->time == TIME_24 || s->time == TIME_12 ? s->time : TIME_24; /* Check defaults */
}

View File

@ -35,6 +35,7 @@ struct user_settings {
int history_size; /* int between MIN_HISTORY and MAX_HISTORY */
int show_typing_self; /* boolean */
int show_typing_other; /* boolean */
int show_welcome_msg; /* boolean */
char download_path[PATH_MAX];
char chatlogs_path[PATH_MAX];
@ -74,6 +75,9 @@ enum {
SHOW_TYPING_OFF = 0,
SHOW_TYPING_ON = 1,
SHOW_WELCOME_MSG_OFF = 0,
SHOW_WELCOME_MSG_ON = 1,
DFLT_HST_SIZE = 700,
} settings_values;