summaryrefslogtreecommitdiff
path: root/src/custom.c
diff options
context:
space:
mode:
authorBaptiste Jonglez <baptiste--git@jonglez.org>2012-05-28 04:50:38 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-05-31 20:30:46 +0200
commit7eb3abb08a0b20bef49a9bf717ea30fad27c5606 (patch)
tree7ddeb59122d5441c6b84109512ecd45178812df9 /src/custom.c
parent72995601e791ba0c2e990a601752482f3e45aa74 (diff)
downloadcalcurse-7eb3abb08a0b20bef49a9bf717ea30fad27c5606.zip
src/custom.c: Use status_ask_simplechoice()
This eases up i18n somewhat, since the various date format available are used on other places as well, and thus need to be translated only once. Note that this commit incidentally fixes a small bug introduced by 38912b36: the user was able to set the date input format to a number between 1 and 5, while there are only 4 such formats available. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/custom.c')
-rw-r--r--src/custom.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/custom.c b/src/custom.c
index fd93a11..b8bd89b 100644
--- a/src/custom.c
+++ b/src/custom.c
@@ -714,12 +714,17 @@ void custom_general_config(void)
const char *keys = _("(Press '^P' or '^N' to move up or down, 'Q' to quit)");
const char *output_datefmt_str =
_("Enter the date format (see 'man 3 strftime' for possible formats) ");
- const char *input_datefmt_str =
- _("Enter the date format (1)mm/dd/yyyy (2)dd/mm/yyyy (3)yyyy/mm/dd "
- "(4)yyyy-mm-dd");
+ const char *input_datefmt_prefix = _("Enter the date format: ");
+ const char *input_datefmt_choices[] = {
+ _("mm/dd/yyyy"),
+ _("dd/mm/yyyy"),
+ _("yyyy/mm/dd"),
+ _("yyyy-mm-dd")
+ };
const char *periodic_save_str =
_("Enter the delay, in minutes, between automatic saves (0 to disable) ");
int ch;
+ int val;
char *buf;
clear();
@@ -751,7 +756,7 @@ void custom_general_config(void)
case '3':
status_mesg(periodic_save_str, "");
if (updatestring(win[STA].p, &buf, 0, 1) == 0) {
- int val = atoi(buf);
+ val = atoi(buf);
if (val >= 0)
conf.periodic_save = val;
if (conf.periodic_save > 0)
@@ -785,13 +790,11 @@ void custom_general_config(void)
status_mesg(number_str, keys);
break;
case '0':
- status_mesg(input_datefmt_str, "");
- if (updatestring(win[STA].p, &buf, 0, 1) == 0) {
- int val = atoi(buf);
- if (val > 0 && val <= DATE_FORMATS)
- conf.input_datefmt = val;
- }
- status_mesg(number_str, keys);
+ val = status_ask_simplechoice(input_datefmt_prefix,
+ input_datefmt_choices,
+ DATE_FORMATS - 1);
+ if (val != -1)
+ conf.input_datefmt = val;
break;
}