lower battery drawing : update to 10s and battery_hide config
git-svn-id: http://tint2.googlecode.com/svn/trunk@364 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
a22041ce09
commit
a5a39b0bb2
3 changed files with 29 additions and 2 deletions
|
@ -37,6 +37,7 @@ 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;
|
||||||
static timeout* battery_timeout=0;
|
static timeout* battery_timeout=0;
|
||||||
|
|
||||||
static char buf_bat_percentage[10];
|
static char buf_bat_percentage[10];
|
||||||
|
@ -54,9 +55,27 @@ void update_batterys(void* arg)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
update_battery();
|
update_battery();
|
||||||
for (i=0 ; i < nb_panel ; i++)
|
for (i=0 ; i < nb_panel ; i++) {
|
||||||
|
if (battery_state.percentage >= percentage_hide) {
|
||||||
|
if (panel1[i].battery.area.on_screen == 1) {
|
||||||
|
panel1[i].battery.area.on_screen = 0;
|
||||||
|
// force resize on panel
|
||||||
|
panel1[i].area.resize = 1;
|
||||||
|
panel_refresh = 1;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (panel1[i].battery.area.on_screen == 0) {
|
||||||
|
panel1[i].battery.area.on_screen = 1;
|
||||||
|
// force resize on panel
|
||||||
|
panel1[i].area.resize = 1;
|
||||||
|
panel_refresh = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
panel1[i].battery.area.resize = 1;
|
panel1[i].battery.area.resize = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void init_battery()
|
void init_battery()
|
||||||
|
@ -133,7 +152,7 @@ void init_battery()
|
||||||
g_free(battery_dir);
|
g_free(battery_dir);
|
||||||
|
|
||||||
if (battery_enabled && battery_timeout==0)
|
if (battery_enabled && battery_timeout==0)
|
||||||
battery_timeout = add_timeout(10, 5000, update_batterys, 0);
|
battery_timeout = add_timeout(10, 10000, update_batterys, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ extern struct batstate battery_state;
|
||||||
extern PangoFontDescription *bat1_font_desc;
|
extern PangoFontDescription *bat1_font_desc;
|
||||||
extern PangoFontDescription *bat2_font_desc;
|
extern PangoFontDescription *bat2_font_desc;
|
||||||
extern int battery_enabled;
|
extern int battery_enabled;
|
||||||
|
extern int percentage_hide;
|
||||||
|
|
||||||
extern int8_t battery_low_status;
|
extern int8_t battery_low_status;
|
||||||
extern char *battery_low_cmd;
|
extern char *battery_low_cmd;
|
||||||
|
|
|
@ -358,6 +358,13 @@ void add_entry (char *key, char *value)
|
||||||
panel_config.battery.area.bg = &g_array_index(backgrounds, Background, id);
|
panel_config.battery.area.bg = &g_array_index(backgrounds, Background, id);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
else if (strcmp (key, "battery_hide") == 0) {
|
||||||
|
#ifdef ENABLE_BATTERY
|
||||||
|
percentage_hide = atoi (value);
|
||||||
|
if (percentage_hide == 0)
|
||||||
|
percentage_hide = 101;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* Clock */
|
/* Clock */
|
||||||
else if (strcmp (key, "time1_format") == 0) {
|
else if (strcmp (key, "time1_format") == 0) {
|
||||||
|
|
Loading…
Reference in a new issue