From d48c2f143c8c48c4bfc34e0557f47288e6db71e4 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Sun, 29 Nov 2009 12:59:04 +0100 Subject: [PATCH] convert $include to callbacks.print --- src/common.c | 11 +++++++++++ src/common.h | 1 + src/conky.c | 10 ---------- src/core.c | 1 + 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/common.c b/src/common.c index 68391239..a76989f1 100644 --- a/src/common.c +++ b/src/common.c @@ -781,3 +781,14 @@ void print_blink(struct text_object *obj, char *p, int p_max_size) snprintf(p, p_max_size, "%s", buf); visible = !visible; } + +void print_include(struct text_object *obj, char *p, int p_max_size) +{ + char buf[max_user_text]; + + if (!obj->sub) + return; + + generate_text_internal(buf, max_user_text, *obj->sub, &info); + snprintf(p, p_max_size, "%s", buf); +} diff --git a/src/common.h b/src/common.h index bfceaa4e..e5117065 100644 --- a/src/common.h +++ b/src/common.h @@ -127,5 +127,6 @@ void print_battery_short(struct text_object *, char *, int); void print_to_bytes(struct text_object *, char *, int); void print_blink(struct text_object *, char *, int); +void print_include(struct text_object *, char *, int); #endif /* _COMMON_H */ diff --git a/src/conky.c b/src/conky.c index daf61ae2..a2ab7cae 100644 --- a/src/conky.c +++ b/src/conky.c @@ -1143,16 +1143,6 @@ void generate_text_internal(char *p, int p_max_size, } #endif /* HAVE_ICONV */ - OBJ(include) { - if(obj->sub) { - char buf[max_user_text]; - - generate_text_internal(buf, max_user_text, *obj->sub, cur); - snprintf(p, p_max_size, "%s", buf); - } else { - p[0] = 0; - } - } break; } #undef DO_JUMP diff --git a/src/core.c b/src/core.c index ed939703..90dad974 100644 --- a/src/core.c +++ b/src/core.c @@ -1449,6 +1449,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long currentconffile = leaf; extract_variable_text_internal(obj->sub, get_global_text()); currentconffile = leaf->back; + obj->callbacks.print = &print_include; } else { NORM_ERR("Can't load configfile '%s'.", arg); }