From 53b55930e8021f28a5393896b29b6a01d81cadd3 Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Sat, 15 Sep 2018 17:56:03 +0200 Subject: Configuration variable for system events After user acknowledgement a system event is deleted from the event queue. The configuration variable determines whether it is turned into an appointment (for later inspection) or not. Signed-off-by: Lukas Fleischer --- src/calcurse.c | 6 ++++-- src/calcurse.h | 1 + src/config.c | 1 + src/custom.c | 11 +++++++++++ src/vars.c | 1 + 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/calcurse.c b/src/calcurse.c index 1b46577..7bdcf1e 100644 --- a/src/calcurse.c +++ b/src/calcurse.c @@ -707,8 +707,10 @@ int main(int argc, char **argv) while (que_ued()) { que_show(); - que_save(); - do_storage(0); + if (conf.systemevents) { + que_save(); + do_storage(0); + } wins_update(FLAG_ALL); que_rem(); } diff --git a/src/calcurse.h b/src/calcurse.h index be2199a..a54f2bc 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -263,6 +263,7 @@ struct conf { unsigned auto_save; unsigned auto_gc; unsigned periodic_save; + unsigned systemevents; unsigned confirm_quit; unsigned confirm_delete; enum win default_panel; diff --git a/src/config.c b/src/config.c index 9e13eaf..61527be 100644 --- a/src/config.c +++ b/src/config.c @@ -112,6 +112,7 @@ 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.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}, diff --git a/src/custom.c b/src/custom.c index cf1cce5..df5c174 100644 --- a/src/custom.c +++ b/src/custom.c @@ -529,6 +529,7 @@ enum { AUTO_SAVE, AUTO_GC, PERIODIC_SAVE, + SYSTEM_EVENTS, CONFIRM_QUIT, CONFIRM_DELETE, SYSTEM_DIAGS, @@ -550,6 +551,7 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d "general.autosave = ", "general.autogc = ", "general.periodicsave = ", + "general.systemevents = ", "general.confirmquit = ", "general.confirmdelete = ", "general.systemdialogs = ", @@ -607,6 +609,12 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d _("(if not null, automatically save data every 'periodic_save' " "minutes)")); break; + case SYSTEM_EVENTS: + print_bool_option_incolor(win, conf.systemevents, y, + XPOS + strlen(opt[SYSTEM_EVENTS])); + mvwaddstr(win, y + 1, XPOS, + _("(if YES, system events are turned into appointments (or else deleted))")); + break; case CONFIRM_QUIT: print_bool_option_incolor(win, conf.confirm_quit, y, XPOS + strlen(opt[CONFIRM_QUIT])); @@ -743,6 +751,9 @@ static void general_option_edit(int i) } } break; + case SYSTEM_EVENTS: + conf.systemevents = !conf.systemevents; + break; case CONFIRM_QUIT: conf.confirm_quit = !conf.confirm_quit; break; diff --git a/src/vars.c b/src/vars.c index 3a8019a..30393fd 100644 --- a/src/vars.c +++ b/src/vars.c @@ -124,6 +124,7 @@ void vars_init(void) conf.auto_save = 1; conf.auto_gc = 0; conf.periodic_save = 0; + conf.systemevents = 1; conf.default_panel = CAL; conf.compact_panels = 0; conf.system_dialogs = 1; -- cgit v1.2.3-54-g00ecf