cleanup default value on SIGUSR1
git-svn-id: http://tint2.googlecode.com/svn/trunk@421 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
34f3b37ddf
commit
3adb7e2080
9 changed files with 92 additions and 35 deletions
|
@ -37,15 +37,15 @@ PangoFontDescription *bat1_font_desc=0;
|
||||||
PangoFontDescription *bat2_font_desc=0;
|
PangoFontDescription *bat2_font_desc=0;
|
||||||
struct batstate battery_state;
|
struct batstate battery_state;
|
||||||
int battery_enabled;
|
int battery_enabled;
|
||||||
int percentage_hide = 101;
|
int percentage_hide;
|
||||||
static timeout* battery_timeout=0;
|
static timeout* battery_timeout=0;
|
||||||
|
|
||||||
static char buf_bat_percentage[10];
|
static char buf_bat_percentage[10];
|
||||||
static char buf_bat_time[20];
|
static char buf_bat_time[20];
|
||||||
|
|
||||||
int8_t battery_low_status;
|
int8_t battery_low_status;
|
||||||
|
unsigned char battery_low_cmd_send;
|
||||||
char *battery_low_cmd=0;
|
char *battery_low_cmd=0;
|
||||||
unsigned char battery_low_cmd_send=0;
|
|
||||||
char *path_energy_now=0;
|
char *path_energy_now=0;
|
||||||
char *path_energy_full=0;
|
char *path_energy_full=0;
|
||||||
char *path_current_now=0;
|
char *path_current_now=0;
|
||||||
|
@ -159,23 +159,37 @@ void init_battery()
|
||||||
void cleanup_battery()
|
void cleanup_battery()
|
||||||
{
|
{
|
||||||
battery_enabled = 0;
|
battery_enabled = 0;
|
||||||
if (bat1_font_desc)
|
percentage_hide = 101;
|
||||||
pango_font_description_free(bat1_font_desc);
|
battery_low_cmd_send = 0;
|
||||||
if (bat2_font_desc)
|
|
||||||
pango_font_description_free(bat2_font_desc);
|
|
||||||
if (path_energy_now)
|
|
||||||
g_free(path_energy_now);
|
|
||||||
if (path_energy_full)
|
|
||||||
g_free(path_energy_full);
|
|
||||||
if (path_current_now)
|
|
||||||
g_free(path_current_now);
|
|
||||||
if (path_status)
|
|
||||||
g_free(path_status);
|
|
||||||
if (battery_low_cmd)
|
|
||||||
g_free(battery_low_cmd);
|
|
||||||
|
|
||||||
battery_low_cmd = path_energy_now = path_energy_full = path_current_now = path_status = 0;
|
if (bat1_font_desc) {
|
||||||
bat1_font_desc = bat2_font_desc = 0;
|
pango_font_description_free(bat1_font_desc);
|
||||||
|
bat1_font_desc = 0;
|
||||||
|
}
|
||||||
|
if (bat2_font_desc) {
|
||||||
|
pango_font_description_free(bat2_font_desc);
|
||||||
|
bat2_font_desc = 0;
|
||||||
|
}
|
||||||
|
if (path_energy_now) {
|
||||||
|
g_free(path_energy_now);
|
||||||
|
path_energy_now = 0;
|
||||||
|
}
|
||||||
|
if (path_energy_full) {
|
||||||
|
g_free(path_energy_full);
|
||||||
|
path_energy_full = 0;
|
||||||
|
}
|
||||||
|
if (path_current_now) {
|
||||||
|
g_free(path_current_now);
|
||||||
|
path_current_now = 0;
|
||||||
|
}
|
||||||
|
if (path_status) {
|
||||||
|
g_free(path_status);
|
||||||
|
path_status = 0;
|
||||||
|
}
|
||||||
|
if (battery_low_cmd) {
|
||||||
|
g_free(battery_low_cmd);
|
||||||
|
battery_low_cmd = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,8 @@ void update_battery();
|
||||||
|
|
||||||
void init_battery();
|
void init_battery();
|
||||||
void init_battery_panel(void *panel);
|
void init_battery_panel(void *panel);
|
||||||
|
|
||||||
|
// freed memory and set default values
|
||||||
void cleanup_battery();
|
void cleanup_battery();
|
||||||
|
|
||||||
void draw_battery(void *obj, cairo_t *c);
|
void draw_battery(void *obj, cairo_t *c);
|
||||||
|
|
|
@ -163,22 +163,46 @@ void init_clock_panel(void *p)
|
||||||
void cleanup_clock()
|
void cleanup_clock()
|
||||||
{
|
{
|
||||||
clock_enabled = 0;
|
clock_enabled = 0;
|
||||||
if (time1_font_desc)
|
if (time1_font_desc) {
|
||||||
pango_font_description_free(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);
|
pango_font_description_free(time2_font_desc);
|
||||||
g_free(time1_format);
|
time2_font_desc = 0;
|
||||||
g_free(time2_format);
|
}
|
||||||
g_free(time_tooltip_format);
|
if (time1_format) {
|
||||||
g_free(time1_timezone);
|
g_free(time1_format);
|
||||||
g_free(time2_timezone);
|
time1_format = 0;
|
||||||
g_free(time_tooltip_timezone);
|
}
|
||||||
g_free(clock_lclick_command);
|
if (time2_format) {
|
||||||
g_free(clock_rclick_command);
|
g_free(time2_format);
|
||||||
time1_font_desc = time2_font_desc = 0;
|
time2_format = 0;
|
||||||
time1_format = time2_format = time_tooltip_format = 0;
|
}
|
||||||
time1_timezone = time2_timezone = time_tooltip_timezone = 0;
|
if (time_tooltip_format) {
|
||||||
clock_lclick_command = clock_rclick_command = 0;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@ extern int clock_enabled;
|
||||||
// initialize clock : y position, precision, ...
|
// initialize clock : y position, precision, ...
|
||||||
void init_clock();
|
void init_clock();
|
||||||
void init_clock_panel(void *panel);
|
void init_clock_panel(void *panel);
|
||||||
|
|
||||||
|
// freed memory and set default values
|
||||||
void cleanup_clock();
|
void cleanup_clock();
|
||||||
|
|
||||||
void draw_clock (void *obj, cairo_t *c);
|
void draw_clock (void *obj, cairo_t *c);
|
||||||
|
|
|
@ -73,6 +73,7 @@ void init_config()
|
||||||
Background transparent_bg;
|
Background transparent_bg;
|
||||||
memset(&transparent_bg, 0, sizeof(Background));
|
memset(&transparent_bg, 0, sizeof(Background));
|
||||||
g_array_append_val(backgrounds, transparent_bg);
|
g_array_append_val(backgrounds, transparent_bg);
|
||||||
|
printf("*** init_config()\n");
|
||||||
|
|
||||||
// tint2 could reload config, so we cleanup objects
|
// tint2 could reload config, so we cleanup objects
|
||||||
cleanup_systray();
|
cleanup_systray();
|
||||||
|
|
|
@ -48,7 +48,7 @@ Window net_sel_win = None;
|
||||||
Systraybar systray;
|
Systraybar systray;
|
||||||
int refresh_systray;
|
int refresh_systray;
|
||||||
int systray_enabled;
|
int systray_enabled;
|
||||||
int systray_max_icon_size = 0;
|
int systray_max_icon_size;
|
||||||
|
|
||||||
// background pixmap if we render ourselves the icons
|
// background pixmap if we render ourselves the icons
|
||||||
static Pixmap render_background = 0;
|
static Pixmap render_background = 0;
|
||||||
|
@ -95,9 +95,13 @@ void init_systray_panel(void *p)
|
||||||
void cleanup_systray()
|
void cleanup_systray()
|
||||||
{
|
{
|
||||||
systray_enabled = 0;
|
systray_enabled = 0;
|
||||||
|
systray_max_icon_size = 0;
|
||||||
systray.area.on_screen = 0;
|
systray.area.on_screen = 0;
|
||||||
free_area(&systray.area);
|
free_area(&systray.area);
|
||||||
if (render_background) XFreePixmap(server.dsp, render_background);
|
if (render_background) {
|
||||||
|
XFreePixmap(server.dsp, render_background);
|
||||||
|
render_background = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,8 +53,12 @@ extern int systray_enabled;
|
||||||
extern int systray_max_icon_size;
|
extern int systray_max_icon_size;
|
||||||
|
|
||||||
void init_systray();
|
void init_systray();
|
||||||
|
|
||||||
void init_systray_panel(void *p);
|
void init_systray_panel(void *p);
|
||||||
|
|
||||||
|
// freed memory and set default values
|
||||||
void cleanup_systray();
|
void cleanup_systray();
|
||||||
|
|
||||||
void draw_systray(void *obj, cairo_t *c);
|
void draw_systray(void *obj, cairo_t *c);
|
||||||
void resize_systray(void *obj);
|
void resize_systray(void *obj);
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,11 @@ void init_taskbar()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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()
|
void cleanup_taskbar()
|
||||||
{
|
{
|
||||||
Panel *panel;
|
Panel *panel;
|
||||||
|
|
|
@ -34,6 +34,8 @@ typedef struct {
|
||||||
} Global_taskbar;
|
} Global_taskbar;
|
||||||
|
|
||||||
void init_taskbar();
|
void init_taskbar();
|
||||||
|
|
||||||
|
// freed memory and set default values
|
||||||
void cleanup_taskbar();
|
void cleanup_taskbar();
|
||||||
|
|
||||||
Task *task_get_task (Window win);
|
Task *task_get_task (Window win);
|
||||||
|
|
Loading…
Reference in a new issue