From bb70c21c363ad9d44f28beebab2e7d6f55ead085 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 16 Nov 2009 22:54:30 +0100 Subject: [PATCH] nvidia: convert to callbacks.print --- src/conky.c | 5 ----- src/core.c | 1 + src/nvidia.c | 5 +++-- src/nvidia.h | 5 +---- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/conky.c b/src/conky.c index 4793ee73..11717cd5 100644 --- a/src/conky.c +++ b/src/conky.c @@ -1550,11 +1550,6 @@ void generate_text_internal(char *p, int p_max_size, } snprintf(p, p_max_size, "%s", buf); } -#ifdef NVIDIA - OBJ(nvidia) { - print_nvidia_value(obj, display, p, p_max_size); - } -#endif /* NVIDIA */ break; } #undef DO_JUMP diff --git a/src/core.c b/src/core.c index d0eab024..ccb8c1f6 100644 --- a/src/core.c +++ b/src/core.c @@ -1401,6 +1401,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long CRIT_ERR(obj, free_at_crash, "nvidia: invalid argument" " specified: '%s'\n", arg); } + obj->callbacks.print = &print_nvidia_value; obj->callbacks.free = &free_nvidia; #endif /* NVIDIA */ #ifdef APCUPSD diff --git a/src/nvidia.c b/src/nvidia.c index b0c299f7..b037dc1f 100644 --- a/src/nvidia.c +++ b/src/nvidia.c @@ -32,6 +32,7 @@ #include "logging.h" #include "nvidia.h" #include "temphelper.h" +#include "x11.h" #include const int nvidia_query_to_attr[] = {NV_CTRL_GPU_CORE_TEMPERATURE, @@ -105,13 +106,13 @@ int set_nvidia_type(struct text_object *obj, const char *arg) return 0; } -void print_nvidia_value(struct text_object *obj, Display *dpy, char *p, int p_max_size) +void print_nvidia_value(struct text_object *obj, char *p, int p_max_size) { int value; struct nvidia_s *nvs = obj->data.opaque; if (!nvs || - (value = get_nvidia_value(nvs->type, dpy)) == -1) { + (value = get_nvidia_value(nvs->type, display)) == -1) { snprintf(p, p_max_size, "N/A"); return; } diff --git a/src/nvidia.h b/src/nvidia.h index 6be42547..b04b7d25 100644 --- a/src/nvidia.h +++ b/src/nvidia.h @@ -31,11 +31,8 @@ #ifndef NVIDIA_CONKY_H #define NVIDIA_CONKY_H -#include "text_object.h" -#include - int set_nvidia_type(struct text_object *, const char *); -void print_nvidia_value(struct text_object *, Display *, char *, int); +void print_nvidia_value(struct text_object *, char *, int); void free_nvidia(struct text_object *); #endif