Remove systemdialogs option from configuration

The option controls the welcome window and the export/import result messages.
The former is dropped. The latter are now always displayed unless calcurse is
invoked with the "quiet" option (-q).

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lars Henriksen 2020-05-30 23:23:03 +02:00 committed by Lukas Fleischer
parent 223f722b1d
commit 5942c0760d
8 changed files with 9 additions and 51 deletions

View File

@ -97,7 +97,7 @@ static void usage(void)
"calcurse [-D <directory>] [-C <directory>] [-c <calendar file>]\n" "calcurse [-D <directory>] [-C <directory>] [-c <calendar file>]\n"
"calcurse -Q [--from <date>] [--to <date>] [--days <number>]\n" "calcurse -Q [--from <date>] [--to <date>] [--days <number>]\n"
"calcurse -a | -d <date> | -d <number> | -n | -r[<number>] | -s[<date>] | -t[<number>]\n" "calcurse -a | -d <date> | -d <number> | -n | -r[<number>] | -s[<date>] | -t[<number>]\n"
"calcurse -h | -v | --status | -G | -P | -g | -i <file> | -x[<file>] | --daemon")); "calcurse -h | -v | --status | -G | -P | -g | -i <file> | -x[<format>] | --daemon"));
} }
static void usage_try(void) static void usage_try(void)
@ -149,7 +149,7 @@ static void help_arg(void)
printf("%s\n", _(" -g, --gc Run the garbage collector")); printf("%s\n", _(" -g, --gc Run the garbage collector"));
printf("%s\n", _(" -h, --help Show this help text")); printf("%s\n", _(" -h, --help Show this help text"));
printf("%s\n", _(" -i, --import <file> Import iCal data from file")); printf("%s\n", _(" -i, --import <file> Import iCal data from file"));
printf("%s\n", _(" -q, --quiet Suppress system dialogs")); printf("%s\n", _(" -q, --quiet Suppress import/export result message"));
printf("%s\n", _(" --read-only Do not save configuration or data files")); printf("%s\n", _(" --read-only Do not save configuration or data files"));
printf("%s\n", _(" --status Display status of running instances")); printf("%s\n", _(" --status Display status of running instances"));
printf("%s\n", _(" -v, --version Show version information")); printf("%s\n", _(" -v, --version Show version information"));

View File

@ -670,8 +670,6 @@ cleanup:
*/ */
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int no_data_file = 1;
#if ENABLE_NLS #if ENABLE_NLS
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
@ -686,7 +684,7 @@ int main(int argc, char **argv)
/* Non-interactive mode. */ /* Non-interactive mode. */
exit_calcurse(EXIT_SUCCESS); exit_calcurse(EXIT_SUCCESS);
} else { } else {
no_data_file = io_check_data_files(); io_check_data_files();
dmon_stop(); dmon_stop();
io_set_lock(); io_set_lock();
} }
@ -756,10 +754,6 @@ int main(int argc, char **argv)
* implicitly calling wrefresh() later (causing ncurses race conditions). * implicitly calling wrefresh() later (causing ncurses race conditions).
*/ */
wins_wrefresh(win[KEY].p); wins_wrefresh(win[KEY].p);
if (show_dialogs()) {
wins_update(FLAG_ALL);
io_startup_screen(no_data_file);
}
ui_calendar_monthly_view_cache_set_invalid(); ui_calendar_monthly_view_cache_set_invalid();
do_storage(1); do_storage(1);
ui_todo_load_items(); ui_todo_load_items();

View File

