From cce12efda7f8c77f58e1d8d0ca10a75a5a12f488 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 26 Nov 2009 00:29:50 +0100 Subject: [PATCH] convert sysname to callbacks.print --- src/common.c | 6 ++++++ src/common.h | 1 + src/conky.c | 3 --- src/core.c | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/common.c b/src/common.c index 05fbd474..48acec5d 100644 --- a/src/common.c +++ b/src/common.c @@ -547,3 +547,9 @@ void print_nodename(struct text_object *obj, char *p, int p_max_size) (void)obj; snprintf(p, p_max_size, "%s", info.uname_s.nodename); } + +void print_sysname(struct text_object *obj, char *p, int p_max_size) +{ + (void)obj; + snprintf(p, p_max_size, "%s", info.uname_s.sysname); +} diff --git a/src/common.h b/src/common.h index 2cf6e1e6..5233a636 100644 --- a/src/common.h +++ b/src/common.h @@ -89,5 +89,6 @@ uint8_t swap_barval(struct text_object *); void print_kernel(struct text_object *, char *, int); void print_machine(struct text_object *, char *, int); void print_nodename(struct text_object *, char *, int); +void print_sysname(struct text_object *, char *, int); #endif /* _COMMON_H */ diff --git a/src/conky.c b/src/conky.c index f4ab2cbc..a312e086 100644 --- a/src/conky.c +++ b/src/conky.c @@ -1251,9 +1251,6 @@ void generate_text_internal(char *p, int p_max_size, OBJ(text) { snprintf(p, p_max_size, "%s", obj->data.s); } - OBJ(sysname) { - snprintf(p, p_max_size, "%s", cur->uname_s.sysname); - } OBJ(gid_name) { char buf[max_user_text]; diff --git a/src/core.c b/src/core.c index b419d959..f22046fd 100644 --- a/src/core.c +++ b/src/core.c @@ -994,6 +994,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long obj->callbacks.barval = &swap_barval; /* XXX: swapgraph, swapgauge? */ END OBJ(sysname, 0) + obj->callbacks.print = &print_sysname; END OBJ(time, 0) scan_time(obj, arg); obj->callbacks.print = &print_time;