1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-18 02:55:12 +00:00

merge lua_bar to callbacks.barval

This commit is contained in:
Phil Sutter 2009-11-23 23:36:57 +01:00
parent 4f8e700d64
commit 4d7f2e720d
3 changed files with 5 additions and 4 deletions

View File

@ -1330,7 +1330,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
} else {
CRIT_ERR(obj, free_at_crash, "lua_bar needs arguments: <height>,<width> <function name> [function parameters]");
}
obj->callbacks.print = &print_lua_bar;
obj->callbacks.barval = &lua_barval;
obj->callbacks.free = &gen_free_opaque;
#ifdef X11
END OBJ_ARG(lua_graph, 0, "lua_graph needs arguments: <function name> [height],[width] [gradient colour 1] [gradient colour 2] [scale] [-t] [-l]")

View File

@ -546,12 +546,13 @@ void print_lua_parse(struct text_object *obj, char *p, int p_max_size)
}
}
void print_lua_bar(struct text_object *obj, char *p, int p_max_size)
uint8_t lua_barval(struct text_object *obj)
{
double per;
if (llua_getnumber(obj->data.s, &per)) {
new_bar(obj, p, p_max_size, (per/100.0 * 255));
return round_to_int(per * 2.55);
}
return 0;
}
#ifdef X11

View File

@ -67,7 +67,7 @@ void llua_update_info(struct information *i, double u_interval);
void print_lua(struct text_object *, char *, int);
void print_lua_parse(struct text_object *, char *, int);
void print_lua_bar(struct text_object *, char *, int);
uint8_t lua_barval(struct text_object *);
#ifdef X11
void print_lua_graph(struct text_object *, char *, int);
#endif /* X11 */