diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-03-29 17:06:56 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-03-29 17:06:56 +0200 |
commit | c85c3cce558b32c4fb00a339872d4dbe035d3f6c (patch) | |
tree | a1f854cda63db04b189a95221d08549ff6dcf487 | |
parent | 8916293a26e7a79e3bf969aac9895b2678946deb (diff) | |
download | calcurse-c85c3cce558b32c4fb00a339872d4dbe035d3f6c.zip |
Fix semantics of "general."{systemdialogs,progressbar}
These were renamed from "skip_"* to *. However, we only changed syntax
and didn't invert their semantic meaning. Fix this by negating the
semantics of those variables. Also, negate these in the configuration
file automatically when running `calcurse-upgrade`.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r-- | scripts/calcurse-upgrade | 8 | ||||
-rw-r--r-- | src/calcurse.c | 2 | ||||
-rw-r--r-- | src/calcurse.h | 4 | ||||
-rw-r--r-- | src/config.c | 4 | ||||
-rw-r--r-- | src/custom.c | 16 | ||||
-rw-r--r-- | src/help.c | 4 | ||||
-rw-r--r-- | src/io.c | 12 | ||||
-rw-r--r-- | src/vars.c | 4 |
8 files changed, 31 insertions, 23 deletions
diff --git a/scripts/calcurse-upgrade b/scripts/calcurse-upgrade index c7e9691..0d9b196 100644 --- a/scripts/calcurse-upgrade +++ b/scripts/calcurse-upgrade @@ -63,5 +63,13 @@ if grep -q -e '^auto_save=' -e '^auto_gc=' -e '^periodic_save=' \ -e '/^daemon.log=/{N;s/\n//}' "$CONFFILE" > "$tmpfile" || exit 1 mv "$tmpfile" "$CONFFILE" || exit 1 fi + + awk ' + BEGIN { FS=OFS="=" } + $1 == "general.systemdialogs" || $1 == "general.progressbar" \ + { $2 = ($2 == "yes") ? "no" : "yes" } + { print } + ' < "$CONFFILE" > "$tmpfile" || exit 1 + mv "$tmpfile" "$CONFFILE" || exit 1 fi diff --git a/src/calcurse.c b/src/calcurse.c index c1949d4..ca239fb 100644 --- a/src/calcurse.c +++ b/src/calcurse.c @@ -164,7 +164,7 @@ main (int argc, char **argv) if (notify_bar ()) notify_start_main_thread (); wins_update (FLAG_ALL); - io_startup_screen (conf.skip_system_dialogs, no_data_file); + io_startup_screen (conf.system_dialogs, no_data_file); inday = *day_process_storage (0, 0, &inday); wins_slctd_set (CAL); wins_update (FLAG_ALL); diff --git a/src/calcurse.h b/src/calcurse.h index 1c7738a..d77c827 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -233,8 +233,8 @@ struct conf { unsigned periodic_save; unsigned confirm_quit; unsigned confirm_delete; - unsigned skip_system_dialogs; - unsigned skip_progress_bar; + unsigned system_dialogs; + unsigned progress_bar; char *editor; char *pager; char output_datefmt[BUFSIZ]; /* format for displaying date */ diff --git a/src/config.c b/src/config.c index 0e6acb1..51a0792 100644 --- a/src/config.c +++ b/src/config.c @@ -99,8 +99,8 @@ static const struct confvar confmap[] = { { "general.confirmquit", CONFIG_HANDLER_BOOL (conf.confirm_quit) }, { "general.firstdayofweek", config_parse_first_day_of_week, config_serialize_first_day_of_week, NULL }, { "general.periodicsave", CONFIG_HANDLER_UNSIGNED (conf.periodic_save) }, - { "general.progressbar", CONFIG_HANDLER_BOOL (conf.skip_progress_bar) }, - { "general.systemdialogs", CONFIG_HANDLER_BOOL (conf.skip_system_dialogs) }, + { "general.progressbar", CONFIG_HANDLER_BOOL (conf.progress_bar) }, + { "general.systemdialogs", CONFIG_HANDLER_BOOL (conf.system_dialogs) }, { "notification.command", CONFIG_HANDLER_STR (nbar.cmd) }, { "notification.notifyall", CONFIG_HANDLER_BOOL (nbar.notify_all) }, { "notification.warning", CONFIG_HANDLER_INT (nbar.cntdwn) } diff --git a/src/custom.c b/src/custom.c index 39be7f0..dd0bd62 100644 --- a/src/custom.c +++ b/src/custom.c @@ -644,8 +644,8 @@ print_general_options (WINDOW *win) _("periodic_save = "), _("confirm_quit = "), _("confirm_delete = "), - _("skip_system_dialogs = "), - _("skip_progress_bar = "), + _("system_dialogs = "), + _("progress_bar = "), _("week_begins_on_monday = "), _("output_datefmt = "), _("input_datefmt = ") @@ -687,17 +687,17 @@ print_general_options (WINDOW *win) "before deleting an event)")); y += YOFF; mvwprintw (win, y, XPOS, "[6] %s ", opt[SKIP_SYSTEM_DIAGS]); - print_bool_option_incolor (win, conf.skip_system_dialogs, y, + print_bool_option_incolor (win, conf.system_dialogs, y, XPOS + 4 + strlen (opt[SKIP_SYSTEM_DIAGS])); mvwprintw (win, y + 1, XPOS, _("(if set to YES, messages about loaded " - "and saved data will not be displayed)")); + "and saved data will be displayed)")); y += YOFF; mvwprintw (win, y, XPOS, "[7] %s ", opt[SKIP_PROGRESS_BAR]); - print_bool_option_incolor (win, conf.skip_progress_bar, y, + print_bool_option_incolor (win, conf.progress_bar, y, XPOS + 4 + strlen (opt[SKIP_PROGRESS_BAR])); mvwprintw (win, y + 1, XPOS, - _("(if set to YES, progress bar will not be displayed " + _("(if set to YES, progress bar will be displayed " "when saving data)")); y += YOFF; mvwprintw (win, y, XPOS, "[8] %s ", opt[WEEK_BEGINS_MONDAY]); @@ -809,10 +809,10 @@ custom_general_config (void) conf.confirm_delete = !conf.confirm_delete; break; case '6': - conf.skip_system_dialogs = !conf.skip_system_dialogs; + conf.system_dialogs = !conf.system_dialogs; break; case '7': - conf.skip_progress_bar = !conf.skip_progress_bar; + conf.progress_bar = !conf.progress_bar; break; case '8': calendar_change_first_day_of_week (); @@ -380,8 +380,8 @@ help_screen (void) _("Import data from an icalendar file.\n" "You will be asked to enter the file name from which to load ical\n" "items. At the end of the import process, and if the general option\n" - "'skip_system_dialogs' is not set to 'yes', a report indicating how\n" - "many items were imported is shown.\n" + "'system_dialogs' is set to 'yes', a report indicating how many items\n" + "were imported is shown.\n" "This report contains the total number of lines read, the number of\n" "appointments, events and todo items which were successfully imported,\n" "together with the number of items for which problems occured and that\n" @@ -440,7 +440,7 @@ io_save_cal (enum save_display display) show_bar = 0; if (ui_mode == UI_CURSES && display == IO_SAVE_DISPLAY_BAR - && !conf.skip_progress_bar) + && conf.progress_bar) show_bar = 1; else if (ui_mode == UI_CURSES && display == IO_SAVE_DISPLAY_MARK) display_mark (); @@ -466,7 +466,7 @@ io_save_cal (enum save_display display) ERROR_MSG ("%s", access_pb); /* Print a message telling data were saved */ - if (ui_mode == UI_CURSES && !conf.skip_system_dialogs + if (ui_mode == UI_CURSES && conf.system_dialogs && display != IO_SAVE_DISPLAY_MARK) { status_mesg (save_success, enter); @@ -988,7 +988,7 @@ io_check_data_files (void) /* Draw the startup screen */ void -io_startup_screen (unsigned skip_dialogs, int no_data_file) +io_startup_screen (unsigned show_dialogs, int no_data_file) { char *welcome_mesg = _("Welcome to Calcurse. Missing data files were created."); @@ -1000,7 +1000,7 @@ io_startup_screen (unsigned skip_dialogs, int no_data_file) status_mesg (welcome_mesg, enter); wgetch (win[STA].p); } - else if (!skip_dialogs) + else if (show_dialogs) { status_mesg (data_mesg, enter); wgetch (win[STA].p); @@ -1040,7 +1040,7 @@ io_export_data (enum export_type type) else if (type == IO_EXPORT_PCAL) pcal_export_data (stream); - if (!conf.skip_system_dialogs && ui_mode == UI_CURSES) + if (conf.system_dialogs && ui_mode == UI_CURSES) { status_mesg (success, enter); wgetch (win[STA].p); @@ -1171,7 +1171,7 @@ io_import_data (enum import_type type, char *stream_name) /* Update the number of todo items. */ todo_set_nb (todo_nb () + stats.todos); - if (ui_mode == UI_CURSES && !conf.skip_system_dialogs) + if (ui_mode == UI_CURSES && conf.system_dialogs) { char read[BUFSIZ], stat[BUFSIZ]; @@ -131,8 +131,8 @@ vars_init (void) conf.auto_save = 1; conf.auto_gc = 0; conf.periodic_save = 0; - conf.skip_system_dialogs = 0; - conf.skip_progress_bar = 0; + conf.system_dialogs = 1; + conf.progress_bar = 1; strncpy (conf.output_datefmt, "%D", 3); conf.input_datefmt = 1; |