From b78664d8c5528dbd1816966a48281423bcf0ffae Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 23 Nov 2009 23:22:50 +0100 Subject: [PATCH] merge audacious_bar to callbacks.barval --- src/audacious.c | 14 +++++--------- src/audacious.h | 2 +- src/core.c | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/audacious.c b/src/audacious.c index 8a33eac9..9e881db3 100644 --- a/src/audacious.c +++ b/src/audacious.c @@ -262,17 +262,13 @@ void print_audacious_title(struct text_object *obj, char *p, int p_max_size) info.audacious.items[AUDACIOUS_TITLE]); } -void print_audacious_bar(struct text_object *obj, char *p, int p_max_size) +uint8_t audacious_barval(struct text_object *obj) { - double progress; + (void)obj; - if (!p_max_size) - return; - - progress = - atof(info.audacious.items[AUDACIOUS_POSITION_SECONDS]) / - atof(info.audacious.items[AUDACIOUS_LENGTH_SECONDS]); - new_bar(obj, p, p_max_size, (int) (progress * 255.0f)); + return round_to_int( + atof(info.audacious.items[AUDACIOUS_POSITION_SECONDS]) * 255.0 / + atof(info.audacious.items[AUDACIOUS_LENGTH_SECONDS])); } #define AUDACIOUS_PRINT_GENERATOR(name, idx) \ diff --git a/src/audacious.h b/src/audacious.h index 22cca378..f53eae4a 100644 --- a/src/audacious.h +++ b/src/audacious.h @@ -78,6 +78,6 @@ void print_audacious_filename(struct text_object *, char *, int); void print_audacious_playlist_length(struct text_object *, char *, int); void print_audacious_playlist_position(struct text_object *, char *, int); void print_audacious_main_volume(struct text_object *, char *, int); -void print_audacious_bar(struct text_object *, char *, int); +uint8_t audacious_barval(struct text_object *); #endif diff --git a/src/core.c b/src/core.c index 0049ab90..4b77a829 100644 --- a/src/core.c +++ b/src/core.c @@ -1268,7 +1268,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long obj->callbacks.print = &print_audacious_main_volume; END OBJ(audacious_bar, &update_audacious) scan_bar(obj, arg); - obj->callbacks.print = &print_audacious_bar; + obj->callbacks.barval = &audacious_barval; #endif /* AUDACIOUS */ #ifdef BMPX END OBJ(bmpx_title, &update_bmpx)