From f9574f2314e6fcac61726c3451b415f8f68b2edd Mon Sep 17 00:00:00 2001 From: Quentin Glidic Date: Thu, 23 Jun 2016 18:55:21 +0200 Subject: [PATCH] desktop-shell/client: Use a proper enum for clock format Signed-off-by: Quentin Glidic Reviewed-by: Daniel Stone --- clients/desktop-shell.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index 6eaa0abd..4c3b790e 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include "window.h" @@ -55,6 +56,12 @@ extern char **environ; /* defined by libc */ +enum clock_format { + CLOCK_FORMAT_MINUTES, + CLOCK_FORMAT_SECONDS, + CLOCK_FORMAT_NONE +}; + struct desktop { struct display *display; struct weston_desktop_shell *shell; @@ -90,7 +97,7 @@ struct panel { struct wl_list launcher_list; struct panel_clock *clock; int painted; - int clock_format; + enum clock_format clock_format; uint32_t color; }; @@ -417,12 +424,6 @@ panel_destroy_clock(struct panel_clock *clock) free(clock); } -enum { - CLOCK_FORMAT_MINUTES, - CLOCK_FORMAT_SECONDS, - CLOCK_FORMAT_NONE -}; - static void panel_add_clock(struct panel *panel) { @@ -449,6 +450,8 @@ panel_add_clock(struct panel *panel) clock->format_string = "%a %b %d, %I:%M:%S %p"; clock->refresh_timer = 1; break; + case CLOCK_FORMAT_NONE: + assert(!"not reached"); } clock->clock_task.run = clock_func;