diff options
author | Nicholas Niro <blowfist@xroutine.net> | 2020-10-30 15:09:23 -0400 |
---|---|---|
committer | Daniel Stone <daniels@collabora.com> | 2021-07-31 15:53:56 +0000 |
commit | a11bc63ddd6dd84ef2c084686be082f8f1e9173f (patch) | |
tree | a81160530a0ad636caf2e6642da0abadfac96067 /clients | |
parent | d6dcd9bcd9e858e08b7c2ea12d246ca221484abe (diff) | |
download | weston-a11bc63ddd6dd84ef2c084686be082f8f1e9173f.tar.gz |
clients/desktop-shell: Add 24H support to the clock format.
Diffstat (limited to 'clients')
-rw-r--r-- | clients/desktop-shell.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index 55cbd001..fb53069e 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -60,6 +60,8 @@ extern char **environ; /* defined by libc */ enum clock_format { CLOCK_FORMAT_MINUTES, CLOCK_FORMAT_SECONDS, + CLOCK_FORMAT_MINUTES_24H, + CLOCK_FORMAT_SECONDS_24H, CLOCK_FORMAT_NONE }; @@ -464,6 +466,14 @@ panel_add_clock(struct panel *panel) clock->format_string = "%a %b %d, %I:%M:%S %p"; clock->refresh_timer = 1; break; + case CLOCK_FORMAT_MINUTES_24H: + clock->format_string = "%a %b %d, %H:%M"; + clock->refresh_timer = 60; + break; + case CLOCK_FORMAT_SECONDS_24H: + clock->format_string = "%a %b %d, %H:%M:%S"; + clock->refresh_timer = 1; + break; case CLOCK_FORMAT_NONE: assert(!"not reached"); } @@ -502,7 +512,7 @@ panel_resize_handler(struct widget *widget, if (panel->clock_format == CLOCK_FORMAT_SECONDS) w = 170; - else /* CLOCK_FORMAT_MINUTES */ + else /* CLOCK_FORMAT_MINUTES and 24H versions */ w = 150; if (horizontal) @@ -549,6 +559,8 @@ panel_configure(void *data, width = 32; break; case CLOCK_FORMAT_MINUTES: + case CLOCK_FORMAT_MINUTES_24H: + case CLOCK_FORMAT_SECONDS_24H: width = 150; break; case CLOCK_FORMAT_SECONDS: @@ -1505,6 +1517,10 @@ parse_clock_format(struct desktop *desktop, struct weston_config_section *s) desktop->clock_format = CLOCK_FORMAT_MINUTES; else if (strcmp(clock_format, "seconds") == 0) desktop->clock_format = CLOCK_FORMAT_SECONDS; + else if (strcmp(clock_format, "minutes-24h") == 0) + desktop->clock_format = CLOCK_FORMAT_MINUTES_24H; + else if (strcmp(clock_format, "seconds-24h") == 0) + desktop->clock_format = CLOCK_FORMAT_SECONDS_24H; else if (strcmp(clock_format, "none") == 0) desktop->clock_format = CLOCK_FORMAT_NONE; else |