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;
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;
+ }
}
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);
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;
+ }
}
// 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);
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();
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;
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;
+ }
}
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);
}
}
-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;
} Global_taskbar;
void init_taskbar();
+
+// freed memory and set default values
void cleanup_taskbar();
Task *task_get_task (Window win);