@ -291,7 +291,6 @@ struct conf {
unsigned confirm_delete; unsigned confirm_delete;
enum win default_panel; enum win default_panel;
unsigned compact_panels; unsigned compact_panels;
unsigned system_dialogs;
unsigned multiple_days; unsigned multiple_days;
unsigned header_line; unsigned header_line;
unsigned event_separator; unsigned event_separator;
@ -924,7 +923,6 @@ unsigned io_dir_exists(const char *);
unsigned io_file_exists(const char *); unsigned io_file_exists(const char *);
int io_check_file(const char *); int io_check_file(const char *);
int io_check_data_files(void); int io_check_data_files(void);
void io_startup_screen(int);
void io_export_data(enum export_type, int); void io_export_data(enum export_type, int);
void io_import_data(enum import_type, char *, const char *, const char *, void io_import_data(enum import_type, char *, const char *, const char *,
const char *, const char *, const char *); const char *, const char *, const char *);
@ -1264,7 +1262,6 @@ int asprintf(char **, const char *, ...);
int starts_with(const char *, const char *); int starts_with(const char *, const char *);
int starts_with_ci(const char *, const char *); int starts_with_ci(const char *, const char *);
int hash_matches(const char *, const char *); int hash_matches(const char *, const char *);
int show_dialogs(void);
long overflow_add(long, long, long *); long overflow_add(long, long, long *);
long overflow_mul(long, long, long *); long overflow_mul(long, long, long *);
time_t next_wday(time_t, int); time_t next_wday(time_t, int);

View File

@ -119,7 +119,6 @@ static const struct confvar confmap[] = {
{"general.multipledays", CONFIG_HANDLER_BOOL(conf.multiple_days)}, {"general.multipledays", CONFIG_HANDLER_BOOL(conf.multiple_days)},
{"general.periodicsave", CONFIG_HANDLER_UNSIGNED(conf.periodic_save)}, {"general.periodicsave", CONFIG_HANDLER_UNSIGNED(conf.periodic_save)},
{"general.systemevents", CONFIG_HANDLER_BOOL(conf.systemevents)}, {"general.systemevents", CONFIG_HANDLER_BOOL(conf.systemevents)},
{"general.systemdialogs", CONFIG_HANDLER_BOOL(conf.system_dialogs)},
{"notification.command", CONFIG_HANDLER_STR(nbar.cmd)}, {"notification.command", CONFIG_HANDLER_STR(nbar.cmd)},
{"notification.notifyall", config_parse_notifyall, config_serialize_notifyall, NULL}, {"notification.notifyall", config_parse_notifyall, config_serialize_notifyall, NULL},
{"notification.warning", CONFIG_HANDLER_INT(nbar.cntdwn)} {"notification.warning", CONFIG_HANDLER_INT(nbar.cntdwn)}
@ -615,7 +614,8 @@ config_file_walk(config_fn_walk_cb_t fn_cb,
* Backwards compatibility for removed configuration options: * Backwards compatibility for removed configuration options:
* ignored on load, omitted on save. * ignored on load, omitted on save.
*/ */
if (strcmp(key, "general.progressbar") == 0) if (strcmp(key, "general.progressbar") == 0 ||
strcmp(key, "general.systemdialogs") == 0)
continue; continue;
if (value && (*value == '\0' || *value == '\n')) { if (value && (*value == '\0' || *value == '\n')) {

View File

@ -540,7 +540,6 @@ enum {
SYSTEM_EVENTS, SYSTEM_EVENTS,
CONFIRM_QUIT, CONFIRM_QUIT,
CONFIRM_DELETE, CONFIRM_DELETE,
SYSTEM_DIAGS,
FIRST_DAY_OF_WEEK, FIRST_DAY_OF_WEEK,
OUTPUT_DATE_FMT, OUTPUT_DATE_FMT,
INPUT_DATE_FMT, INPUT_DATE_FMT,
@ -570,7 +569,6 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d
"general.systemevents = ", "general.systemevents = ",
"general.confirmquit = ", "general.confirmquit = ",
"general.confirmdelete = ", "general.confirmdelete = ",
"general.systemdialogs = ",
"general.firstdayofweek = ", "general.firstdayofweek = ",
"format.outputdate = ", "format.outputdate = ",
"format.inputdate = ", "format.inputdate = ",
@ -699,13 +697,6 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d
_("(if set to YES, confirmation is required " _("(if set to YES, confirmation is required "
"before deleting an event)")); "before deleting an event)"));
break; break;
case SYSTEM_DIAGS:
print_bool_option_incolor(win, conf.system_dialogs, y,
XPOS + strlen(opt[SYSTEM_DIAGS]));
mvwaddstr(win, y + 1, XPOS,
_("(if set to YES, messages about loaded "
"and saved data will be displayed)"));
break;
case FIRST_DAY_OF_WEEK: case FIRST_DAY_OF_WEEK:
custom_apply_attr(win, ATTR_HIGHEST); custom_apply_attr(win, ATTR_HIGHEST);
mvwaddstr(win, y, XPOS + strlen(opt[FIRST_DAY_OF_WEEK]), mvwaddstr(win, y, XPOS + strlen(opt[FIRST_DAY_OF_WEEK]),
@ -873,9 +864,6 @@ static void general_option_edit(int i)
case CONFIRM_DELETE: case CONFIRM_DELETE:
conf.confirm_delete = !conf.confirm_delete; conf.confirm_delete = !conf.confirm_delete;
break; break;
case SYSTEM_DIAGS:
conf.system_dialogs = !conf.system_dialogs;
break;
case FIRST_DAY_OF_WEEK: case FIRST_DAY_OF_WEEK:
ui_calendar_change_first_day_of_week(); ui_calendar_change_first_day_of_week();
ui_calendar_monthly_view_cache_set_invalid(); ui_calendar_monthly_view_cache_set_invalid();

View File

@ -1207,21 +1207,6 @@ int io_check_data_files(void)
return missing; return missing;
} }
/* Draw the startup screen */
void io_startup_screen(int no_data_file)
{
const char *enter = _("Press [ENTER] to continue");
if (no_data_file)
status_mesg(_("Welcome to Calcurse. Missing data files were created."),
enter);
else
status_mesg(_("Data files found. Data will be loaded now."),
enter);
keys_wait_for_any_key(win[KEY].p);
}
/* Export calcurse data. */ /* Export calcurse data. */
void io_export_data(enum export_type type, int export_uid) void io_export_data(enum export_type type, int export_uid)
{ {
@ -1252,7 +1237,7 @@ void io_export_data(enum export_type type, int export_uid)
else if (type == IO_EXPORT_PCAL) else if (type == IO_EXPORT_PCAL)
pcal_export_data(stream); pcal_export_data(stream);
if (show_dialogs() && ui_mode == UI_CURSES) { if (!quiet && ui_mode == UI_CURSES) {
fclose(stream); fclose(stream);
status_mesg(success, enter); status_mesg(success, enter);
keys_wait_for_any_key(win[KEY].p); keys_wait_for_any_key(win[KEY].p);
@ -1360,7 +1345,7 @@ void io_import_data(enum import_type type, char *stream_name,
stats.todos); stats.todos);
asprintf(&stats_str[3], _("%d skipped"), stats.skipped); asprintf(&stats_str[3], _("%d skipped"), stats.skipped);
if (ui_mode == UI_CURSES && show_dialogs()) { if (ui_mode == UI_CURSES && !quiet) {
char *read, *stat; char *read, *stat;
asprintf(&read, proc_report, stats.lines); asprintf(&read, proc_report, stats.lines);
@ -1371,7 +1356,7 @@ void io_import_data(enum import_type type, char *stream_name,
mem_free(read); mem_free(read);
mem_free(stat); mem_free(stat);
keys_wait_for_any_key(win[KEY].p); keys_wait_for_any_key(win[KEY].p);
} else if (ui_mode == UI_CMDLINE && show_dialogs()) { } else if (ui_mode == UI_CMDLINE && !quiet) {
printf(proc_report, stats.lines); printf(proc_report, stats.lines);
printf("\n%s / %s / %s / %s\n", stats_str[0], stats_str[1], printf("\n%s / %s / %s / %s\n", stats_str[0], stats_str[1],
stats_str[2], stats_str[3]); stats_str[2], stats_str[3]);

View File

@ -1976,11 +1976,6 @@ int hash_matches(const char *pattern, const char *hash)
return (starts_with(hash, pattern) != invert); return (starts_with(hash, pattern) != invert);
} }
int show_dialogs(void)
{
return (!quiet) && conf.system_dialogs;
}
/* /*
* Overflow check for addition with positive second term. * Overflow check for addition with positive second term.
*/ */

View File

@ -61,7 +61,7 @@ enum ui_mode ui_mode = UI_CMDLINE;
/* Don't save anything if this is set. */ /* Don't save anything if this is set. */
int read_only = 0; int read_only = 0;
/* Hide system dialogs if set. */ /* Hide import/export message if set. */
int quiet = 0; int quiet = 0;
/* Applications can trigger a reload by sending SIGUSR1. */ /* Applications can trigger a reload by sending SIGUSR1. */
@ -136,7 +136,6 @@ void vars_init(void)
conf.systemevents = 1; conf.systemevents = 1;
conf.default_panel = CAL; conf.default_panel = CAL;
conf.compact_panels = 0; conf.compact_panels = 0;
conf.system_dialogs = 1;
strncpy(conf.output_datefmt, "%D", 3); strncpy(conf.output_datefmt, "%D", 3);
conf.input_datefmt = 1; conf.input_datefmt = 1;
conf.heading_pos = RIGHT; conf.heading_pos = RIGHT;