1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-30 14:09:13 +00:00

convert smapi_bat_bar to callbacks.barval

This commit is contained in:
Phil Sutter 2009-11-23 23:48:12 +01:00
parent fcd3d58960
commit 997805c46b
3 changed files with 5 additions and 10 deletions

View File

@ -1082,7 +1082,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
obj->data.i = -1;
} else
arg = scan_bar(obj, arg + cnt);
obj->callbacks.print = &print_smapi_bat_bar;
obj->callbacks.barval = &smapi_bat_barval;
#endif /* IBM */
#ifdef MPD
#define mpd_set_maxlen(name) \

View File

@ -172,14 +172,9 @@ void print_smapi_bat_power(struct text_object *obj, char *p, int p_max_size)
NORM_ERR("argument to smapi_bat_power must be an integer");
}
void print_smapi_bat_bar(struct text_object *obj, char *p, int p_max_size)
uint8_t smapi_bat_barval(struct text_object *obj)
{
if (!p_max_size)
return;
if (obj->data.i >= 0 && smapi_bat_installed(obj->data.i))
new_bar(obj, p, p_max_size, (int)
(255 * smapi_get_bat_int(obj->data.i, "remaining_percent") / 100));
else
new_bar(obj, p, p_max_size, 0);
return round_to_int(smapi_get_bat_int(obj->data.i, "remaining_percent") * 2.55);
return 0;
}

View File

@ -40,6 +40,6 @@ void print_smapi(struct text_object *, char *, int);
void print_smapi_bat_perc(struct text_object *, char *, int);
void print_smapi_bat_temp(struct text_object *, char *, int);
void print_smapi_bat_power(struct text_object *, char *, int);
void print_smapi_bat_bar(struct text_object *, char *, int);
uint8_t smapi_bat_barval(struct text_object *);
#endif /* _SMAPI_H */