From fcd3d58960a9ed74dde2326175952b34f324707e Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 23 Nov 2009 23:45:08 +0100 Subject: [PATCH] convert mpd_bar to callbacks.barval --- src/core.c | 2 +- src/mpd.c | 5 +++-- src/mpd.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core.c b/src/core.c index 0faee086..e81be898 100644 --- a/src/core.c +++ b/src/core.c @@ -1145,7 +1145,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long END OBJ(mpd_bar, &update_mpd) scan_bar(obj, arg); init_mpd(); - obj->callbacks.print = &print_mpd_bar; + obj->callbacks.barval = &mpd_barval; END OBJ(mpd_smart, &update_mpd) mpd_set_maxlen(mpd_smart); init_mpd(); diff --git a/src/mpd.c b/src/mpd.c index 248a9e19..f02f5a39 100644 --- a/src/mpd.c +++ b/src/mpd.c @@ -376,9 +376,10 @@ void print_mpd_percent(struct text_object *obj, char *p, int p_max_size) percent_print(p, p_max_size, (int)(mpd_info.progress * 100)); } -void print_mpd_bar(struct text_object *obj, char *p, int p_max_size) +uint8_t mpd_barval(struct text_object *obj) { - new_bar(obj, p, p_max_size, (int) (mpd_info.progress * 255.0f)); + (void)obj; + return round_to_int(mpd_info.progress * 255.0f); } void print_mpd_smart(struct text_object *obj, char *p, int p_max_size) diff --git a/src/mpd.h b/src/mpd.h index 96b9b40e..6721b2de 100644 --- a/src/mpd.h +++ b/src/mpd.h @@ -17,7 +17,7 @@ void update_mpd(void); void print_mpd_elapsed(struct text_object *, char *, int); void print_mpd_length(struct text_object *, char *, int); void print_mpd_percent(struct text_object *, char *, int); -void print_mpd_bar(struct text_object *, char *, int); +uint8_t mpd_barval(struct text_object *); void print_mpd_smart(struct text_object *, char *, int); void print_mpd_title(struct text_object *, char *, int); void print_mpd_artist(struct text_object *, char *, int);