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

Fixes $xmms2_percent and a couple other build fixes.

Signed-off-by: Brenden Matthews <brenden@diddyinc.com>
This commit is contained in:
Ben Kibbey 2010-01-02 11:50:53 -08:00 committed by Brenden Matthews
parent 29f833ee05
commit c00e7b0a42
2 changed files with 15 additions and 3 deletions

View File

@ -208,6 +208,7 @@ int handle_playtime(xmmsv_t *value, void *p)
if (xmmsv_get_int(value, &play_time)) { if (xmmsv_get_int(value, &play_time)) {
ptr->xmms2.elapsed = play_time; ptr->xmms2.elapsed = play_time;
ptr->xmms2.progress = (float) play_time / ptr->xmms2.duration; ptr->xmms2.progress = (float) play_time / ptr->xmms2.duration;
ptr->xmms2.percent = (int)(ptr->xmms2.progress*100);
} }
return TRUE; return TRUE;
@ -276,7 +277,7 @@ void update_xmms2(void)
if (current_info->xmms2.conn_state == CONN_INIT) { if (current_info->xmms2.conn_state == CONN_INIT) {
if (xmms2_conn == NULL) { if (xmms2_conn == NULL) {
xmms2_conn = xmmsc_init(PACKAGE); xmms2_conn = xmmsc_init(PACKAGE_NAME);
} }
/* did init fail? */ /* did init fail? */
@ -398,10 +399,11 @@ XMMS2_PRINT_GENERATOR(id, "%u")
XMMS2_PRINT_GENERATOR(size, "%2.1f") XMMS2_PRINT_GENERATOR(size, "%2.1f")
XMMS2_PRINT_GENERATOR(playlist, "%s") XMMS2_PRINT_GENERATOR(playlist, "%s")
XMMS2_PRINT_GENERATOR(timesplayed, "%i") XMMS2_PRINT_GENERATOR(timesplayed, "%i")
XMMS2_PRINT_GENERATOR(percent, "%i")
#undef XMMS2_PRINT_GENERATOR #undef XMMS2_PRINT_GENERATOR
int check_xmms2_connected(struct text_object *obj) int if_xmms2_connected(struct text_object *obj)
{ {
(void)obj; (void)obj;

View File

@ -31,6 +31,10 @@
#include <xmmsclient/xmmsclient.h> #include <xmmsclient/xmmsclient.h>
#ifdef __cplusplus
extern "C" {
#endif
struct xmms2_s { struct xmms2_s {
char *artist; char *artist;
char *album; char *album;
@ -49,6 +53,7 @@ struct xmms2_s {
float size; float size;
float progress; float progress;
int percent;
char *status; char *status;
int conn_state; 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_size(struct text_object *, char *, int);
void print_xmms2_playlist(struct text_object *, char *, int); void print_xmms2_playlist(struct text_object *, char *, int);
void print_xmms2_timesplayed(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 *); void free_xmms2(struct text_object *);
#ifdef __cplusplus
}
#endif
#endif /*XMMS2_H_*/ #endif /*XMMS2_H_*/