clients/desktop-shell: Add 24H support to the clock format.

dev
Nicholas Niro 4 years ago committed by Daniel Stone
parent d6dcd9bcd9
commit a11bc63ddd
  1. 18
      clients/desktop-shell.c
  2. 4
      man/weston.ini.man

@ -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

@ -379,7 +379,9 @@ digit pairs are in order alpha, red, green, and blue.
sets the panel clock format (string). Can be
.BR "none" ","
.BR "minutes" ","
.BR "seconds" "."
.BR "seconds" ","
.BR "minutes-24h" ","
.BR "seconds-24h" "."
By default, minutes format is used.
.TP 7
.BI "panel-color=" 0xAARRGGBB

Loading…
Cancel
Save