From 498894782976aa28440cda4f800bdcf495a7b1c3 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 23 Nov 2009 23:50:15 +0100 Subject: [PATCH] convert xmms2_bar to callbacks.barval --- src/core.c | 2 +- src/xmms2.c | 6 ++---- src/xmms2.h | 4 +--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/core.c b/src/core.c index 878bbaee..a7509b8e 100644 --- a/src/core.c +++ b/src/core.c @@ -1223,7 +1223,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long obj->callbacks.print = &print_xmms2_percent; END OBJ(xmms2_bar, &update_xmms2) scan_bar(obj, arg); - obj->callbacks.print = &print_xmms2_bar; + obj->callbacks.barval = &xmms2_barval; END OBJ(xmms2_smart, &update_xmms2) obj->callbacks.print = &print_xmms2_smart; END OBJ(xmms2_playlist, &update_xmms2) diff --git a/src/xmms2.c b/src/xmms2.c index d11d8566..e4191bbf 100644 --- a/src/xmms2.c +++ b/src/xmms2.c @@ -343,13 +343,11 @@ void print_xmms2_duration(struct text_object *obj, char *p, int p_max_size) (info.xmms2.duration / 1000) % 60); } -void print_xmms2_bar(struct text_object *obj, char *p, int p_max_size) +uint8_t xmms2_barval(struct text_object *obj) { (void)obj; - if (!p_max_size) - return; - new_bar(obj, p, p_max_size, (int) (info.xmms2.progress * 255.0f)); + return round_to_int(info.xmms2.progress * 255.0f); } void print_xmms2_smart(struct text_object *obj, char *p, int p_max_size) diff --git a/src/xmms2.h b/src/xmms2.h index dbd87a6c..2474ea22 100644 --- a/src/xmms2.h +++ b/src/xmms2.h @@ -58,9 +58,7 @@ void update_xmms2(void); void print_xmms2_tracknr(struct text_object *, char *, int); void print_xmms2_elapsed(struct text_object *, char *, int); void print_xmms2_duration(struct text_object *, char *, int); -#ifdef X11 -void print_xmms2_bar(struct text_object *, char *, int); -#endif /* X11 */ +uint8_t xmms2_barval(struct text_object *); void print_xmms2_smart(struct text_object *, char *, int); void print_xmms2_artist(struct text_object *, char *, int); void print_xmms2_album(struct text_object *, char *, int);