X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fclock%2Fclock.c;h=c1504bea8202272c553d243918ca2a374230b6f7;hb=f704f3350599d7f71afd0fb827c0948dec67ede3;hp=cff5e619bcffe110478b856c533acceaab140abc;hpb=3083e8006371cfb4a454b8bce92a682e4bb87e50;p=chaz%2Ftint2 diff --git a/src/clock/clock.c b/src/clock/clock.c index cff5e61..c1504be 100644 --- a/src/clock/clock.c +++ b/src/clock/clock.c @@ -32,16 +32,17 @@ #include "clock.h" -char *time1_format; -char *time2_format; -char *clock_lclick_command; -char *clock_rclick_command; +char *time1_format=0; +char *time2_format=0; +char *clock_lclick_command=0; +char *clock_rclick_command=0; struct timeval time_clock; int time_precision; -PangoFontDescription *time1_font_desc; -PangoFontDescription *time2_font_desc; +PangoFontDescription *time1_font_desc=0; +PangoFontDescription *time2_font_desc=0; static char buf_time[40]; static char buf_date[40]; +int clock_enabled; void init_precision() @@ -70,7 +71,7 @@ void init_clock_panel(void *p) { Panel *panel =(Panel*)p; Clock *clock = &panel->clock; - int i, time_height, time_height_ink, date_height, date_height_ink; + int time_height, time_height_ink, date_height, date_height_ink; clock->area.parent = p; clock->area.panel = p; @@ -78,6 +79,7 @@ void init_clock_panel(void *p) clock->area._resize = resize_clock; clock->area.resize = 1; clock->area.redraw = 1; + clock->area.on_screen = 1; strftime(buf_time, sizeof(buf_time), time1_format, localtime(&time_clock.tv_sec)); get_text_size(time1_font_desc, &time_height_ink, &time_height, panel->area.height, buf_time, strlen(buf_time)); @@ -110,6 +112,27 @@ void init_clock_panel(void *p) } +void cleanup_clock() +{ + clock_enabled = 0; + if (time1_font_desc) + pango_font_description_free(time1_font_desc); + if (time2_font_desc) + pango_font_description_free(time2_font_desc); + if (time1_format) + g_free(time1_format); + if (time2_format) + g_free(time2_format); + if (clock_lclick_command) + g_free(clock_lclick_command); + if (clock_rclick_command) + g_free(clock_rclick_command); + time1_font_desc = time2_font_desc = 0; + time1_format = time2_format = 0; + clock_lclick_command = clock_rclick_command = 0; +} + + void draw_clock (void *obj, cairo_t *c, int active) { Clock *clock = obj;