1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-02-14 10:00:21 +00:00

merge entropy_bar to callbacks.barval

This commit is contained in:
Phil Sutter 2009-11-23 23:26:11 +01:00
parent b78664d8c5
commit 95fbecc385
3 changed files with 4 additions and 8 deletions

View File

@ -1375,7 +1375,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
obj->callbacks.print = &print_entropy_poolsize;
END OBJ(entropy_bar, &update_entropy)
scan_bar(obj, arg);
obj->callbacks.print = &print_entropy_bar;
obj->callbacks.barval = &entropy_barval;
END OBJ_ARG(include, 0, "include needs a argument")
struct conftree *leaf = conftree_add(currentconffile, arg);
if(leaf) {

View File

@ -74,13 +74,9 @@ void print_entropy_poolsize(struct text_object *obj, char *p, int p_max_size)
snprintf(p, p_max_size, "%u", entropy.poolsize);
}
void print_entropy_bar(struct text_object *obj, char *p, int p_max_size)
uint8_t entropy_barval(struct text_object *obj)
{
double ratio;
(void)obj;
ratio = (double) entropy.avail /
(double) entropy.poolsize;
new_bar(obj, p, p_max_size, (int) (ratio * 255.0f));
return round_to_int((double) entropy.avail * 255.0f / (double) entropy.poolsize);
}

View File

@ -36,6 +36,6 @@ void update_entropy(void);
void print_entropy_avail(struct text_object *, char *, int);
void print_entropy_perc(struct text_object *, char *, int);
void print_entropy_poolsize(struct text_object *, char *, int);
void print_entropy_bar(struct text_object *, char *, int);
uint8_t entropy_barval(struct text_object *);
#endif /* _ENTROPY_H */