desktop-shell/client: Use a proper enum for clock format

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
dev
Quentin Glidic 9 years ago committed by Daniel Stone
parent e8bf959764
commit f9574f2314
  1. 17
      clients/desktop-shell.c

@ -40,6 +40,7 @@
#include <libgen.h> #include <libgen.h>
#include <ctype.h> #include <ctype.h>
#include <time.h> #include <time.h>
#include <assert.h>
#include <wayland-client.h> #include <wayland-client.h>
#include "window.h" #include "window.h"
@ -55,6 +56,12 @@
extern char **environ; /* defined by libc */ extern char **environ; /* defined by libc */
enum clock_format {
CLOCK_FORMAT_MINUTES,
CLOCK_FORMAT_SECONDS,
CLOCK_FORMAT_NONE
};
struct desktop { struct desktop {
struct display *display; struct display *display;
struct weston_desktop_shell *shell; struct weston_desktop_shell *shell;
@ -90,7 +97,7 @@ struct panel {
struct wl_list launcher_list; struct wl_list launcher_list;
struct panel_clock *clock; struct panel_clock *clock;
int painted; int painted;
int clock_format; enum clock_format clock_format;
uint32_t color; uint32_t color;
}; };
@ -417,12 +424,6 @@ panel_destroy_clock(struct panel_clock *clock)
free(clock); free(clock);
} }
enum {
CLOCK_FORMAT_MINUTES,
CLOCK_FORMAT_SECONDS,
CLOCK_FORMAT_NONE
};
static void static void
panel_add_clock(struct panel *panel) 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->format_string = "%a %b %d, %I:%M:%S %p";
clock->refresh_timer = 1; clock->refresh_timer = 1;
break; break;
case CLOCK_FORMAT_NONE:
assert(!"not reached");
} }
clock->clock_task.run = clock_func; clock->clock_task.run = clock_func;

Loading…
Cancel
Save