fixed config reload SIGUSR1. added systray = 1 parameter to enable systray

git-svn-id: http://tint2.googlecode.com/svn/trunk@242 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
lorthiois@bbsoft.fr
2009-10-30 17:18:44 +00:00
parent 51b9ce356a
commit c763cf7172
12 changed files with 161 additions and 107 deletions

View File

@@ -32,16 +32,17 @@
#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;

View File

@@ -32,12 +32,14 @@ extern PangoFontDescription *time1_font_desc;
extern PangoFontDescription *time2_font_desc;
extern char *clock_lclick_command;
extern char *clock_rclick_command;
extern int clock_enabled;
// initialize clock : y position, precision, ...
void init_clock();
void init_clock_panel(void *panel);
void init_precision();
void cleanup_clock();
void draw_clock (void *obj, cairo_t *c, int active);