mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 04:06:03 +00:00
convert smapi_bat_perc to callbacks.percentage
This commit is contained in:
parent
bc1b82771f
commit
9887bfdfdf
@ -1070,7 +1070,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->callbacks.free = &gen_free_opaque;
|
||||
END OBJ_ARG(smapi_bat_perc, 0, "smapi_bat_perc needs an argument")
|
||||
obj->data.s = strndup(arg, text_buffer_size);
|
||||
obj->callbacks.print = &print_smapi_bat_perc;
|
||||
obj->callbacks.percentage = &smapi_bat_percentage;
|
||||
obj->callbacks.free = &gen_free_opaque;
|
||||
END OBJ_ARG(smapi_bat_temp, 0, "smapi_bat_temp needs an argument")
|
||||
obj->data.s = strndup(arg, text_buffer_size);
|
||||
|
@ -137,15 +137,16 @@ void print_smapi(struct text_object *obj, char *p, int p_max_size)
|
||||
free(s);
|
||||
}
|
||||
|
||||
void print_smapi_bat_perc(struct text_object *obj, char *p, int p_max_size)
|
||||
uint8_t smapi_bat_percentage(struct text_object *obj)
|
||||
{
|
||||
int idx, val;
|
||||
int idx, val = 0;
|
||||
if (obj->data.s && sscanf(obj->data.s, "%i", &idx) == 1) {
|
||||
val = smapi_bat_installed(idx) ?
|
||||
smapi_get_bat_int(idx, "remaining_percent") : 0;
|
||||
percent_print(p, p_max_size, val);
|
||||
} else
|
||||
NORM_ERR("argument to smapi_bat_perc must be an integer");
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
void print_smapi_bat_temp(struct text_object *obj, char *p, int p_max_size)
|
||||
|
@ -37,7 +37,7 @@ int smapi_get_bat_int(int, const char *);
|
||||
char *smapi_get_bat_val(const char *);
|
||||
|
||||
void print_smapi(struct text_object *, char *, int);
|
||||
void print_smapi_bat_perc(struct text_object *, char *, int);
|
||||
uint8_t smapi_bat_percentage(struct text_object *);
|
||||
void print_smapi_bat_temp(struct text_object *, char *, int);
|
||||
void print_smapi_bat_power(struct text_object *, char *, int);
|
||||
uint8_t smapi_bat_barval(struct text_object *);
|
||||
|
Loading…
Reference in New Issue
Block a user