diff options
Diffstat (limited to 'src/custom.c')
-rw-r--r-- | src/custom.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/src/custom.c b/src/custom.c index accd8d3..2cd385c 100644 --- a/src/custom.c +++ b/src/custom.c @@ -1,7 +1,7 @@ /* * Calcurse - text-based organizer * - * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org> + * Copyright (c) 2004-2023 calcurse Development Team <misc@calcurse.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,6 +38,7 @@ #include <stdlib.h> #include <math.h> #include <ctype.h> +#include <langinfo.h> #include "calcurse.h" @@ -545,6 +546,7 @@ enum { INPUT_DATE_FMT, HEADING_POS, DAY_HEADING_FMT, + APPOINTMENT_TIME_FMT, NB_OPTIONS }; @@ -573,7 +575,8 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d "format.outputdate = ", "format.inputdate = ", "appearance.headingposition = ", - "format.dayheading = " + "format.dayheading = ", + "format.appointmenttime = " }; const char *panel; const char *position; @@ -700,8 +703,7 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d case FIRST_DAY_OF_WEEK: custom_apply_attr(win, ATTR_HIGHEST); mvwaddstr(win, y, XPOS + strlen(opt[FIRST_DAY_OF_WEEK]), - ui_calendar_week_begins_on_monday()? _("Monday") : - _("Sunday")); + nl_langinfo(DAY_1 + ui_calendar_get_wday_start())); custom_remove_attr(win, ATTR_HIGHEST); mvwaddstr(win, y + 1, XPOS, _("(specifies the first day of week in the calendar view)")); @@ -746,6 +748,14 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d mvwaddstr(win, y + 1, XPOS, _("(Format of the date displayed in the appointments panel)")); break; + case APPOINTMENT_TIME_FMT: + custom_apply_attr(win, ATTR_HIGHEST); + mvwaddstr(win, y, XPOS + strlen(opt[APPOINTMENT_TIME_FMT]), + conf.timefmt); + custom_remove_attr(win, ATTR_HIGHEST); + mvwaddstr(win, y + 1, XPOS, + _("(Format of the time displayed in the appointments panel)")); + break; } if (hilt) @@ -771,6 +781,8 @@ static void general_option_edit(int i) _("Enter a text string (an empty string for the default text)"); const char *output_datefmt_str = _("Enter the date format (see 'man 3 strftime' for possible formats) "); + const char *output_timefmt_str = + _("Enter the time format (see 'man 3 strftime' for possible formats) "); const char *input_datefmt_prefix = _("Enter the date format: "); const char *periodic_save_str = _("Enter the delay, in minutes, between automatic saves (0 to disable) "); @@ -893,6 +905,15 @@ static void general_option_edit(int i) conf.day_heading[BUFSIZ - 1] = '\0'; } break; + case APPOINTMENT_TIME_FMT: + status_mesg(output_timefmt_str, ""); + strncpy(buf, conf.timefmt, BUFSIZ); + buf[BUFSIZ - 1] = '\0'; + if (updatestring(win[STA].p, &buf, 0, 1) == 0) { + strncpy(conf.timefmt, buf, BUFSIZ); + conf.timefmt[BUFSIZ - 1] = '\0'; + } + break; } mem_free(buf); @@ -1221,7 +1242,7 @@ void custom_config_main(void) old_layout = wins_layout(); custom_layout_config(); if (wins_layout() != old_layout) - wins_reset(); + wins_resize(); break; case 'G': case 'g': @@ -1247,7 +1268,11 @@ void custom_config_main(void) resize = 0; wins_reset(); } - + + /* needed to update app list */ + day_do_storage(0); + + /* wins_update(FLAG_ALL), but with custom bindings */ wins_set_bindings(bindings, ARRAY_SIZE(bindings)); wins_update_border(FLAG_ALL); wins_update_panels(FLAG_ALL); |