From 13d6f8703bacfb8543c9d22c01db60e083650cad Mon Sep 17 00:00:00 2001 From: Baptiste Jonglez Date: Sun, 13 May 2012 14:09:21 +0200 Subject: Factorize boolean user prompting. Introduce a new `status_ask_bool()` function, and use it where applicable. This greatly reduces code duplication, and will allow handling special events (resize, user escape) much more uniformely. Signed-off-by: Baptiste Jonglez Signed-off-by: Lukas Fleischer --- src/todo.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src/todo.c') diff --git a/src/todo.c b/src/todo.c index 87d6faf..24bcec6 100644 --- a/src/todo.c +++ b/src/todo.c @@ -250,17 +250,8 @@ todo_delete (void) const int nb_erase_choice = 2; int answer; - if (conf.confirm_delete) - { - status_mesg_yesno (del_todo_str); - answer = wgetch (win[STA].p); - if ((answer != 'y') || (todos <= 0)) - { - wins_erase_status_bar (); - return; - } - } - else if (todos <= 0) + if ((todos <= 0) || + (conf.confirm_delete && (status_ask_bool (del_todo_str) != 1))) { wins_erase_status_bar (); return; -- cgit v1.2.3-54-g00ecf