mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-02-05 05:28:32 +00:00
update machinery: let CALLBACK() die again
There are no INFO_* variables any more, so the argument passed to OBJ() is always a function pointer or zero. By checking the argument passed in add_update_callback(), the branch in the OBJ() macro can be dropped, too.
This commit is contained in:
parent
e83fb84c55
commit
d32879faaa
@ -391,6 +391,9 @@ void add_update_callback(void (*func)(void))
|
||||
{
|
||||
struct update_cb *uc = &update_cb_head;
|
||||
|
||||
if (!func)
|
||||
return;
|
||||
|
||||
while (uc->next) {
|
||||
if (uc->next->func == func)
|
||||
return;
|
||||
|
349
src/core.c
349
src/core.c
@ -220,16 +220,11 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
|
||||
obj->line = line;
|
||||
|
||||
#define CALLBACK(x) (-(long)x)
|
||||
|
||||
#define OBJ(a, n) if (strcmp(s, #a) == 0) { \
|
||||
obj->type = OBJ_##a; \
|
||||
if (n > 0) { need_mask |= (1ULL << n); } \
|
||||
else if (n < 0) { add_update_callback((void (*)(void))CALLBACK(n)); } {
|
||||
obj->type = OBJ_##a; add_update_callback(n); {
|
||||
#define OBJ_IF(a, n) if (strcmp(s, #a) == 0) { \
|
||||
obj->type = OBJ_##a; obj_be_ifblock_if(ifblock_opaque, obj); \
|
||||
if (n > 0) { need_mask |= (1ULL << n); } \
|
||||
else if (n < 0) { add_update_callback((void (*)(void))CALLBACK(n)); } {
|
||||
add_update_callback(n); {
|
||||
#define END } } else
|
||||
|
||||
#define SIZE_DEFAULTS(arg) { \
|
||||
@ -313,7 +308,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->a = 1;
|
||||
|
||||
#ifdef HAVE_IWLIB
|
||||
END OBJ(wireless_essid, CALLBACK(&update_net_stats))
|
||||
END OBJ(wireless_essid, &update_net_stats)
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg, obj, free_at_crash);
|
||||
} else {
|
||||
@ -322,7 +317,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->data.net = get_net_stat(buf, obj, free_at_crash);
|
||||
free(buf);
|
||||
}
|
||||
END OBJ(wireless_mode, CALLBACK(&update_net_stats))
|
||||
END OBJ(wireless_mode, &update_net_stats)
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg, obj, free_at_crash);
|
||||
} else {
|
||||
@ -331,7 +326,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->data.net = get_net_stat(buf, obj, free_at_crash);
|
||||
free(buf);
|
||||
}
|
||||
END OBJ(wireless_bitrate, CALLBACK(&update_net_stats))
|
||||
END OBJ(wireless_bitrate, &update_net_stats)
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg, obj, free_at_crash);
|
||||
} else {
|
||||
@ -340,7 +335,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->data.net = get_net_stat(buf, obj, free_at_crash);
|
||||
free(buf);
|
||||
}
|
||||
END OBJ(wireless_ap, CALLBACK(&update_net_stats))
|
||||
END OBJ(wireless_ap, &update_net_stats)
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg, obj, free_at_crash);
|
||||
} else {
|
||||
@ -349,7 +344,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->data.net = get_net_stat(buf, obj, free_at_crash);
|
||||
free(buf);
|
||||
}
|
||||
END OBJ(wireless_link_qual, CALLBACK(&update_net_stats))
|
||||
END OBJ(wireless_link_qual, &update_net_stats)
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg, obj, free_at_crash);
|
||||
} else {
|
||||
@ -358,7 +353,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->data.net = get_net_stat(buf, obj, free_at_crash);
|
||||
free(buf);
|
||||
}
|
||||
END OBJ(wireless_link_qual_max, CALLBACK(&update_net_stats))
|
||||
END OBJ(wireless_link_qual_max, &update_net_stats)
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg, obj, free_at_crash);
|
||||
} else {
|
||||
@ -367,7 +362,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->data.net = get_net_stat(buf, obj, free_at_crash);
|
||||
free(buf);
|
||||
}
|
||||
END OBJ(wireless_link_qual_perc, CALLBACK(&update_net_stats))
|
||||
END OBJ(wireless_link_qual_perc, &update_net_stats)
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg, obj, free_at_crash);
|
||||
} else {
|
||||
@ -376,7 +371,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->data.net = get_net_stat(buf, obj, free_at_crash);
|
||||
free(buf);
|
||||
}
|
||||
END OBJ(wireless_link_bar, CALLBACK(&update_net_stats))
|
||||
END OBJ(wireless_link_bar, &update_net_stats)
|
||||
SIZE_DEFAULTS(bar);
|
||||
if (arg) {
|
||||
arg = scan_bar(arg, &obj->a, &obj->b);
|
||||
@ -448,16 +443,16 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->data.s = strndup(dev_name(arg), text_buffer_size);
|
||||
else
|
||||
CRIT_ERR(obj, free_at_crash, "disk_protect needs an argument");
|
||||
END OBJ(i8k_version, CALLBACK(&update_i8k))
|
||||
END OBJ(i8k_bios, CALLBACK(&update_i8k))
|
||||
END OBJ(i8k_serial, CALLBACK(&update_i8k))
|
||||
END OBJ(i8k_cpu_temp, CALLBACK(&update_i8k))
|
||||
END OBJ(i8k_left_fan_status, CALLBACK(&update_i8k))
|
||||
END OBJ(i8k_right_fan_status, CALLBACK(&update_i8k))
|
||||
END OBJ(i8k_left_fan_rpm, CALLBACK(&update_i8k))
|
||||
END OBJ(i8k_right_fan_rpm, CALLBACK(&update_i8k))
|
||||
END OBJ(i8k_ac_status, CALLBACK(&update_i8k))
|
||||
END OBJ(i8k_buttons_status, CALLBACK(&update_i8k))
|
||||
END OBJ(i8k_version, &update_i8k)
|
||||
END OBJ(i8k_bios, &update_i8k)
|
||||
END OBJ(i8k_serial, &update_i8k)
|
||||
END OBJ(i8k_cpu_temp, &update_i8k)
|
||||
END OBJ(i8k_left_fan_status, &update_i8k)
|
||||
END OBJ(i8k_right_fan_status, &update_i8k)
|
||||
END OBJ(i8k_left_fan_rpm, &update_i8k)
|
||||
END OBJ(i8k_right_fan_rpm, &update_i8k)
|
||||
END OBJ(i8k_ac_status, &update_i8k)
|
||||
END OBJ(i8k_buttons_status, &update_i8k)
|
||||
#if defined(IBM)
|
||||
END OBJ(ibm_fan, 0)
|
||||
END OBJ(ibm_temps, 0)
|
||||
@ -476,7 +471,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
/* information from sony_laptop kernel module
|
||||
* /sys/devices/platform/sony-laptop */
|
||||
END OBJ(sony_fanspeed, 0)
|
||||
END OBJ_IF(if_gw, CALLBACK(&update_gateway_info))
|
||||
END OBJ_IF(if_gw, &update_gateway_info)
|
||||
END OBJ(ioscheduler, 0)
|
||||
if (!arg) {
|
||||
CRIT_ERR(obj, free_at_crash, "get_ioscheduler needs an argument (e.g. hda)");
|
||||
@ -543,8 +538,8 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
END OBJ(obsd_vendor, 0)
|
||||
END OBJ(obsd_product, 0)
|
||||
#endif /* __OpenBSD__ */
|
||||
END OBJ(buffers, CALLBACK(&update_meminfo))
|
||||
END OBJ(cached, CALLBACK(&update_meminfo))
|
||||
END OBJ(buffers, &update_meminfo)
|
||||
END OBJ(cached, &update_meminfo)
|
||||
#define SCAN_CPU(__arg, __var) { \
|
||||
int __offset = 0; \
|
||||
if (__arg && sscanf(__arg, " cpu%u %n", &__var, &__offset) > 0) \
|
||||
@ -552,23 +547,23 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
else \
|
||||
__var = 0; \
|
||||
}
|
||||
END OBJ(cpu, CALLBACK(&update_cpu_usage))
|
||||
END OBJ(cpu, &update_cpu_usage)
|
||||
SCAN_CPU(arg, obj->data.cpu_index);
|
||||
DBGP2("Adding $cpu for CPU %d", obj->data.cpu_index);
|
||||
#ifdef X11
|
||||
END OBJ(cpugauge, CALLBACK(&update_cpu_usage))
|
||||
END OBJ(cpugauge, &update_cpu_usage)
|
||||
SIZE_DEFAULTS(gauge);
|
||||
SCAN_CPU(arg, obj->data.cpu_index);
|
||||
scan_gauge(arg, &obj->a, &obj->b);
|
||||
DBGP2("Adding $cpugauge for CPU %d", obj->data.cpu_index);
|
||||
#endif /* X11 */
|
||||
END OBJ(cpubar, CALLBACK(&update_cpu_usage))
|
||||
END OBJ(cpubar, &update_cpu_usage)
|
||||
SIZE_DEFAULTS(bar);
|
||||
SCAN_CPU(arg, obj->data.cpu_index);
|
||||
scan_bar(arg, &obj->a, &obj->b);
|
||||
DBGP2("Adding $cpubar for CPU %d", obj->data.cpu_index);
|
||||
#ifdef X11
|
||||
END OBJ(cpugraph, CALLBACK(&update_cpu_usage))
|
||||
END OBJ(cpugraph, &update_cpu_usage)
|
||||
char *buf = 0;
|
||||
SIZE_DEFAULTS(graph);
|
||||
SCAN_CPU(arg, obj->data.cpu_index);
|
||||
@ -576,7 +571,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
&obj->e, &obj->char_a, &obj->char_b);
|
||||
DBGP2("Adding $cpugraph for CPU %d", obj->data.cpu_index);
|
||||
if (buf) free(buf);
|
||||
END OBJ(loadgraph, CALLBACK(&update_load_average))
|
||||
END OBJ(loadgraph, &update_load_average)
|
||||
char *buf = 0;
|
||||
SIZE_DEFAULTS(graph);
|
||||
buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
@ -590,14 +585,14 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
free(buf);
|
||||
}
|
||||
#endif /* X11 */
|
||||
END OBJ(diskio, CALLBACK(&update_diskio))
|
||||
END OBJ(diskio, &update_diskio)
|
||||
obj->data.diskio = prepare_diskio_stat(dev_name(arg));
|
||||
END OBJ(diskio_read, CALLBACK(&update_diskio))
|
||||
END OBJ(diskio_read, &update_diskio)
|
||||
obj->data.diskio = prepare_diskio_stat(dev_name(arg));
|
||||
END OBJ(diskio_write, CALLBACK(&update_diskio))
|
||||
END OBJ(diskio_write, &update_diskio)
|
||||
obj->data.diskio = prepare_diskio_stat(dev_name(arg));
|
||||
#ifdef X11
|
||||
END OBJ(diskiograph, CALLBACK(&update_diskio))
|
||||
END OBJ(diskiograph, &update_diskio)
|
||||
char *buf = 0;
|
||||
SIZE_DEFAULTS(graph);
|
||||
buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
@ -605,7 +600,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
|
||||
obj->data.diskio = prepare_diskio_stat(dev_name(buf));
|
||||
if (buf) free(buf);
|
||||
END OBJ(diskiograph_read, CALLBACK(&update_diskio))
|
||||
END OBJ(diskiograph_read, &update_diskio)
|
||||
char *buf = 0;
|
||||
SIZE_DEFAULTS(graph);
|
||||
buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
@ -613,7 +608,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
|
||||
obj->data.diskio = prepare_diskio_stat(dev_name(buf));
|
||||
if (buf) free(buf);
|
||||
END OBJ(diskiograph_write, CALLBACK(&update_diskio))
|
||||
END OBJ(diskiograph_write, &update_diskio)
|
||||
char *buf = 0;
|
||||
SIZE_DEFAULTS(graph);
|
||||
buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
@ -690,7 +685,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
END OBJ(conky_version, 0)
|
||||
END OBJ(conky_build_date, 0)
|
||||
END OBJ(conky_build_arch, 0)
|
||||
END OBJ(downspeed, CALLBACK(&update_net_stats))
|
||||
END OBJ(downspeed, &update_net_stats)
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg, obj, free_at_crash);
|
||||
} else {
|
||||
@ -699,7 +694,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->data.net = get_net_stat(buf, obj, free_at_crash);
|
||||
free(buf);
|
||||
}
|
||||
END OBJ(downspeedf, CALLBACK(&update_net_stats))
|
||||
END OBJ(downspeedf, &update_net_stats)
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg, obj, free_at_crash);
|
||||
} else {
|
||||
@ -709,7 +704,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
free(buf);
|
||||
}
|
||||
#ifdef X11
|
||||
END OBJ(downspeedgraph, CALLBACK(&update_net_stats))
|
||||
END OBJ(downspeedgraph, &update_net_stats)
|
||||
char *buf = 0;
|
||||
SIZE_DEFAULTS(graph);
|
||||
buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
@ -840,7 +835,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
} else {
|
||||
obj->data.s = strndup("", text_buffer_size);
|
||||
}
|
||||
END OBJ(fs_bar, CALLBACK(&update_fs_stats))
|
||||
END OBJ(fs_bar, &update_fs_stats)
|
||||
SIZE_DEFAULTS(bar);
|
||||
arg = scan_bar(arg, &obj->data.fsbar.w, &obj->data.fsbar.h);
|
||||
if (arg) {
|
||||
@ -854,7 +849,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
arg = "/";
|
||||
}
|
||||
obj->data.fsbar.fs = prepare_fs_stat(arg);
|
||||
END OBJ(fs_bar_free, CALLBACK(&update_fs_stats))
|
||||
END OBJ(fs_bar_free, &update_fs_stats)
|
||||
SIZE_DEFAULTS(bar);
|
||||
arg = scan_bar(arg, &obj->data.fsbar.w, &obj->data.fsbar.h);
|
||||
if (arg) {
|
||||
@ -869,39 +864,39 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
}
|
||||
|
||||
obj->data.fsbar.fs = prepare_fs_stat(arg);
|
||||
END OBJ(fs_free, CALLBACK(&update_fs_stats))
|
||||
END OBJ(fs_free, &update_fs_stats)
|
||||
if (!arg) {
|
||||
arg = "/";
|
||||
}
|
||||
obj->data.fs = prepare_fs_stat(arg);
|
||||
END OBJ(fs_used_perc, CALLBACK(&update_fs_stats))
|
||||
END OBJ(fs_used_perc, &update_fs_stats)
|
||||
if (!arg) {
|
||||
arg = "/";
|
||||
}
|
||||
obj->data.fs = prepare_fs_stat(arg);
|
||||
END OBJ(fs_free_perc, CALLBACK(&update_fs_stats))
|
||||
END OBJ(fs_free_perc, &update_fs_stats)
|
||||
if (!arg) {
|
||||
arg = "/";
|
||||
}
|
||||
obj->data.fs = prepare_fs_stat(arg);
|
||||
END OBJ(fs_size, CALLBACK(&update_fs_stats))
|
||||
END OBJ(fs_size, &update_fs_stats)
|
||||
if (!arg) {
|
||||
arg = "/";
|
||||
}
|
||||
obj->data.fs = prepare_fs_stat(arg);
|
||||
END OBJ(fs_type, CALLBACK(&update_fs_stats))
|
||||
END OBJ(fs_type, &update_fs_stats)
|
||||
if (!arg) {
|
||||
arg = "/";
|
||||
}
|
||||
obj->data.fs = prepare_fs_stat(arg);
|
||||
END OBJ(fs_used, CALLBACK(&update_fs_stats))
|
||||
END OBJ(fs_used, &update_fs_stats)
|
||||
if (!arg) {
|
||||
arg = "/";
|
||||
}
|
||||
obj->data.fs = prepare_fs_stat(arg);
|
||||
END OBJ(hr, 0)
|
||||
obj->data.i = arg ? atoi(arg) : 1;
|
||||
END OBJ(nameserver, CALLBACK(&update_dns_data))
|
||||
END OBJ(nameserver, &update_dns_data)
|
||||
obj->data.i = arg ? atoi(arg) : 0;
|
||||
END OBJ(offset, 0)
|
||||
obj->data.i = arg ? atoi(arg) : 1;
|
||||
@ -1036,7 +1031,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
if (!parse_top_args(s, arg, obj)) {
|
||||
return NULL;
|
||||
}
|
||||
} else OBJ(addr, CALLBACK(&update_net_stats))
|
||||
} else OBJ(addr, &update_net_stats)
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg, obj, free_at_crash);
|
||||
} else {
|
||||
@ -1046,7 +1041,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
free(buf);
|
||||
}
|
||||
#if defined(__linux__)
|
||||
END OBJ(addrs, CALLBACK(&update_net_stats))
|
||||
END OBJ(addrs, &update_net_stats)
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg, obj, free_at_crash);
|
||||
} else {
|
||||
@ -1072,7 +1067,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
}else{
|
||||
CRIT_ERR(obj, free_at_crash, "words needs a argument");
|
||||
}
|
||||
END OBJ(loadavg, CALLBACK(&update_load_average))
|
||||
END OBJ(loadavg, &update_load_average)
|
||||
int a = 1, b = 2, c = 3, r = 3;
|
||||
|
||||
if (arg) {
|
||||
@ -1136,7 +1131,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->data.ifblock.s = strndup(arg, text_buffer_size);
|
||||
}
|
||||
#ifdef __linux__
|
||||
END OBJ_IF(if_running, CALLBACK(&update_top))
|
||||
END OBJ_IF(if_running, &update_top)
|
||||
if (arg) {
|
||||
top_running = 1;
|
||||
obj->data.ifblock.s = strndup(arg, text_buffer_size);
|
||||
@ -1369,21 +1364,21 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
/* if '1' (in mboxscan.c) then there was SIGUSR1, hmm */
|
||||
obj->data.mboxscan.output[0] = 1;
|
||||
strncpy(obj->data.mboxscan.args, arg, text_buffer_size);
|
||||
END OBJ(mem, CALLBACK(&update_meminfo))
|
||||
END OBJ(memeasyfree, CALLBACK(&update_meminfo))
|
||||
END OBJ(memfree, CALLBACK(&update_meminfo))
|
||||
END OBJ(memmax, CALLBACK(&update_meminfo))
|
||||
END OBJ(memperc, CALLBACK(&update_meminfo))
|
||||
END OBJ(mem, &update_meminfo)
|
||||
END OBJ(memeasyfree, &update_meminfo)
|
||||
END OBJ(memfree, &update_meminfo)
|
||||
END OBJ(memmax, &update_meminfo)
|
||||
END OBJ(memperc, &update_meminfo)
|
||||
#ifdef X11
|
||||
END OBJ(memgauge, CALLBACK(&update_meminfo))
|
||||
END OBJ(memgauge, &update_meminfo)
|
||||
SIZE_DEFAULTS(gauge);
|
||||
scan_gauge(arg, &obj->data.pair.a, &obj->data.pair.b);
|
||||
#endif /* X11*/
|
||||
END OBJ(membar, CALLBACK(&update_meminfo))
|
||||
END OBJ(membar, &update_meminfo)
|
||||
SIZE_DEFAULTS(bar);
|
||||
scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
|
||||
#ifdef X11
|
||||
END OBJ(memgraph, CALLBACK(&update_meminfo))
|
||||
END OBJ(memgraph, &update_meminfo)
|
||||
char *buf = 0;
|
||||
SIZE_DEFAULTS(graph);
|
||||
buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
@ -1414,15 +1409,15 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
END OBJ_IF(if_mixer_mute, 0)
|
||||
obj->data.ifblock.i = mixer_init(arg);
|
||||
#ifdef X11
|
||||
END OBJ(monitor, CALLBACK(&update_x11info))
|
||||
END OBJ(monitor_number, CALLBACK(&update_x11info))
|
||||
END OBJ(desktop, CALLBACK(&update_x11info))
|
||||
END OBJ(desktop_number, CALLBACK(&update_x11info))
|
||||
END OBJ(desktop_name, CALLBACK(&update_x11info))
|
||||
END OBJ(monitor, &update_x11info)
|
||||
END OBJ(monitor_number, &update_x11info)
|
||||
END OBJ(desktop, &update_x11info)
|
||||
END OBJ(desktop_number, &update_x11info)
|
||||
END OBJ(desktop_name, &update_x11info)
|
||||
#endif
|
||||
END OBJ(nodename, 0)
|
||||
END OBJ(processes, CALLBACK(&update_total_processes))
|
||||
END OBJ(running_processes, CALLBACK(&update_running_processes))
|
||||
END OBJ(processes, &update_total_processes)
|
||||
END OBJ(running_processes, &update_running_processes)
|
||||
END OBJ(shadecolor, 0)
|
||||
#ifdef X11
|
||||
obj->data.l = arg ? get_x11_color(arg) : default_bg_color;
|
||||
@ -1446,11 +1441,11 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->data.pair.a = a;
|
||||
obj->data.pair.b = b;
|
||||
#endif /* X11 */
|
||||
END OBJ(swap, CALLBACK(&update_meminfo))
|
||||
END OBJ(swapfree, CALLBACK(&update_meminfo))
|
||||
END OBJ(swapmax, CALLBACK(&update_meminfo))
|
||||
END OBJ(swapperc, CALLBACK(&update_meminfo))
|
||||
END OBJ(swapbar, CALLBACK(&update_meminfo))
|
||||
END OBJ(swap, &update_meminfo)
|
||||
END OBJ(swapfree, &update_meminfo)
|
||||
END OBJ(swapmax, &update_meminfo)
|
||||
END OBJ(swapperc, &update_meminfo)
|
||||
END OBJ(swapbar, &update_meminfo)
|
||||
SIZE_DEFAULTS(bar);
|
||||
scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
|
||||
END OBJ(sysname, 0)
|
||||
@ -1505,7 +1500,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
set_iconv_converting(0);
|
||||
|
||||
#endif
|
||||
END OBJ(totaldown, CALLBACK(&update_net_stats))
|
||||
END OBJ(totaldown, &update_net_stats)
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg, obj, free_at_crash);
|
||||
} else {
|
||||
@ -1514,7 +1509,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->data.net = get_net_stat(buf, obj, free_at_crash);
|
||||
free(buf);
|
||||
}
|
||||
END OBJ(totalup, CALLBACK(&update_net_stats))
|
||||
END OBJ(totalup, &update_net_stats)
|
||||
obj->data.net = get_net_stat(arg, obj, free_at_crash);
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg, obj, free_at_crash);
|
||||
@ -1533,7 +1528,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->data.i = arg ? atoi(arg) : 0;
|
||||
END OBJ(alignc, 0)
|
||||
obj->data.i = arg ? atoi(arg) : 0;
|
||||
END OBJ(upspeed, CALLBACK(&update_net_stats))
|
||||
END OBJ(upspeed, &update_net_stats)
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg, obj, free_at_crash);
|
||||
} else {
|
||||
@ -1542,7 +1537,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->data.net = get_net_stat(buf, obj, free_at_crash);
|
||||
free(buf);
|
||||
}
|
||||
END OBJ(upspeedf, CALLBACK(&update_net_stats))
|
||||
END OBJ(upspeedf, &update_net_stats)
|
||||
if (arg) {
|
||||
obj->data.net = get_net_stat(arg, obj, free_at_crash);
|
||||
} else {
|
||||
@ -1553,7 +1548,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
}
|
||||
|
||||
#ifdef X11
|
||||
END OBJ(upspeedgraph, CALLBACK(&update_net_stats))
|
||||
END OBJ(upspeedgraph, &update_net_stats)
|
||||
char *buf = 0;
|
||||
SIZE_DEFAULTS(graph);
|
||||
buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
@ -1564,15 +1559,15 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->data.net = get_net_stat(buf, obj, free_at_crash);
|
||||
free(buf);
|
||||
#endif
|
||||
END OBJ(uptime_short, CALLBACK(&update_uptime))
|
||||
END OBJ(uptime, CALLBACK(&update_uptime))
|
||||
END OBJ(user_names, CALLBACK(&update_users))
|
||||
END OBJ(user_times, CALLBACK(&update_users))
|
||||
END OBJ(user_terms, CALLBACK(&update_users))
|
||||
END OBJ(user_number, CALLBACK(&update_users))
|
||||
END OBJ(uptime_short, &update_uptime)
|
||||
END OBJ(uptime, &update_uptime)
|
||||
END OBJ(user_names, &update_users)
|
||||
END OBJ(user_times, &update_users)
|
||||
END OBJ(user_terms, &update_users)
|
||||
END OBJ(user_number, &update_users)
|
||||
#if defined(__linux__)
|
||||
END OBJ(gw_iface, CALLBACK(&update_gateway_info))
|
||||
END OBJ(gw_ip, CALLBACK(&update_gateway_info))
|
||||
END OBJ(gw_iface, &update_gateway_info)
|
||||
END OBJ(gw_ip, &update_gateway_info)
|
||||
#endif /* !__linux__ */
|
||||
#ifndef __OpenBSD__
|
||||
END OBJ(adt746xcpu, 0)
|
||||
@ -1669,85 +1664,85 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
else \
|
||||
NORM_ERR(#name ": invalid length argument"); \
|
||||
}
|
||||
END OBJ(mpd_artist, CALLBACK(&update_mpd))
|
||||
END OBJ(mpd_artist, &update_mpd)
|
||||
mpd_set_maxlen(mpd_artist);
|
||||
init_mpd();
|
||||
END OBJ(mpd_title, CALLBACK(&update_mpd))
|
||||
END OBJ(mpd_title, &update_mpd)
|
||||
mpd_set_maxlen(mpd_title);
|
||||
init_mpd();
|
||||
END OBJ(mpd_random, CALLBACK(&update_mpd)) init_mpd();
|
||||
END OBJ(mpd_repeat, CALLBACK(&update_mpd)) init_mpd();
|
||||
END OBJ(mpd_elapsed, CALLBACK(&update_mpd)) init_mpd();
|
||||
END OBJ(mpd_length, CALLBACK(&update_mpd)) init_mpd();
|
||||
END OBJ(mpd_track, CALLBACK(&update_mpd))
|
||||
END OBJ(mpd_random, &update_mpd) init_mpd();
|
||||
END OBJ(mpd_repeat, &update_mpd) init_mpd();
|
||||
END OBJ(mpd_elapsed, &update_mpd) init_mpd();
|
||||
END OBJ(mpd_length, &update_mpd) init_mpd();
|
||||
END OBJ(mpd_track, &update_mpd)
|
||||
mpd_set_maxlen(mpd_track);
|
||||
init_mpd();
|
||||
END OBJ(mpd_name, CALLBACK(&update_mpd))
|
||||
END OBJ(mpd_name, &update_mpd)
|
||||
mpd_set_maxlen(mpd_name);
|
||||
init_mpd();
|
||||
END OBJ(mpd_file, CALLBACK(&update_mpd))
|
||||
END OBJ(mpd_file, &update_mpd)
|
||||
mpd_set_maxlen(mpd_file);
|
||||
init_mpd();
|
||||
END OBJ(mpd_percent, CALLBACK(&update_mpd)) init_mpd();
|
||||
END OBJ(mpd_album, CALLBACK(&update_mpd))
|
||||
END OBJ(mpd_percent, &update_mpd) init_mpd();
|
||||
END OBJ(mpd_album, &update_mpd)
|
||||
mpd_set_maxlen(mpd_album);
|
||||
init_mpd();
|
||||
END OBJ(mpd_vol, CALLBACK(&update_mpd)) init_mpd();
|
||||
END OBJ(mpd_bitrate, CALLBACK(&update_mpd)) init_mpd();
|
||||
END OBJ(mpd_status, CALLBACK(&update_mpd)) init_mpd();
|
||||
END OBJ(mpd_bar, CALLBACK(&update_mpd))
|
||||
END OBJ(mpd_vol, &update_mpd) init_mpd();
|
||||
END OBJ(mpd_bitrate, &update_mpd) init_mpd();
|
||||
END OBJ(mpd_status, &update_mpd) init_mpd();
|
||||
END OBJ(mpd_bar, &update_mpd)
|
||||
SIZE_DEFAULTS(bar);
|
||||
scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
|
||||
init_mpd();
|
||||
END OBJ(mpd_smart, CALLBACK(&update_mpd))
|
||||
END OBJ(mpd_smart, &update_mpd)
|
||||
mpd_set_maxlen(mpd_smart);
|
||||
init_mpd();
|
||||
END OBJ_IF(if_mpd_playing, CALLBACK(&update_mpd))
|
||||
END OBJ_IF(if_mpd_playing, &update_mpd)
|
||||
init_mpd();
|
||||
#undef mpd_set_maxlen
|
||||
#endif /* MPD */
|
||||
#ifdef MOC
|
||||
END OBJ(moc_state, CALLBACK(&update_moc))
|
||||
END OBJ(moc_file, CALLBACK(&update_moc))
|
||||
END OBJ(moc_title, CALLBACK(&update_moc))
|
||||
END OBJ(moc_artist, CALLBACK(&update_moc))
|
||||
END OBJ(moc_song, CALLBACK(&update_moc))
|
||||
END OBJ(moc_album, CALLBACK(&update_moc))
|
||||
END OBJ(moc_totaltime, CALLBACK(&update_moc))
|
||||
END OBJ(moc_timeleft, CALLBACK(&update_moc))
|
||||
END OBJ(moc_curtime, CALLBACK(&update_moc))
|
||||
END OBJ(moc_bitrate, CALLBACK(&update_moc))
|
||||
END OBJ(moc_rate, CALLBACK(&update_moc))
|
||||
END OBJ(moc_state, &update_moc)
|
||||
END OBJ(moc_file, &update_moc)
|
||||
END OBJ(moc_title, &update_moc)
|
||||
END OBJ(moc_artist, &update_moc)
|
||||
END OBJ(moc_song, &update_moc)
|
||||
END OBJ(moc_album, &update_moc)
|
||||
END OBJ(moc_totaltime, &update_moc)
|
||||
END OBJ(moc_timeleft, &update_moc)
|
||||
END OBJ(moc_curtime, &update_moc)
|
||||
END OBJ(moc_bitrate, &update_moc)
|
||||
END OBJ(moc_rate, &update_moc)
|
||||
#endif /* MOC */
|
||||
#ifdef XMMS2
|
||||
END OBJ(xmms2_artist, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_album, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_title, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_genre, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_comment, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_url, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_tracknr, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_bitrate, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_date, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_id, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_duration, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_elapsed, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_size, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_status, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_percent, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_artist, &update_xmms2)
|
||||
END OBJ(xmms2_album, &update_xmms2)
|
||||
END OBJ(xmms2_title, &update_xmms2)
|
||||
END OBJ(xmms2_genre, &update_xmms2)
|
||||
END OBJ(xmms2_comment, &update_xmms2)
|
||||
END OBJ(xmms2_url, &update_xmms2)
|
||||
END OBJ(xmms2_tracknr, &update_xmms2)
|
||||
END OBJ(xmms2_bitrate, &update_xmms2)
|
||||
END OBJ(xmms2_date, &update_xmms2)
|
||||
END OBJ(xmms2_id, &update_xmms2)
|
||||
END OBJ(xmms2_duration, &update_xmms2)
|
||||
END OBJ(xmms2_elapsed, &update_xmms2)
|
||||
END OBJ(xmms2_size, &update_xmms2)
|
||||
END OBJ(xmms2_status, &update_xmms2)
|
||||
END OBJ(xmms2_percent, &update_xmms2)
|
||||
#ifdef X11
|
||||
END OBJ(xmms2_bar, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_bar, &update_xmms2)
|
||||
SIZE_DEFAULTS(bar);
|
||||
scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
|
||||
#endif /* X11 */
|
||||
END OBJ(xmms2_smart, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_playlist, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_timesplayed, CALLBACK(&update_xmms2))
|
||||
END OBJ_IF(if_xmms2_connected, CALLBACK(&update_xmms2))
|
||||
END OBJ(xmms2_smart, &update_xmms2)
|
||||
END OBJ(xmms2_playlist, &update_xmms2)
|
||||
END OBJ(xmms2_timesplayed, &update_xmms2)
|
||||
END OBJ_IF(if_xmms2_connected, &update_xmms2)
|
||||
#endif
|
||||
#ifdef AUDACIOUS
|
||||
END OBJ(audacious_status, CALLBACK(&update_audacious))
|
||||
END OBJ(audacious_title, CALLBACK(&update_audacious))
|
||||
END OBJ(audacious_status, &update_audacious)
|
||||
END OBJ(audacious_title, &update_audacious)
|
||||
if (arg) {
|
||||
sscanf(arg, "%d", &info.audacious.max_title_len);
|
||||
if (info.audacious.max_title_len > 0) {
|
||||
@ -1756,35 +1751,35 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
CRIT_ERR(obj, free_at_crash, "audacious_title: invalid length argument");
|
||||
}
|
||||
}
|
||||
END OBJ(audacious_length, CALLBACK(&update_audacious))
|
||||
END OBJ(audacious_length_seconds, CALLBACK(&update_audacious))
|
||||
END OBJ(audacious_position, CALLBACK(&update_audacious))
|
||||
END OBJ(audacious_position_seconds, CALLBACK(&update_audacious))
|
||||
END OBJ(audacious_bitrate, CALLBACK(&update_audacious))
|
||||
END OBJ(audacious_frequency, CALLBACK(&update_audacious))
|
||||
END OBJ(audacious_channels, CALLBACK(&update_audacious))
|
||||
END OBJ(audacious_filename, CALLBACK(&update_audacious))
|
||||
END OBJ(audacious_playlist_length, CALLBACK(&update_audacious))
|
||||
END OBJ(audacious_playlist_position, CALLBACK(&update_audacious))
|
||||
END OBJ(audacious_main_volume, CALLBACK(&update_audacious))
|
||||
END OBJ(audacious_length, &update_audacious)
|
||||
END OBJ(audacious_length_seconds, &update_audacious)
|
||||
END OBJ(audacious_position, &update_audacious)
|
||||
END OBJ(audacious_position_seconds, &update_audacious)
|
||||
END OBJ(audacious_bitrate, &update_audacious)
|
||||
END OBJ(audacious_frequency, &update_audacious)
|
||||
END OBJ(audacious_channels, &update_audacious)
|
||||
END OBJ(audacious_filename, &update_audacious)
|
||||
END OBJ(audacious_playlist_length, &update_audacious)
|
||||
END OBJ(audacious_playlist_position, &update_audacious)
|
||||
END OBJ(audacious_main_volume, &update_audacious)
|
||||
#ifdef X11
|
||||
END OBJ(audacious_bar, CALLBACK(&update_audacious))
|
||||
END OBJ(audacious_bar, &update_audacious)
|
||||
SIZE_DEFAULTS(bar);
|
||||
scan_bar(arg, &obj->a, &obj->b);
|
||||
#endif /* X11 */
|
||||
#endif
|
||||
#ifdef BMPX
|
||||
END OBJ(bmpx_title, CALLBACK(&update_bmpx))
|
||||
END OBJ(bmpx_title, &update_bmpx)
|
||||
memset(&(info.bmpx), 0, sizeof(struct bmpx_s));
|
||||
END OBJ(bmpx_artist, CALLBACK(&update_bmpx))
|
||||
END OBJ(bmpx_artist, &update_bmpx)
|
||||
memset(&(info.bmpx), 0, sizeof(struct bmpx_s));
|
||||
END OBJ(bmpx_album, CALLBACK(&update_bmpx))
|
||||
END OBJ(bmpx_album, &update_bmpx)
|
||||
memset(&(info.bmpx), 0, sizeof(struct bmpx_s));
|
||||
END OBJ(bmpx_track, CALLBACK(&update_bmpx))
|
||||
END OBJ(bmpx_track, &update_bmpx)
|
||||
memset(&(info.bmpx), 0, sizeof(struct bmpx_s));
|
||||
END OBJ(bmpx_uri, CALLBACK(&update_bmpx))
|
||||
END OBJ(bmpx_uri, &update_bmpx)
|
||||
memset(&(info.bmpx), 0, sizeof(struct bmpx_s));
|
||||
END OBJ(bmpx_bitrate, CALLBACK(&update_bmpx))
|
||||
END OBJ(bmpx_bitrate, &update_bmpx)
|
||||
memset(&(info.bmpx), 0, sizeof(struct bmpx_s));
|
||||
#endif
|
||||
#ifdef EVE
|
||||
@ -1998,18 +1993,18 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
#endif /* X11 */
|
||||
#endif /* HAVE_LUA */
|
||||
#ifdef HDDTEMP
|
||||
END OBJ(hddtemp, CALLBACK(&update_hddtemp))
|
||||
END OBJ(hddtemp, &update_hddtemp)
|
||||
if (arg)
|
||||
obj->data.s = strndup(arg, text_buffer_size);
|
||||
#endif /* HDDTEMP */
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
END OBJ(tcp_portmon, CALLBACK(&tcp_portmon_update))
|
||||
END OBJ(tcp_portmon, &tcp_portmon_update)
|
||||
tcp_portmon_init(arg, &obj->data.tcp_port_monitor);
|
||||
#endif /* TCP_PORT_MONITOR */
|
||||
END OBJ(entropy_avail, CALLBACK(&update_entropy))
|
||||
END OBJ(entropy_perc, CALLBACK(&update_entropy))
|
||||
END OBJ(entropy_poolsize, CALLBACK(&update_entropy))
|
||||
END OBJ(entropy_bar, CALLBACK(&update_entropy))
|
||||
END OBJ(entropy_avail, &update_entropy)
|
||||
END OBJ(entropy_perc, &update_entropy)
|
||||
END OBJ(entropy_poolsize, &update_entropy)
|
||||
END OBJ(entropy_bar, &update_entropy)
|
||||
SIZE_DEFAULTS(bar);
|
||||
scan_bar(arg, &obj->a, &obj->b);
|
||||
END OBJ(include, 0)
|
||||
@ -2129,7 +2124,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
#endif /* NVIDIA */
|
||||
#ifdef APCUPSD
|
||||
init_apcupsd();
|
||||
END OBJ(apcupsd, CALLBACK(&update_apcupsd))
|
||||
END OBJ(apcupsd, &update_apcupsd)
|
||||
if (arg) {
|
||||
char host[64];
|
||||
int port;
|
||||
@ -2142,31 +2137,31 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
} else {
|
||||
CRIT_ERR(obj, free_at_crash, "apcupsd needs arguments: <host> <port>");
|
||||
}
|
||||
END OBJ(apcupsd_name, CALLBACK(&update_apcupsd))
|
||||
END OBJ(apcupsd_model, CALLBACK(&update_apcupsd))
|
||||
END OBJ(apcupsd_upsmode, CALLBACK(&update_apcupsd))
|
||||
END OBJ(apcupsd_cable, CALLBACK(&update_apcupsd))
|
||||
END OBJ(apcupsd_status, CALLBACK(&update_apcupsd))
|
||||
END OBJ(apcupsd_linev, CALLBACK(&update_apcupsd))
|
||||
END OBJ(apcupsd_load, CALLBACK(&update_apcupsd))
|
||||
END OBJ(apcupsd_loadbar, CALLBACK(&update_apcupsd))
|
||||
END OBJ(apcupsd_name, &update_apcupsd)
|
||||
END OBJ(apcupsd_model, &update_apcupsd)
|
||||
END OBJ(apcupsd_upsmode, &update_apcupsd)
|
||||
END OBJ(apcupsd_cable, &update_apcupsd)
|
||||
END OBJ(apcupsd_status, &update_apcupsd)
|
||||
END OBJ(apcupsd_linev, &update_apcupsd)
|
||||
END OBJ(apcupsd_load, &update_apcupsd)
|
||||
END OBJ(apcupsd_loadbar, &update_apcupsd)
|
||||
SIZE_DEFAULTS(bar);
|
||||
scan_bar(arg, &obj->a, &obj->b);
|
||||
#ifdef X11
|
||||
END OBJ(apcupsd_loadgraph, CALLBACK(&update_apcupsd))
|
||||
END OBJ(apcupsd_loadgraph, &update_apcupsd)
|
||||
char* buf = 0;
|
||||
SIZE_DEFAULTS(graph);
|
||||
buf = scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d,
|
||||
&obj->e, &obj->char_a, &obj->char_b);
|
||||
if (buf) free(buf);
|
||||
END OBJ(apcupsd_loadgauge, CALLBACK(&update_apcupsd))
|
||||
END OBJ(apcupsd_loadgauge, &update_apcupsd)
|
||||
SIZE_DEFAULTS(gauge);
|
||||
scan_gauge(arg, &obj->a, &obj->b);
|
||||
#endif /* X11 */
|
||||
END OBJ(apcupsd_charge, CALLBACK(&update_apcupsd))
|
||||
END OBJ(apcupsd_timeleft, CALLBACK(&update_apcupsd))
|
||||
END OBJ(apcupsd_temp, CALLBACK(&update_apcupsd))
|
||||
END OBJ(apcupsd_lastxfer, CALLBACK(&update_apcupsd))
|
||||
END OBJ(apcupsd_charge, &update_apcupsd)
|
||||
END OBJ(apcupsd_timeleft, &update_apcupsd)
|
||||
END OBJ(apcupsd_temp, &update_apcupsd)
|
||||
END OBJ(apcupsd_lastxfer, &update_apcupsd)
|
||||
#endif /* APCUPSD */
|
||||
END {
|
||||
char buf[256];
|
||||
|
Loading…
x
Reference in New Issue
Block a user