From 41f32f87662b3ee17e94ec0dd97e97320f3e4829 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 16 Nov 2009 23:37:01 +0100 Subject: [PATCH] if_mpd_playing: convert to callbacks.iftest --- src/conky.c | 8 -------- src/core.c | 1 + src/mpd.c | 6 ++++++ src/mpd.h | 1 + 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/conky.c b/src/conky.c index 939e4df0..4a43df1f 100644 --- a/src/conky.c +++ b/src/conky.c @@ -1450,14 +1450,6 @@ void generate_text_internal(char *p, int p_max_size, } #endif /* __FreeBSD__ __OpenBSD__ */ -#ifdef MPD - OBJ(if_mpd_playing) { - if (!mpd_get_info()->is_playing) { - DO_JUMP; - } - } -#endif - #ifdef XMMS2 OBJ(if_xmms2_connected) { if (cur->xmms2.conn_state != 1) { diff --git a/src/core.c b/src/core.c index 3e5492ca..c27381f3 100644 --- a/src/core.c +++ b/src/core.c @@ -1145,6 +1145,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long obj->callbacks.print = &print_mpd_smart; END OBJ_IF(if_mpd_playing, &update_mpd) init_mpd(); + obj->callbacks.iftest = &check_mpd_playing; #undef mpd_set_maxlen #endif /* MPD */ #ifdef MOC diff --git a/src/mpd.c b/src/mpd.c index 5777ca3c..9f51188a 100644 --- a/src/mpd.c +++ b/src/mpd.c @@ -393,6 +393,12 @@ void print_mpd_smart(struct text_object *obj, char *p, int p_max_size) } } +int check_mpd_playing(struct text_object *obj) +{ + (void)obj; + return mpd_get_info()->is_playing; +} + #define MPD_PRINT_GENERATOR(name, fmt) \ void print_mpd_##name(struct text_object *obj, char *p, int p_max_size) \ { \ diff --git a/src/mpd.h b/src/mpd.h index 94d0d290..9a8190c4 100644 --- a/src/mpd.h +++ b/src/mpd.h @@ -49,5 +49,6 @@ void print_mpd_file(struct text_object *, char *, int); void print_mpd_vol(struct text_object *, char *, int); void print_mpd_bitrate(struct text_object *, char *, int); void print_mpd_status(struct text_object *, char *, int); +int check_mpd_playing(struct text_object *); #endif /*MPD_H_*/