1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 12:27:52 +00:00

xmms free glib objects

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@492 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Philip Kovacs 2006-01-09 23:29:47 +00:00
parent ce116293c8
commit 3476d44e30

View File

@ -29,6 +29,10 @@
#include "conky.h" #include "conky.h"
#include "xmms.h" #include "xmms.h"
#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS)
#include <glib.h>
#endif
#if defined(XMMS) #if defined(XMMS)
#include <xmms/xmmsctrl.h> #include <xmms/xmmsctrl.h>
@ -94,12 +98,14 @@ void *xmms_thread_func(void *pvoid)
{ {
int runnable; int runnable;
static xmms_t items; static xmms_t items;
int session,playpos,frames,length; gint session,playpos,frames,length;
int rate,freq,chans; gint rate,freq,chans;
char *psong,*pfilename; gchar *psong,*pfilename;
pvoid=(void*)pvoid; /* useless cast to avoid unused var warning */ pvoid=(void*)pvoid; /* useless cast to avoid unused var warning */
session=0; session=0;
psong=NULL;
pfilename=NULL;
/* Grab the runnable signal. Should be non-zero here or we do nothing. */ /* Grab the runnable signal. Should be non-zero here or we do nothing. */
pthread_mutex_lock(&info.xmms.runnable_mutex); pthread_mutex_lock(&info.xmms.runnable_mutex);
@ -126,10 +132,13 @@ void *xmms_thread_func(void *pvoid)
strcpy(items[XMMS_STATUS],"Stopped"); strcpy(items[XMMS_STATUS],"Stopped");
/* Current song title */ /* Current song title */
playpos = (int) xmms_remote_get_playlist_pos(session); playpos = xmms_remote_get_playlist_pos(session);
psong = (char *) xmms_remote_get_playlist_title(session, playpos); psong = xmms_remote_get_playlist_title(session, playpos);
if (psong) if (psong) {
strncpy(items[XMMS_TITLE],psong,sizeof(items[XMMS_TITLE])-1); strncpy(items[XMMS_TITLE],psong,sizeof(items[XMMS_TITLE])-1);
g_free(psong);
psong=NULL;
}
/* Current song length as MM:SS */ /* Current song length as MM:SS */
frames = xmms_remote_get_playlist_time(session,playpos); frames = xmms_remote_get_playlist_time(session,playpos);
@ -163,7 +172,11 @@ void *xmms_thread_func(void *pvoid)
/* Current song filename */ /* Current song filename */
pfilename = xmms_remote_get_playlist_file(session,playpos); pfilename = xmms_remote_get_playlist_file(session,playpos);
strncpy(items[XMMS_FILENAME],pfilename,sizeof(items[XMMS_FILENAME])-1); if (pfilename) {
strncpy(items[XMMS_FILENAME],pfilename,sizeof(items[XMMS_FILENAME])-1);
g_free(pfilename);
pfilename=NULL;
}
/* Length of the Playlist (number of songs) */ /* Length of the Playlist (number of songs) */
length = xmms_remote_get_playlist_length(session); length = xmms_remote_get_playlist_length(session);