1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-12 19:06:36 +00:00

wireless_link_bar: convert to callbacks.barval

This commit is contained in:
Phil Sutter 2009-11-22 18:15:36 +01:00
parent c85295202b
commit a11a1a1253
3 changed files with 5 additions and 6 deletions

View File

@ -233,7 +233,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
obj->callbacks.print = &print_wireless_link_qual_perc; obj->callbacks.print = &print_wireless_link_qual_perc;
END OBJ(wireless_link_bar, &update_net_stats) END OBJ(wireless_link_bar, &update_net_stats)
parse_net_stat_bar_arg(obj, arg, free_at_crash); parse_net_stat_bar_arg(obj, arg, free_at_crash);
obj->callbacks.print = &print_wireless_link_bar; obj->callbacks.barval = &wireless_link_barval;
#endif /* HAVE_IWLIB */ #endif /* HAVE_IWLIB */
#endif /* __linux__ */ #endif /* __linux__ */

View File

@ -298,15 +298,14 @@ void print_wireless_link_qual_perc(struct text_object *obj, char *p, int p_max_s
spaced_print(p, p_max_size, "unk", 5); spaced_print(p, p_max_size, "unk", 5);
} }
} }
void print_wireless_link_bar(struct text_object *obj, char *p, int p_max_size) uint8_t wireless_link_barval(struct text_object *obj)
{ {
struct net_stat *ns = obj->data.opaque; struct net_stat *ns = obj->data.opaque;
if (!ns) if (!ns)
return; return 0;
new_bar(obj, p, p_max_size, return round_to_int((double) (ns->link_qual / ns->link_qual_max) * 255.0);
((double) ns->link_qual / ns->link_qual_max) * 255.0);
} }
#endif /* HAVE_IWLIB */ #endif /* HAVE_IWLIB */
#endif /* __linux__ */ #endif /* __linux__ */

View File

@ -83,7 +83,7 @@ void print_wireless_ap(struct text_object *, char *, int);
void print_wireless_link_qual(struct text_object *, char *, int); void print_wireless_link_qual(struct text_object *, char *, int);
void print_wireless_link_qual_max(struct text_object *, char *, int); void print_wireless_link_qual_max(struct text_object *, char *, int);
void print_wireless_link_qual_perc(struct text_object *, char *, int); void print_wireless_link_qual_perc(struct text_object *, char *, int);
void print_wireless_link_bar(struct text_object *, char *, int); uint8_t wireless_link_barval(struct text_object *);
#endif /* HAVE_IWLIB */ #endif /* HAVE_IWLIB */
#endif /* __linux__ */ #endif /* __linux__ */