From c2d6faabc72cd03d3a2664c88c0d65a32d848e2e Mon Sep 17 00:00:00 2001 From: o9000 Date: Sat, 4 Mar 2017 12:20:23 +0100 Subject: [PATCH] Enable clock timer only when clock is used --- src/clock/clock.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/clock/clock.c b/src/clock/clock.c index 3621461..8e84654 100644 --- a/src/clock/clock.c +++ b/src/clock/clock.c @@ -163,6 +163,13 @@ gboolean time_format_needs_sec_ticks(char *time_format) void init_clock() { +} + +void init_clock_panel(void *p) +{ + Panel *panel = (Panel *)p; + Clock *clock = &panel->clock; + if (!clock_timeout) { if (time_format_needs_sec_ticks(time1_format) || time_format_needs_sec_ticks(time2_format)) { clock_timeout = add_timeout(10, 1000, update_clocks_sec, 0, &clock_timeout); @@ -170,12 +177,6 @@ void init_clock() clock_timeout = add_timeout(10, 1000, update_clocks_min, 0, &clock_timeout); } } -} - -void init_clock_panel(void *p) -{ - Panel *panel = (Panel *)p; - Clock *clock = &panel->clock; if (!clock->area.bg) clock->area.bg = &g_array_index(backgrounds, Background, 0);