mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 04:06:03 +00:00
merge {down,up}speedgraph to callbacks.graphval
This commit is contained in:
parent
fe05542318
commit
bd752e8506
@ -524,7 +524,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
#ifdef X11
|
||||
END OBJ(downspeedgraph, &update_net_stats)
|
||||
parse_net_stat_graph_arg(obj, arg, free_at_crash);
|
||||
obj->callbacks.print = &print_downspeedgraph;
|
||||
obj->callbacks.graphval = &downspeedgraphval;
|
||||
#endif /* X11 */
|
||||
END OBJ(else, 0)
|
||||
obj_be_ifblock_else(ifblock_opaque, obj);
|
||||
@ -1019,7 +1019,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
#ifdef X11
|
||||
END OBJ(upspeedgraph, &update_net_stats)
|
||||
parse_net_stat_graph_arg(obj, arg, free_at_crash);
|
||||
obj->callbacks.print = &print_upspeedgraph;
|
||||
obj->callbacks.graphval = &upspeedgraphval;
|
||||
#endif
|
||||
END OBJ(uptime_short, &update_uptime)
|
||||
END OBJ(uptime, &update_uptime)
|
||||
|
@ -206,24 +206,18 @@ void parse_net_stat_graph_arg(struct text_object *obj, const char *arg, void *fr
|
||||
obj->data.opaque = get_net_stat(DEFAULTNETDEV, obj, free_at_crash);
|
||||
}
|
||||
|
||||
void print_downspeedgraph(struct text_object *obj, char *p, int p_max_size)
|
||||
uint8_t downspeedgraphval(struct text_object *obj)
|
||||
{
|
||||
struct net_stat *ns = obj->data.opaque;
|
||||
|
||||
if (!ns || !p_max_size)
|
||||
return;
|
||||
|
||||
new_graph(obj, p, p_max_size, ns->recv_speed / 1024.0);
|
||||
return (ns ? round_to_int(ns->recv_speed / 1024.0) : 0);
|
||||
}
|
||||
|
||||
void print_upspeedgraph(struct text_object *obj, char *p, int p_max_size)
|
||||
uint8_t upspeedgraphval(struct text_object *obj)
|
||||
{
|
||||
struct net_stat *ns = obj->data.opaque;
|
||||
|
||||
if (!ns || !p_max_size)
|
||||
return;
|
||||
|
||||
new_graph(obj, p, p_max_size, ns->trans_speed / 1024.0);
|
||||
return (ns ? round_to_int(ns->trans_speed / 1024.0) : 0);
|
||||
}
|
||||
#endif /* X11 */
|
||||
|
||||
|
@ -71,8 +71,8 @@ void print_addrs(struct text_object *, char *, int);
|
||||
#endif /* __linux__ */
|
||||
#ifdef X11
|
||||
void parse_net_stat_graph_arg(struct text_object *, const char *, void *);
|
||||
void print_downspeedgraph(struct text_object *, char *, int);
|
||||
void print_upspeedgraph(struct text_object *, char *, int);
|
||||
uint8_t downspeedgraphval(struct text_object *);
|
||||
uint8_t upspeedgraphval(struct text_object *);
|
||||
#endif /* X11 */
|
||||
#ifdef __linux__
|
||||
#ifdef HAVE_IWLIB
|
||||
|
Loading…
Reference in New Issue
Block a user