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 <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Baptiste Jonglez
2012-05-13 14:09:21 +02:00
committed by Lukas Fleischer
parent 7d4ef08345
commit 13d6f8703b
6 changed files with 19 additions and 35 deletions

View File

@@ -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;