From c00e7b0a42c03a261dab38bcc89b8bd0adf7b394 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sat, 2 Jan 2010 11:50:53 -0800 Subject: [PATCH] Fixes $xmms2_percent and a couple other build fixes. Signed-off-by: Brenden Matthews --- src/xmms2.c | 6 ++++-- src/xmms2.h | 12 +++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/xmms2.c b/src/xmms2.c index 443fb8d9..d7a7428b 100644 --- a/src/xmms2.c +++ b/src/xmms2.c @@ -208,6 +208,7 @@ int handle_playtime(xmmsv_t *value, void *p) if (xmmsv_get_int(value, &play_time)) { ptr->xmms2.elapsed = play_time; ptr->xmms2.progress = (float) play_time / ptr->xmms2.duration; + ptr->xmms2.percent = (int)(ptr->xmms2.progress*100); } return TRUE; @@ -276,7 +277,7 @@ void update_xmms2(void) if (current_info->xmms2.conn_state == CONN_INIT) { if (xmms2_conn == NULL) { - xmms2_conn = xmmsc_init(PACKAGE); + xmms2_conn = xmmsc_init(PACKAGE_NAME); } /* did init fail? */ @@ -398,10 +399,11 @@ XMMS2_PRINT_GENERATOR(id, "%u") XMMS2_PRINT_GENERATOR(size, "%2.1f") XMMS2_PRINT_GENERATOR(playlist, "%s") XMMS2_PRINT_GENERATOR(timesplayed, "%i") +XMMS2_PRINT_GENERATOR(percent, "%i") #undef XMMS2_PRINT_GENERATOR -int check_xmms2_connected(struct text_object *obj) +int if_xmms2_connected(struct text_object *obj) { (void)obj; diff --git a/src/xmms2.h b/src/xmms2.h index 0d0130be..d6f15ad5 100644 --- a/src/xmms2.h +++ b/src/xmms2.h @@ -31,6 +31,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + struct xmms2_s { char *artist; char *album; @@ -49,6 +53,7 @@ struct xmms2_s { float size; float progress; + int percent; char *status; int conn_state; }; @@ -73,8 +78,13 @@ void print_xmms2_id(struct text_object *, char *, int); void print_xmms2_size(struct text_object *, char *, int); void print_xmms2_playlist(struct text_object *, char *, int); void print_xmms2_timesplayed(struct text_object *, char *, int); -int check_xmms2_connected(struct text_object *); +void print_xmms2_percent(struct text_object *, char *, int); +int if_xmms2_connected(struct text_object *); void free_xmms2(struct text_object *); +#ifdef __cplusplus +} +#endif + #endif /*XMMS2_H_*/