aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-11-18 22:44:40 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2012-11-18 22:57:09 +0100
commit7733d52f3249fee2a1d875d6923b8d2506dea5e4 (patch)
tree27678c694754418a7a207c108b0f13dd508425b1
parentad78a69192b5d87f7489f5bcf45fec8c196b6288 (diff)
downloadcalcurse-7733d52f3249fee2a1d875d6923b8d2506dea5e4.tar.gz
calcurse-7733d52f3249fee2a1d875d6923b8d2506dea5e4.zip
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 <calcurse@cryptocrack.de>
-rw-r--r--src/calcurse.c29
-rw-r--r--src/calcurse.h1
-rw-r--r--src/io.c23
3 files changed, 14 insertions, 39 deletions
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);
}
diff --git a/src/calcurse.h b/src/calcurse.h
index 8b99c04..191dbfd 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -743,7 +743,6 @@ void io_check_file(char *, int *);
int io_check_data_files(void);
void io_startup_screen(int);
void io_export_data(enum export_type);
-void io_export_bar(void);
void io_import_data(enum import_type, const char *);
struct io_file *io_log_init(void);
void io_log_print(struct io_file *, int, const char *);
diff --git a/src/io.c b/src/io.c
index 1263a6a..52d97c9 100644
--- a/src/io.c
+++ b/src/io.c
@@ -937,29 +937,6 @@ void io_export_data(enum export_type type)
}
}
-/* Draws the export format selection bar */
-void io_export_bar(void)
-{
- int smlspc, spc;
-
- smlspc = 2;
- spc = 15;
-
- custom_apply_attr(win[STA].p, ATTR_HIGHEST);
- mvwaddstr(win[STA].p, 0, 2, "Q");
- mvwaddstr(win[STA].p, 1, 2, "I");
- mvwaddstr(win[STA].p, 0, 2 + spc, "P");
- custom_remove_attr(win[STA].p, ATTR_HIGHEST);
-
- mvwaddstr(win[STA].p, 0, 2 + smlspc, _("Exit"));
- mvwaddstr(win[STA].p, 1, 2 + smlspc, _("Ical"));
- mvwaddstr(win[STA].p, 0, 2 + spc + smlspc, _("Pcal"));
-
- wnoutrefresh(win[STA].p);
- wmove(win[STA].p, 0, 0);
- wins_doupdate();
-}
-
static FILE *get_import_stream(enum export_type type)
{
FILE *stream;