mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-15 03:43:50 +00:00
convert $updates to callbacks.print
This commit is contained in:
parent
ffec9dd50c
commit
841a3814c8
@ -792,3 +792,9 @@ void print_include(struct text_object *obj, char *p, int p_max_size)
|
|||||||
generate_text_internal(buf, max_user_text, *obj->sub, &info);
|
generate_text_internal(buf, max_user_text, *obj->sub, &info);
|
||||||
snprintf(p, p_max_size, "%s", buf);
|
snprintf(p, p_max_size, "%s", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print_updates(struct text_object *obj, char *p, int p_max_size)
|
||||||
|
{
|
||||||
|
(void)obj;
|
||||||
|
snprintf(p, p_max_size, "%d", get_total_updates());
|
||||||
|
}
|
||||||
|
@ -15,7 +15,6 @@ void add_update_callback(void (*func)(void));
|
|||||||
void free_update_callbacks(void);
|
void free_update_callbacks(void);
|
||||||
void start_update_threading(void);
|
void start_update_threading(void);
|
||||||
|
|
||||||
|
|
||||||
void strfold(char *start, int count);
|
void strfold(char *start, int count);
|
||||||
int check_mount(struct text_object *);
|
int check_mount(struct text_object *);
|
||||||
void prepare_update(void);
|
void prepare_update(void);
|
||||||
@ -129,4 +128,6 @@ void print_to_bytes(struct text_object *, char *, int);
|
|||||||
void print_blink(struct text_object *, char *, int);
|
void print_blink(struct text_object *, char *, int);
|
||||||
void print_include(struct text_object *, char *, int);
|
void print_include(struct text_object *, char *, int);
|
||||||
|
|
||||||
|
void print_updates(struct text_object *, char *, int);
|
||||||
|
|
||||||
#endif /* _COMMON_H */
|
#endif /* _COMMON_H */
|
||||||
|
@ -425,6 +425,11 @@ int get_updatereset(void)
|
|||||||
return updatereset;
|
return updatereset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int get_total_updates(void)
|
||||||
|
{
|
||||||
|
return total_updates;
|
||||||
|
}
|
||||||
|
|
||||||
#define SECRIT_MULTILINE_CHAR '\x02'
|
#define SECRIT_MULTILINE_CHAR '\x02'
|
||||||
|
|
||||||
static inline int calc_text_width(const char *s)
|
static inline int calc_text_width(const char *s)
|
||||||
@ -792,9 +797,6 @@ void generate_text_internal(char *p, int p_max_size,
|
|||||||
OBJ(text) {
|
OBJ(text) {
|
||||||
snprintf(p, p_max_size, "%s", obj->data.s);
|
snprintf(p, p_max_size, "%s", obj->data.s);
|
||||||
}
|
}
|
||||||
OBJ(updates) {
|
|
||||||
snprintf(p, p_max_size, "%d", total_updates);
|
|
||||||
}
|
|
||||||
OBJ(if_updatenr) {
|
OBJ(if_updatenr) {
|
||||||
if(total_updates % updatereset != obj->data.i - 1) {
|
if(total_updates % updatereset != obj->data.i - 1) {
|
||||||
DO_JUMP;
|
DO_JUMP;
|
||||||
|
@ -172,6 +172,7 @@ long get_current_text_color(void);
|
|||||||
|
|
||||||
void set_updatereset(int);
|
void set_updatereset(int);
|
||||||
int get_updatereset(void);
|
int get_updatereset(void);
|
||||||
|
int get_total_updates(void);
|
||||||
|
|
||||||
int percent_print(char *, int, unsigned);
|
int percent_print(char *, int, unsigned);
|
||||||
void human_readable(long long, char *, int);
|
void human_readable(long long, char *, int);
|
||||||
|
@ -1057,6 +1057,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||||
obj->callbacks.print = &print_totalup;
|
obj->callbacks.print = &print_totalup;
|
||||||
END OBJ(updates, 0)
|
END OBJ(updates, 0)
|
||||||
|
obj->callbacks.print = &print_updates;
|
||||||
END OBJ_IF(if_updatenr, 0)
|
END OBJ_IF(if_updatenr, 0)
|
||||||
obj->data.i = arg ? atoi(arg) : 0;
|
obj->data.i = arg ? atoi(arg) : 0;
|
||||||
if(obj->data.i == 0) CRIT_ERR(obj, free_at_crash, "if_updatenr needs a number above 0 as argument");
|
if(obj->data.i == 0) CRIT_ERR(obj, free_at_crash, "if_updatenr needs a number above 0 as argument");
|
||||||
|
Loading…
Reference in New Issue
Block a user