mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 12:10:03 +00:00
convert kernel and machine to callbacks.print
This commit is contained in:
parent
177da5ffbb
commit
f84b14904c
12
src/common.c
12
src/common.c
@ -529,3 +529,15 @@ uint8_t swap_barval(struct text_object *obj)
|
||||
|
||||
return round_to_int(info.swapmax ? (info.swap * 255 / info.swapmax) : 0);
|
||||
}
|
||||
|
||||
void print_kernel(struct text_object *obj, char *p, int p_max_size)
|
||||
{
|
||||
(void)obj;
|
||||
snprintf(p, p_max_size, "%s", info.uname_s.release);
|
||||
}
|
||||
|
||||
void print_machine(struct text_object *obj, char *p, int p_max_size)
|
||||
{
|
||||
(void)obj;
|
||||
snprintf(p, p_max_size, "%s", info.uname_s.machine);
|
||||
}
|
||||
|
@ -86,4 +86,7 @@ uint8_t mem_barval(struct text_object *);
|
||||
uint8_t swap_percentage(struct text_object *);
|
||||
uint8_t swap_barval(struct text_object *);
|
||||
|
||||
void print_kernel(struct text_object *, char *, int);
|
||||
void print_machine(struct text_object *, char *, int);
|
||||
|
||||
#endif /* _COMMON_H */
|
||||
|
@ -956,13 +956,6 @@ void generate_text_internal(char *p, int p_max_size,
|
||||
DO_JUMP;
|
||||
}
|
||||
}
|
||||
OBJ(kernel) {
|
||||
snprintf(p, p_max_size, "%s", cur->uname_s.release);
|
||||
}
|
||||
OBJ(machine) {
|
||||
snprintf(p, p_max_size, "%s", cur->uname_s.machine);
|
||||
}
|
||||
|
||||
OBJ(format_time) {
|
||||
char buf[max_user_text];
|
||||
|
||||
|
@ -711,7 +711,9 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->data.s = strndup(buf, text_buffer_size);
|
||||
#endif
|
||||
END OBJ(kernel, 0)
|
||||
obj->callbacks.print = &print_kernel;
|
||||
END OBJ(machine, 0)
|
||||
obj->callbacks.print = &print_machine;
|
||||
END OBJ(mails, 0)
|
||||
parse_local_mail_args(obj, arg);
|
||||
obj->callbacks.print = &print_mails;
|
||||
|
Loading…
Reference in New Issue
Block a user