all repos — tint2 @ 3adb7e2080b79f2ad4e8ec3bc1f82710ef5fbd7e

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

cleanup default value on SIGUSR1

git-svn-id: http://tint2.googlecode.com/svn/trunk@421 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
thilor77 thilor77@121b4492-b84c-0410-8b4c-0d4edfb3f3cc
commit

3adb7e2080b79f2ad4e8ec3bc1f82710ef5fbd7e

parent

34f3b37ddf5cdff97e28ed044647f37943caf0e7

M src/battery/battery.csrc/battery/battery.c

@@ -37,15 +37,15 @@ PangoFontDescription *bat1_font_desc=0;

PangoFontDescription *bat2_font_desc=0; struct batstate battery_state; int battery_enabled; -int percentage_hide = 101; +int percentage_hide; static timeout* battery_timeout=0; static char buf_bat_percentage[10]; static char buf_bat_time[20]; int8_t battery_low_status; +unsigned char battery_low_cmd_send; char *battery_low_cmd=0; -unsigned char battery_low_cmd_send=0; char *path_energy_now=0; char *path_energy_full=0; char *path_current_now=0;

@@ -159,23 +159,37 @@

void cleanup_battery() { battery_enabled = 0; - if (bat1_font_desc) + percentage_hide = 101; + battery_low_cmd_send = 0; + + if (bat1_font_desc) { pango_font_description_free(bat1_font_desc); - if (bat2_font_desc) + bat1_font_desc = 0; + } + if (bat2_font_desc) { pango_font_description_free(bat2_font_desc); - if (path_energy_now) + bat2_font_desc = 0; + } + if (path_energy_now) { g_free(path_energy_now); - if (path_energy_full) + path_energy_now = 0; + } + if (path_energy_full) { g_free(path_energy_full); - if (path_current_now) + path_energy_full = 0; + } + if (path_current_now) { g_free(path_current_now); - if (path_status) + path_current_now = 0; + } + if (path_status) { g_free(path_status); - if (battery_low_cmd) + path_status = 0; + } + if (battery_low_cmd) { g_free(battery_low_cmd); - - battery_low_cmd = path_energy_now = path_energy_full = path_current_now = path_status = 0; - bat1_font_desc = bat2_font_desc = 0; + battery_low_cmd = 0; + } }
M src/battery/battery.hsrc/battery/battery.h

@@ -63,6 +63,8 @@ void update_battery();

void init_battery(); void init_battery_panel(void *panel); + +// freed memory and set default values void cleanup_battery(); void draw_battery(void *obj, cairo_t *c);
M src/clock/clock.csrc/clock/clock.c

@@ -163,22 +163,46 @@

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; + } }
M src/clock/clock.hsrc/clock/clock.h

@@ -40,6 +40,8 @@

// initialize clock : y position, precision, ... void init_clock(); void init_clock_panel(void *panel); + +// freed memory and set default values void cleanup_clock(); void draw_clock (void *obj, cairo_t *c);
M src/config.csrc/config.c

@@ -73,6 +73,7 @@ // append full transparency background

Background transparent_bg; memset(&transparent_bg, 0, sizeof(Background)); g_array_append_val(backgrounds, transparent_bg); +printf("*** init_config()\n"); // tint2 could reload config, so we cleanup objects cleanup_systray();
M src/systray/systraybar.csrc/systray/systraybar.c

@@ -48,7 +48,7 @@ // freedesktop specification doesn't allow multi systray

Systraybar systray; int refresh_systray; int systray_enabled; -int systray_max_icon_size = 0; +int systray_max_icon_size; // background pixmap if we render ourselves the icons static Pixmap render_background = 0;

@@ -95,9 +95,13 @@

void cleanup_systray() { systray_enabled = 0; + systray_max_icon_size = 0; systray.area.on_screen = 0; free_area(&systray.area); - if (render_background) XFreePixmap(server.dsp, render_background); + if (render_background) { + XFreePixmap(server.dsp, render_background); + render_background = 0; + } }
M src/systray/systraybar.hsrc/systray/systraybar.h

@@ -53,8 +53,12 @@ extern int systray_enabled;

extern int systray_max_icon_size; void init_systray(); + void init_systray_panel(void *p); + +// freed memory and set default values void cleanup_systray(); + void draw_systray(void *obj, cairo_t *c); void resize_systray(void *obj);
M src/taskbar/taskbar.csrc/taskbar/taskbar.c

@@ -166,7 +166,11 @@ }

} } -void taskbar_remove_task(gpointer key, gpointer value, gpointer user_data) {remove_task(task_get_task(*(Window*)key)); } +void taskbar_remove_task(gpointer key, gpointer value, gpointer user_data) +{ + remove_task(task_get_task(*(Window*)key)); +} + void cleanup_taskbar() { Panel *panel;
M src/taskbar/taskbar.hsrc/taskbar/taskbar.h

@@ -34,6 +34,8 @@ int use_active;

} Global_taskbar; void init_taskbar(); + +// freed memory and set default values void cleanup_taskbar(); Task *task_get_task (Window win);