From 5942c0760dc49256c584e37368aeb3d4915f74f3 Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Sat, 30 May 2020 23:23:03 +0200 Subject: 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 Signed-off-by: Lukas Fleischer --- src/args.c | 4 ++-- src/calcurse.c | 8 +------- src/calcurse.h | 3 --- src/config.c | 4 ++-- src/custom.c | 12 ------------ src/io.c | 21 +++------------------ src/utils.c | 5 ----- src/vars.c | 3 +-- 8 files changed, 9 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/args.c b/src/args.c index b2ccb0a..886429d 100644 --- a/src/args.c +++ b/src/args.c @@ -97,7 +97,7 @@ static void usage(void) "calcurse [-D ] [-C ] [-c ]\n" "calcurse -Q [--from ] [--to ] [--days ]\n" "calcurse -a | -d | -d | -n | -r[] | -s[] | -t[]\n" - "calcurse -h | -v | --status | -G | -P | -g | -i | -x[] | --daemon")); + "calcurse -h | -v | --status | -G | -P | -g | -i | -x[] | --daemon")); } 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", _(" -h, --help Show this help text")); printf("%s\n", _(" -i, --import 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", _(" --status Display status of running instances")); printf("%s\n", _(" -v, --version Show version information")); diff --git a/src/calcurse.c b/src/calcurse.c index fe8b574..8a65fba 100644 --- a/src/calcurse.c +++ b/src/calcurse.c @@ -670,8 +670,6 @@ cleanup: */ int main(int argc, char **argv) { - int no_data_file = 1; - #if ENABLE_NLS setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); @@ -686,7 +684,7 @@ int main(int argc, char **argv) /* Non-interactive mode. */ exit_calcurse(EXIT_SUCCESS); } else { - no_data_file = io_check_data_files(); + io_check_data_files(); dmon_stop(); io_set_lock(); } @@ -756,10 +754,6 @@ int main(int argc, char **argv) * implicitly calling wrefresh() later (causing ncurses race conditions). */ 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(); do_storage(1); ui_todo_load_items(); diff --git a/src/calcurse.h b/src/calcurse.h index 74e667a..39a2af1 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -291,7 +291,6 @@ struct conf { unsigned confirm_delete; enum win default_panel; unsigned compact_panels; - unsigned system_dialogs; unsigned multiple_days; unsigned header_line; unsigned event_separator; @@ -924,7 +923,6 @@ unsigned io_dir_exists(const char *); unsigned io_file_exists(const char *); int io_check_file(const char *); int io_check_data_files(void); -void io_startup_screen(int); void io_export_data(enum export_type, int); void io_import_data(enum import_type, 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_ci(const char *, const char *); int hash_matches(const char *, const char *); -int show_dialogs(void); long overflow_add(long, long, long *); long overflow_mul(long, long, long *); time_t next_wday(time_t, int); diff --git a/src/config.c b/src/config.c index 27324e1..f621320 100644 --- a/src/config.c +++ b/src/config.c @@ -119,7 +119,6 @@ static const struct confvar confmap[] = { {"general.multipledays", CONFIG_HANDLER_BOOL(conf.multiple_days)}, {"general.periodicsave", CONFIG_HANDLER_UNSIGNED(conf.periodic_save)}, {"general.systemevents", CONFIG_HANDLER_BOOL(conf.systemevents)}, - {"general.systemdialogs", CONFIG_HANDLER_BOOL(conf.system_dialogs)}, {"notification.command", CONFIG_HANDLER_STR(nbar.cmd)}, {"notification.notifyall", config_parse_notifyall, config_serialize_notifyall, NULL}, {"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: * ignored on load, omitted on save. */ - if (strcmp(key, "general.progressbar") == 0) + if (strcmp(key, "general.progressbar") == 0 || + strcmp(key, "general.systemdialogs") == 0) continue; if (value && (*value == '\0' || *value == '\n')) { diff --git a/src/custom.c b/src/custom.c index 575960a..c699797 100644 --- a/src/custom.c +++ b/src/custom.c @@ -540,7 +540,6 @@ enum { SYSTEM_EVENTS, CONFIRM_QUIT, CONFIRM_DELETE, - SYSTEM_DIAGS, FIRST_DAY_OF_WEEK, OUTPUT_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.confirmquit = ", "general.confirmdelete = ", - "general.systemdialogs = ", "general.firstdayofweek = ", "format.outputdate = ", "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 " "before deleting an event)")); 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: custom_apply_attr(win, ATTR_HIGHEST); mvwaddstr(win, y, XPOS + strlen(opt[FIRST_DAY_OF_WEEK]), @@ -873,9 +864,6 @@ static void general_option_edit(int i) case CONFIRM_DELETE: conf.confirm_delete = !conf.confirm_delete; break; - case SYSTEM_DIAGS: - conf.system_dialogs = !conf.system_dialogs; - break; case FIRST_DAY_OF_WEEK: ui_calendar_change_first_day_of_week(); ui_calendar_monthly_view_cache_set_invalid(); diff --git a/src/io.c b/src/io.c index 1caa6d3..663c858 100644 --- a/src/io.c +++ b/src/io.c @@ -1207,21 +1207,6 @@ int io_check_data_files(void) 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. */ 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) pcal_export_data(stream); - if (show_dialogs() && ui_mode == UI_CURSES) { + if (!quiet && ui_mode == UI_CURSES) { fclose(stream); status_mesg(success, enter); 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); asprintf(&stats_str[3], _("%d skipped"), stats.skipped); - if (ui_mode == UI_CURSES && show_dialogs()) { + if (ui_mode == UI_CURSES && !quiet) { char *read, *stat; 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(stat); 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("\n%s / %s / %s / %s\n", stats_str[0], stats_str[1], stats_str[2], stats_str[3]); diff --git a/src/utils.c b/src/utils.c index 4da7f79..0a98ce0 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1976,11 +1976,6 @@ int hash_matches(const char *pattern, const char *hash) return (starts_with(hash, pattern) != invert); } -int show_dialogs(void) -{ - return (!quiet) && conf.system_dialogs; -} - /* * Overflow check for addition with positive second term. */ diff --git a/src/vars.c b/src/vars.c index 8c1a042..2c308e7 100644 --- a/src/vars.c +++ b/src/vars.c @@ -61,7 +61,7 @@ enum ui_mode ui_mode = UI_CMDLINE; /* Don't save anything if this is set. */ int read_only = 0; -/* Hide system dialogs if set. */ +/* Hide import/export message if set. */ int quiet = 0; /* Applications can trigger a reload by sending SIGUSR1. */ @@ -136,7 +136,6 @@ void vars_init(void) conf.systemevents = 1; conf.default_panel = CAL; conf.compact_panels = 0; - conf.system_dialogs = 1; strncpy(conf.output_datefmt, "%D", 3); conf.input_datefmt = 1; conf.heading_pos = RIGHT; -- cgit v1.2.3-54-g00ecf