From d8f523936094f7de38b6333e7155b9934fea8344 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Sun, 13 Jun 2010 19:10:59 +0200 Subject: [PATCH] Small build fix & zero playtime and progress bars when XMMS2 playback is stopped. patch contributed by sleipner --- src/xmms2.c | 8 +++++--- src/xmms2.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/xmms2.c b/src/xmms2.c index 3dde9aa8..521bffa6 100644 --- a/src/xmms2.c +++ b/src/xmms2.c @@ -223,6 +223,7 @@ int handle_playback_state_change(xmmsv_t *value, void *p) break; case XMMS_PLAYBACK_STATUS_STOP: strncpy(ptr->xmms2.status, "Stopped", text_buffer_size - 1); + ptr->xmms2.elapsed = ptr->xmms2.progress = ptr->xmms2.percent = 0; break; default: strncpy(ptr->xmms2.status, "Unknown", text_buffer_size - 1); @@ -252,7 +253,7 @@ int handle_playlist_loaded(xmmsv_t *value, void *p) return TRUE; } -void update_xmms2(void) +int update_xmms2(void) { struct information *current_info = &info; @@ -266,7 +267,7 @@ void update_xmms2(void) /* did init fail? */ if (xmms2_conn == NULL) { fprintf(stderr,"XMMS2 init failed. %s\n", xmmsc_get_last_error(xmms2_conn)); - return; + return 0; } /* init ok but not connected yet.. */ @@ -284,7 +285,7 @@ void update_xmms2(void) if (!xmmsc_connect(xmms2_conn, path)) { fprintf(stderr,"XMMS2 connection failed. %s\n", xmmsc_get_last_error(xmms2_conn)); current_info->xmms2.conn_state = CONN_NO; - return; + return 0; } /* set callbacks */ @@ -318,6 +319,7 @@ void update_xmms2(void) xmmsc_io_out_handle(xmms2_conn); } + return 0; } diff --git a/src/xmms2.h b/src/xmms2.h index 0443b121..844d1476 100644 --- a/src/xmms2.h +++ b/src/xmms2.h @@ -53,6 +53,6 @@ struct xmms2_s { int conn_state; }; -void update_xmms2(void); +int update_xmms2(void); #endif /*XMMS2_H_*/