From 39ab4665e6bb13372da24b86f32cc50fff8c0e9f Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Tue, 28 Aug 2018 21:11:06 +0200 Subject: Data save and removal of the progress bar The function io_save_cal() saves apts, todos, configuration data and key bindings. The configuration and key files do not belong with the two data files, but the progress bar function assumes that all four files are saved in a fixed sequence. Since it is used nowhere else and contains unused parts, the function has been removed. A return code for file access error is introduced, and the EXIT macro moved to the command level in calcurse.c. Save of configuration and key data were already moved to the configuration menu in commit 0124618, A save refinement: no action if everything is unchanged. Signed-off-by: Lars Henriksen Signed-off-by: Lukas Fleischer --- src/calcurse.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/calcurse.c') diff --git a/src/calcurse.c b/src/calcurse.c index 4560e5c..57dce89 100644 --- a/src/calcurse.c +++ b/src/calcurse.c @@ -274,7 +274,7 @@ static inline void key_generic_save(void) char *msg = NULL; int ret; - ret = io_save_cal(IO_SAVE_DISPLAY_BAR); + ret = io_save_cal(); if (ret == IO_SAVE_RELOAD) { ui_todo_load_items(); @@ -297,6 +297,8 @@ static inline void key_generic_save(void) case IO_SAVE_NOOP: msg = _("Data were already saved"); break; + case IO_SAVE_ERROR: + EXIT(_("Cannot open data file")); } status_mesg(msg, ""); } @@ -503,7 +505,7 @@ static inline void key_generic_scroll_down(void) static inline void key_generic_quit(void) { if (conf.auto_save) - io_save_cal(IO_SAVE_DISPLAY_BAR); + io_save_cal(); if (conf.auto_gc) note_gc(); @@ -538,7 +540,7 @@ static inline void key_generic_cmd(void) if (!strcmp(cmd_name, "write") || !strcmp(cmd_name, "w") || !strcmp(cmd_name, "wq")) { - io_save_cal(IO_SAVE_DISPLAY_BAR); + io_save_cal(); valid = 1; } if (!strcmp(cmd_name, "quit") || !strcmp(cmd_name, "q") || -- cgit v1.2.3-54-g00ecf