mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 11:05:18 +00:00
if_gw: convert to callbacks.iftest
This commit is contained in:
parent
bb70c21c36
commit
27c1207cd1
@ -896,13 +896,6 @@ void generate_text_internal(char *p, int p_max_size,
|
|||||||
new_graph(obj, p, p_max_size, round_to_int(cur->cpu_usage[obj->data.i] * 100));
|
new_graph(obj, p, p_max_size, round_to_int(cur->cpu_usage[obj->data.i] * 100));
|
||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
#if defined(__linux__)
|
|
||||||
OBJ(if_gw) {
|
|
||||||
if (!gateway_exists()) {
|
|
||||||
DO_JUMP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* __linux__ */
|
|
||||||
#if (defined(__FreeBSD__) || defined(__linux__))
|
#if (defined(__FreeBSD__) || defined(__linux__))
|
||||||
OBJ(if_up) {
|
OBJ(if_up) {
|
||||||
if (!interface_up(obj)) {
|
if (!interface_up(obj)) {
|
||||||
|
@ -333,6 +333,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
END OBJ(sony_fanspeed, 0)
|
END OBJ(sony_fanspeed, 0)
|
||||||
obj->callbacks.print = &get_sony_fanspeed;
|
obj->callbacks.print = &get_sony_fanspeed;
|
||||||
END OBJ_IF(if_gw, &update_gateway_info)
|
END OBJ_IF(if_gw, &update_gateway_info)
|
||||||
|
obj->callbacks.iftest = &gateway_exists;
|
||||||
END OBJ_ARG(ioscheduler, 0, "get_ioscheduler needs an argument (e.g. hda)")
|
END OBJ_ARG(ioscheduler, 0, "get_ioscheduler needs an argument (e.g. hda)")
|
||||||
obj->data.s = strndup(dev_name(arg), text_buffer_size);
|
obj->data.s = strndup(dev_name(arg), text_buffer_size);
|
||||||
obj->callbacks.print = &print_ioscheduler;
|
obj->callbacks.print = &print_ioscheduler;
|
||||||
|
@ -316,8 +316,9 @@ void free_gateway_info(void)
|
|||||||
memset(&gw_info, 0, sizeof(gw_info));
|
memset(&gw_info, 0, sizeof(gw_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
int gateway_exists(void)
|
int gateway_exists(struct text_object *obj)
|
||||||
{
|
{
|
||||||
|
(void)obj;
|
||||||
return !!gw_info.count;
|
return !!gw_info.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ void print_laptop_mode(struct text_object *, char *, int);
|
|||||||
|
|
||||||
void update_gateway_info(void);
|
void update_gateway_info(void);
|
||||||
void free_gateway_info(void);
|
void free_gateway_info(void);
|
||||||
int gateway_exists(void);
|
int gateway_exists(struct text_object *);
|
||||||
void print_gateway_iface(struct text_object *, char *, int);
|
void print_gateway_iface(struct text_object *, char *, int);
|
||||||
void print_gateway_ip(struct text_object *, char *, int);
|
void print_gateway_ip(struct text_object *, char *, int);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user