Run pre-load hook before testing for modifications
The pre-load hook is often used to manipulate the data files before loading, such as by synchronizing with a remote calendar. Make sure we always execute the pre-load hook upon reloads, even if the data files have not been modified. Fixes GitHub issue #98. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
parent
2d19605ba8
commit
912124bcdc
@ -619,7 +619,11 @@ int main(int argc, char **argv)
|
|||||||
config_load();
|
config_load();
|
||||||
wins_erase_status_bar();
|
wins_erase_status_bar();
|
||||||
io_load_keys(conf.pager);
|
io_load_keys(conf.pager);
|
||||||
|
|
||||||
|
run_hook("pre-load");
|
||||||
io_load_data(NULL);
|
io_load_data(NULL);
|
||||||
|
run_hook("post-load");
|
||||||
|
|
||||||
io_unset_modified();
|
io_unset_modified();
|
||||||
wins_slctd_set(conf.default_panel);
|
wins_slctd_set(conf.default_panel);
|
||||||
wins_resize();
|
wins_resize();
|
||||||
|
6
src/io.c
6
src/io.c
@ -893,12 +893,10 @@ void io_load_todo(struct item_filter *filter)
|
|||||||
/* Load appointments and todo items */
|
/* Load appointments and todo items */
|
||||||
void io_load_data(struct item_filter *filter)
|
void io_load_data(struct item_filter *filter)
|
||||||
{
|
{
|
||||||
run_hook("pre-load");
|
|
||||||
io_mutex_lock();
|
io_mutex_lock();
|
||||||
io_load_app(filter);
|
io_load_app(filter);
|
||||||
io_load_todo(filter);
|
io_load_todo(filter);
|
||||||
io_mutex_unlock();
|
io_mutex_unlock();
|
||||||
run_hook("post-load");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int io_reload_data(void)
|
int io_reload_data(void)
|
||||||
@ -934,6 +932,8 @@ int io_reload_data(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run_hook("pre-load");
|
||||||
|
|
||||||
if (!io_check_data_files_modified())
|
if (!io_check_data_files_modified())
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -962,6 +962,8 @@ int io_reload_data(void)
|
|||||||
ui_todo_sel_reset();
|
ui_todo_sel_reset();
|
||||||
|
|
||||||
io_load_data(NULL);
|
io_load_data(NULL);
|
||||||
|
run_hook("post-load");
|
||||||
|
|
||||||
io_unset_modified();
|
io_unset_modified();
|
||||||
ui_todo_load_items();
|
ui_todo_load_items();
|
||||||
ui_todo_sel_reset();
|
ui_todo_sel_reset();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user