]> Dogcows Code - chaz/tint2/blobdiff - src/clock/clock.c
cleanup default value on SIGUSR1
[chaz/tint2] / src / clock / clock.c
index b6eb254537f01d31b2f7e2ddb0f7779938963345..d020c5269fb33109494cd6a412d311d3fe238720 100644 (file)
@@ -163,22 +163,46 @@ void init_clock_panel(void *p)
 void cleanup_clock()
 {
        clock_enabled = 0;
-       if (time1_font_desc)
+       if (time1_font_desc) {
                pango_font_description_free(time1_font_desc);
-       if (time2_font_desc)
+               time1_font_desc = 0;
+       }
+       if (time2_font_desc) {
                pango_font_description_free(time2_font_desc);
-       g_free(time1_format);
-       g_free(time2_format);
-       g_free(time_tooltip_format);
-       g_free(time1_timezone);
-       g_free(time2_timezone);
-       g_free(time_tooltip_timezone);
-       g_free(clock_lclick_command);
-       g_free(clock_rclick_command);
-       time1_font_desc = time2_font_desc = 0;
-       time1_format = time2_format = time_tooltip_format = 0;
-       time1_timezone = time2_timezone = time_tooltip_timezone = 0;
-       clock_lclick_command = clock_rclick_command = 0;
+               time2_font_desc = 0;
+       }
+       if (time1_format) {
+               g_free(time1_format);
+               time1_format = 0;
+       }
+       if (time2_format) {
+               g_free(time2_format);
+               time2_format = 0;
+       }
+       if (time_tooltip_format) {
+               g_free(time_tooltip_format);
+               time_tooltip_format = 0;
+       }
+       if (time1_timezone) {
+               g_free(time1_timezone);
+               time1_timezone = 0;
+       }
+       if (time2_timezone) {
+               g_free(time2_timezone);
+               time2_timezone = 0;
+       }
+       if (time_tooltip_timezone) {
+               g_free(time_tooltip_timezone);
+               time_tooltip_timezone = 0;
+       }
+       if (clock_lclick_command) {
+               g_free(clock_lclick_command);
+               clock_lclick_command = 0;
+       }
+       if (clock_rclick_command) {
+               g_free(clock_rclick_command);
+               clock_rclick_command = 0;
+       }
 }
 
 
@@ -258,8 +282,6 @@ void resize_clock (void *obj)
        new_width += (2*clock->area.paddingxlr) + (2*clock->area.bg->border.width);
 
        Panel *panel = ((Area*)obj)->panel;
-       clock->area.posx = panel->area.width - clock->area.width - panel->area.paddingxlr - panel->area.bg->border.width;
-
        if (new_width > clock->area.width || new_width < (clock->area.width-6)) {
                // resize clock
                // we try to limit the number of resize
@@ -274,6 +296,8 @@ void resize_clock (void *obj)
                systray.area.resize = 1;
                panel_refresh = 1;
        }
+       clock->area.posx = panel->area.width - clock->area.width - panel->area.paddingxlr - panel->area.bg->border.width;
+
 
        g_object_unref (layout);
        cairo_destroy (c);
This page took 0.022702 seconds and 4 git commands to generate.