From 2cd7d7e175f01b5f3c148265062d377a92a6f960 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sun, 18 Nov 2012 22:03:18 +0100 Subject: calcurse.c: Pull out key_generic_goto_today() Split out key_generic_goto_today() into a separate function. This simplifies the control flow and supersedes the "key" parameter in key_generic_goto(). Signed-off-by: Lukas Fleischer --- src/calcurse.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/calcurse.c b/src/calcurse.c index b3b9098..6a91e74 100644 --- a/src/calcurse.c +++ b/src/calcurse.c @@ -89,10 +89,16 @@ static inline void key_generic_goto(int key) { wins_erase_status_bar(); calendar_set_current_date(); - if (key == KEY_GENERIC_GOTO_TODAY) - calendar_goto_today(); - else - calendar_change_day(conf.input_datefmt); + calendar_change_day(conf.input_datefmt); + inday = do_storage(1); + wins_update(FLAG_CAL | FLAG_APP | FLAG_STA); +} + +static inline void key_generic_goto_today(int key) +{ + wins_erase_status_bar(); + calendar_set_current_date(); + calendar_goto_today(); inday = do_storage(1); wins_update(FLAG_CAL | FLAG_APP | FLAG_STA); } @@ -565,7 +571,7 @@ int main(int argc, char **argv) HANDLE_KEY(KEY_GENERIC_CHANGE_VIEW, key_generic_change_view); HANDLE_KEY(KEY_GENERIC_OTHER_CMD, key_generic_other_cmd); HANDLE_KEY(KEY_GENERIC_GOTO, key_generic_goto); - HANDLE_KEY(KEY_GENERIC_GOTO_TODAY, key_generic_goto); + HANDLE_KEY(KEY_GENERIC_GOTO_TODAY, key_generic_goto_today); HANDLE_KEY(KEY_VIEW_ITEM, key_view_item); HANDLE_KEY(KEY_GENERIC_CONFIG_MENU, key_generic_config_menu); HANDLE_KEY(KEY_GENERIC_ADD_APPT, key_generic_add_appt); -- cgit v1.2.3