]> Dogcows Code - chaz/tint2/blobdiff - src/clock/clock.c
fixed config reload SIGUSR1. added systray = 1 parameter to enable systray
[chaz/tint2] / src / clock / clock.c
index 2745a80bd920afe183c8bbcd036d92378fc37dfe..c1504bea8202272c553d243918ca2a374230b6f7 100644 (file)
 #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()
@@ -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;
This page took 0.027002 seconds and 4 git commands to generate.