1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-29 21:49:07 +00:00

convert exec bars to double

This commit is contained in:
Phil Sutter 2009-12-04 02:09:41 +01:00
parent b2c305a995
commit 361e5eba83
3 changed files with 22 additions and 6 deletions

View File

@ -582,7 +582,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
obj->callbacks.free = &free_exec;
#endif /* X11 */
END OBJ_ARG(execibar, 0, "execibar needs arguments")
scan_execi_arg(obj, arg);
scan_execi_bar_arg(obj, arg);
obj->callbacks.barval = &execi_barval;
obj->callbacks.free = &free_execi;
#ifdef X11
@ -592,7 +592,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
obj->callbacks.free = &free_execi;
#endif /* X11 */
END OBJ_ARG(execigauge, 0, "execigauge needs arguments")
scan_execi_arg(obj, arg);
scan_execi_gauge_arg(obj, arg);
obj->callbacks.gaugeval = &execi_barval;
obj->callbacks.free = &free_execi;
END OBJ_ARG(execi, 0, "execi needs arguments")

View File

@ -253,6 +253,20 @@ void scan_execi_arg(struct text_object *obj, const char *arg)
obj->data.opaque = ed;
}
void scan_execi_bar_arg(struct text_object *obj, const char *arg)
{
/* XXX: do real bar parsing here */
scan_bar(obj, "", 100);
scan_execi_arg(obj, arg);
}
void scan_execi_gauge_arg(struct text_object *obj, const char *arg)
{
/* XXX: do real gauge parsing here */
scan_gauge(obj, "", 100);
scan_execi_arg(obj, arg);
}
#ifdef X11
void scan_execgraph_arg(struct text_object *obj, const char *arg)
{
@ -360,7 +374,7 @@ double execbarval(struct text_object *obj)
return read_exec_barnum(obj->data.s);
}
uint8_t execi_barval(struct text_object *obj)
double execi_barval(struct text_object *obj)
{
struct execi_data *ed = obj->data.opaque;
@ -368,10 +382,10 @@ uint8_t execi_barval(struct text_object *obj)
return 0;
if (time_to_update(ed)) {
ed->barnum = read_exec_barnum(ed->cmd) * 2.55;
ed->barnum = read_exec_barnum(ed->cmd);
ed->last_update = current_update_time;
}
return round_to_int(ed->barnum);
return ed->barnum;
}
void free_exec(struct text_object *obj)

View File

@ -36,6 +36,8 @@ extern pid_t childpid;
void scan_exec_arg(struct text_object *, const char *);
void scan_pre_exec_arg(struct text_object *, const char *);
void scan_execi_arg(struct text_object *, const char *);
void scan_execi_bar_arg(struct text_object *, const char *);
void scan_execi_gauge_arg(struct text_object *, const char *);
void scan_execgraph_arg(struct text_object *, const char *);
void print_exec(struct text_object *, char *, int);
void print_execp(struct text_object *, char *, int);
@ -43,7 +45,7 @@ void print_execi(struct text_object *, char *, int);
void print_execpi(struct text_object *, char *, int);
void print_texeci(struct text_object *, char *, int);
double execbarval(struct text_object *);
uint8_t execi_barval(struct text_object *);
double execi_barval(struct text_object *);
void free_exec(struct text_object *);
void free_execi(struct text_object *);
#endif /* _EXEC_H */