From 7733d52f3249fee2a1d875d6923b8d2506dea5e4 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sun, 18 Nov 2012 22:44:40 +0100 Subject: Use status_ask_choice() for the export dialog Remove the export bar and use a simple status_ask_choice() dialog instead. This reduces code complexity and replaces another unnecessary menu by the well-tested dialog feature that is used everywhere else. Signed-off-by: Lukas Fleischer --- src/calcurse.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'src/calcurse.c') diff --git a/src/calcurse.c b/src/calcurse.c index 00b7708..000436c 100644 --- a/src/calcurse.c +++ b/src/calcurse.c @@ -289,24 +289,23 @@ static inline void key_generic_import(void) static inline void key_generic_export() { - int key; + const char *export_msg = _("Export to (i)cal or (p)cal format?"); + const char *export_choices = _("[ip]"); + const int nb_export_choices = 2; wins_erase_status_bar(); - io_export_bar(); - while ((key = wgetch(win[STA].p)) != 'q') { - switch (key) { - case 'I': - case 'i': - io_export_data(IO_EXPORT_ICAL); - case 'p': - io_export_data(IO_EXPORT_PCAL); - break; - } - wins_reset(); - wins_update(FLAG_ALL); - wins_erase_status_bar(); - io_export_bar(); + + switch (status_ask_choice(export_msg, export_choices, nb_export_choices)) { + case 1: + io_export_data(IO_EXPORT_ICAL); + break; + case 2: + io_export_data(IO_EXPORT_PCAL); + break; + default: /* User escaped */ + break; } + inday = do_storage(0); wins_update(FLAG_ALL); } -- cgit v1.2.3-54-g00ecf