mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-26 04:17:33 +00:00
convert smapi_bat_bar to callbacks.barval
This commit is contained in:
parent
fcd3d58960
commit
997805c46b
@ -1082,7 +1082,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
obj->data.i = -1;
|
obj->data.i = -1;
|
||||||
} else
|
} else
|
||||||
arg = scan_bar(obj, arg + cnt);
|
arg = scan_bar(obj, arg + cnt);
|
||||||
obj->callbacks.print = &print_smapi_bat_bar;
|
obj->callbacks.barval = &smapi_bat_barval;
|
||||||
#endif /* IBM */
|
#endif /* IBM */
|
||||||
#ifdef MPD
|
#ifdef MPD
|
||||||
#define mpd_set_maxlen(name) \
|
#define mpd_set_maxlen(name) \
|
||||||
|
11
src/smapi.c
11
src/smapi.c
@ -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");
|
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))
|
if (obj->data.i >= 0 && smapi_bat_installed(obj->data.i))
|
||||||
new_bar(obj, p, p_max_size, (int)
|
return round_to_int(smapi_get_bat_int(obj->data.i, "remaining_percent") * 2.55);
|
||||||
(255 * smapi_get_bat_int(obj->data.i, "remaining_percent") / 100));
|
return 0;
|
||||||
else
|
|
||||||
new_bar(obj, p, p_max_size, 0);
|
|
||||||
}
|
}
|
||||||
|
@ -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_perc(struct text_object *, char *, int);
|
||||||
void print_smapi_bat_temp(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_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 */
|
#endif /* _SMAPI_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user