From fa746aa0766b957acbb36800d4a410c768392d4a Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 27 Mar 2021 07:15:27 +0200 Subject: Document: Fixed autoreload intervals; added strings --- src/ui/documentwidget.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/ui') diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index f6b68034..67cefc9b 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -85,24 +85,25 @@ enum iReloadInterval { }; static int seconds_ReloadInterval_(enum iReloadInterval d) { - static const int times[] = { 0, 1, 5, 15, 60, 4 * 60, 12 * 60, 24 * 60 }; + static const int mins[] = { 0, 1, 5, 15, 60, 4 * 60, 12 * 60, 24 * 60 }; if (d < 0 || d >= max_ReloadInterval) return 0; - return times[d]; + return mins[d] * 60; } static const char *label_ReloadInterval_(enum iReloadInterval d) { - static const char *labels[] = { - "Never", - "1 minute", - "5 minutes", - "15 minutes", - "1 hour", - "4 hours", - "12 hours", - "Once per day" - }; - if (d < 0 || d >= max_ReloadInterval) return 0; - return labels[d]; + switch (d) { + case never_RelodPeriod: + return cstr_Lang("reload.never"); + case day_ReloadInterval: + return cstr_Lang("reload.onceperday"); + case minute_ReloadInterval: + case fiveMinutes_ReloadInterval: + case fifteenMinutes_ReloadInterval: + return formatCStr_Lang("num.minutes.n", seconds_ReloadInterval_(d) / 60); + default: + return formatCStr_Lang("num.hours.n", seconds_ReloadInterval_(d) / 3600); + } + return ""; } struct Impl_PersistentDocumentState { -- cgit v1.2.3