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

convert swapbar to callbacks

This commit is contained in:
Phil Sutter 2009-11-30 23:55:48 +01:00
parent d2f3ae7e15
commit 086829b017
4 changed files with 10 additions and 3 deletions

View File

@ -484,3 +484,10 @@ uint8_t mem_barval(struct text_object *obj)
return round_to_int(info.memmax ? (info.mem * 255 / info.memmax) : 0); return round_to_int(info.memmax ? (info.mem * 255 / info.memmax) : 0);
} }
uint8_t swap_barval(struct text_object *obj)
{
(void)obj;
return round_to_int(info.swapmax ? (info.swap * 255 / info.swapmax) : 0);
}

View File

@ -77,5 +77,6 @@ void print_loadgraph(struct text_object *, char *, int);
uint8_t cpu_barval(struct text_object *); uint8_t cpu_barval(struct text_object *);
uint8_t mem_barval(struct text_object *); uint8_t mem_barval(struct text_object *);
uint8_t swap_barval(struct text_object *);
#endif /* _COMMON_H */ #endif /* _COMMON_H */

View File

@ -1357,9 +1357,6 @@ void generate_text_internal(char *p, int p_max_size,
percent_print(p, p_max_size, cur->swap * 100 / cur->swapmax); percent_print(p, p_max_size, cur->swap * 100 / cur->swapmax);
} }
} }
OBJ(swapbar) {
new_bar(obj, p, p_max_size, cur->swapmax ? (cur->swap * 255) / (cur->swapmax) : 0);
}
OBJ(sysname) { OBJ(sysname) {
snprintf(p, p_max_size, "%s", cur->uname_s.sysname); snprintf(p, p_max_size, "%s", cur->uname_s.sysname);
} }

View File

@ -970,6 +970,8 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
END OBJ(swapperc, &update_meminfo) END OBJ(swapperc, &update_meminfo)
END OBJ(swapbar, &update_meminfo) END OBJ(swapbar, &update_meminfo)
scan_bar(obj, arg); scan_bar(obj, arg);
obj->callbacks.barval = &swap_barval;
/* XXX: swapgraph, swapgauge? */
END OBJ(sysname, 0) END OBJ(sysname, 0)
END OBJ(time, 0) END OBJ(time, 0)
scan_time(obj, arg); scan_time(obj, arg);