mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 02:55:12 +00:00
convert $include to callbacks.print
This commit is contained in:
parent
3ed82a34dd
commit
d48c2f143c
11
src/common.c
11
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);
|
||||
}
|
||||
|
@ -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 */
|
||||
|
10
src/conky.c
10
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
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user