A save refinement: no action if everything is unchanged
A reload action will do nothing if in-memory data as well as data files are unchanged. This commit accomplishes the equivalent for a save action. Because saving of configuration data and key bindings are mixed up with saving of data files, any changes in those will only be saved if data files also have changed. Hence, configuration data and key bindings are also saved upon exit from the configuration menu. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
parent
5ad0019b23
commit
d7777ed44e
@ -1154,4 +1154,8 @@ void custom_config_main(void)
|
||||
wmove(win[STA].p, 0, 0);
|
||||
wins_doupdate();
|
||||
}
|
||||
if (!config_save())
|
||||
EXIT(_("Could not save %s."), path_conf);
|
||||
if (!io_save_keys())
|
||||
EXIT(_("Could not save %s."), path_keys);
|
||||
}
|
||||
|
6
src/io.c
6
src/io.c
@ -586,8 +586,12 @@ int io_save_cal(enum save_display display)
|
||||
if (read_only)
|
||||
return IO_SAVE_CANCEL;
|
||||
|
||||
if (new_data() && (ret = resolve_save_conflict()))
|
||||
if (new_data()) {
|
||||
if ((ret = resolve_save_conflict()))
|
||||
return ret;
|
||||
} else
|
||||
if (!io_get_modified())
|
||||
return IO_SAVE_CANCEL;
|
||||
|
||||
run_hook("pre-save");
|
||||
io_mutex_lock();
|
||||
|
Loading…
x
Reference in New Issue
Block a user