1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-18 11:05:18 +00:00

convert mpd_bar to callbacks.barval

This commit is contained in:
Phil Sutter 2009-11-23 23:45:08 +01:00
parent f79c58ef47
commit fcd3d58960
3 changed files with 5 additions and 4 deletions

View File

@ -1145,7 +1145,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
END OBJ(mpd_bar, &update_mpd) END OBJ(mpd_bar, &update_mpd)
scan_bar(obj, arg); scan_bar(obj, arg);
init_mpd(); init_mpd();
obj->callbacks.print = &print_mpd_bar; obj->callbacks.barval = &mpd_barval;
END OBJ(mpd_smart, &update_mpd) END OBJ(mpd_smart, &update_mpd)
mpd_set_maxlen(mpd_smart); mpd_set_maxlen(mpd_smart);
init_mpd(); init_mpd();

View File

@ -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)); 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) void print_mpd_smart(struct text_object *obj, char *p, int p_max_size)

View File

@ -17,7 +17,7 @@ void update_mpd(void);
void print_mpd_elapsed(struct text_object *, char *, int); void print_mpd_elapsed(struct text_object *, char *, int);
void print_mpd_length(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_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_smart(struct text_object *, char *, int);
void print_mpd_title(struct text_object *, char *, int); void print_mpd_title(struct text_object *, char *, int);
void print_mpd_artist(struct text_object *, char *, int); void print_mpd_artist(struct text_object *, char *, int);