diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-27 07:15:27 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-27 07:15:27 +0200 |
commit | fa746aa0766b957acbb36800d4a410c768392d4a (patch) | |
tree | 808e9954344996de8d57444a540d5fde2e8467d8 /src/ui | |
parent | bda857d74f6ef01d8b947544f6a8708b7aad88a7 (diff) |
Document: Fixed autoreload intervals; added strings
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 29 |
1 files changed, 15 insertions, 14 deletions
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 { | |||
85 | }; | 85 | }; |
86 | 86 | ||
87 | static int seconds_ReloadInterval_(enum iReloadInterval d) { | 87 | static int seconds_ReloadInterval_(enum iReloadInterval d) { |
88 | static const int times[] = { 0, 1, 5, 15, 60, 4 * 60, 12 * 60, 24 * 60 }; | 88 | static const int mins[] = { 0, 1, 5, 15, 60, 4 * 60, 12 * 60, 24 * 60 }; |
89 | if (d < 0 || d >= max_ReloadInterval) return 0; | 89 | if (d < 0 || d >= max_ReloadInterval) return 0; |
90 | return times[d]; | 90 | return mins[d] * 60; |
91 | } | 91 | } |
92 | 92 | ||
93 | static const char *label_ReloadInterval_(enum iReloadInterval d) { | 93 | static const char *label_ReloadInterval_(enum iReloadInterval d) { |
94 | static const char *labels[] = { | 94 | switch (d) { |
95 | "Never", | 95 | case never_RelodPeriod: |
96 | "1 minute", | 96 | return cstr_Lang("reload.never"); |
97 | "5 minutes", | 97 | case day_ReloadInterval: |
98 | "15 minutes", | 98 | return cstr_Lang("reload.onceperday"); |
99 | "1 hour", | 99 | case minute_ReloadInterval: |
100 | "4 hours", | 100 | case fiveMinutes_ReloadInterval: |
101 | "12 hours", | 101 | case fifteenMinutes_ReloadInterval: |
102 | "Once per day" | 102 | return formatCStr_Lang("num.minutes.n", seconds_ReloadInterval_(d) / 60); |
103 | }; | 103 | default: |
104 | if (d < 0 || d >= max_ReloadInterval) return 0; | 104 | return formatCStr_Lang("num.hours.n", seconds_ReloadInterval_(d) / 3600); |
105 | return labels[d]; | 105 | } |
106 | return ""; | ||
106 | } | 107 | } |
107 | 108 | ||
108 | struct Impl_PersistentDocumentState { | 109 | struct Impl_PersistentDocumentState { |