--- amarok/configure.in.in
+++ amarok/configure.in.in
@@ -352,7 +352,7 @@ if test "$build_yauap" != "no"; then
         # check for dbus-glib
         have_yauap=no
 
-        PKG_CHECK_MODULES(DBUSGLIB, dbus-glib-1,
+        PKG_CHECK_MODULES(DBUS, dbus-1,
             have_yauap=yes,have_yauap=no)
 
 
@@ -361,10 +361,8 @@ if test "$build_yauap" != "no"; then
             LIB_YAUAP=""
             CFLAGS_YAUAP=""
         else
-            PKG_CHECK_MODULES(GOBJECT, gobject-2.0,
-                have_yauap=yes,have_yauap=no)
-            LIB_YAUAP="$DBUSGLIB_LIBS -ldbus-qt-1 $GOBJECT_LIBS"
-            CFLAGS_YAUAP="$DBUSGLIB_CFLAGS $GOBJECT_CFLAGS"
+            LIB_YAUAP="$DBUS_LIBS -ldbus-qt-1"
+            CFLAGS_YAUAP="$DBUS_CFLAGS"
             AC_SUBST(LIB_YAUAP)
             AC_SUBST(CFLAGS_YAUAP)
             AC_DEFINE(HAVE_YAUAP, 1, [have yauap])
--- amarok/src/engine/yauap/yauap-engine.cpp
+++ amarok/src/engine/yauap/yauap-engine.cpp
@@ -16,13 +16,6 @@ copyright            : (C) 2006 by Sasch
 
 #include <qprocess.h>
 
-/* FIXME use the qt bindings.... 
-   we can't use the glib signal handling because it requires a g_main loop 
-   otherwise the glib bindings might probably be ok because gstreamer is using glib anyway
-   Currently the engine uses the c bindings for signal handling and the glib bindings for function calls
-
-*/
-#include <dbus/dbus-glib.h>
 #include <klocale.h>
 #include <iostream>
 #include <stdlib.h>
@@ -31,7 +24,9 @@ copyright            : (C) 2006 by Sasch
 #include <dbus/connection.h>
 
 //#define MANUAL_YAUAP_START
-#define YAUAP_STARTUP_TIMEOUT 10000
+#define YAUAP_DBUS_SERVICE "org.yauap.CommandService"
+#define YAUAP_DBUS_PATH "/yauapObject"
+#define YAUAP_DBUS_INTERFACE "org.yauap.CommandInterface"
 
 #include "yauap-engine.h"
 #include "debug.h"
@@ -138,7 +133,7 @@ DBusConnection::close()
 }
 
 
-DBusConnection::DBusConnection( void* c )
+DBusConnection::DBusConnection( yauapEngine* c )
 {
     qt_connection = NULL;
     dbus_connection = NULL;
@@ -150,6 +145,89 @@ DBusConnection::~DBusConnection()
     close();
 }
 
+bool
+DBusConnection::send(const char *method, int first_arg_type, ...)
+{
+    dbus_uint32_t serial = 0;
+    bool ret = false;
+
+    QMutexLocker lock(&m_mutex);
+
+    DBusMessage* msg = dbus_message_new_method_call(
+            YAUAP_DBUS_SERVICE, YAUAP_DBUS_PATH, YAUAP_DBUS_INTERFACE,
+            method);
+
+    if (msg) {
+        va_list ap;
+
+        va_start(ap, first_arg_type);
+        dbus_message_append_args_valist(msg, first_arg_type, ap);
+        va_end(ap);
+
+        ret = dbus_connection_send(dbus_connection, msg, &serial);
+        dbus_message_unref (msg);
+    }
+
+    return ret;
+}
+
+int
+DBusConnection::call(const char *method, int first_arg_type, ...)
+{
+    dbus_uint32_t ret = -1;
+
+    va_list ap;
+    va_start (ap, first_arg_type);
+    DBusMessage* msg = send_with_reply(method, first_arg_type, ap);
+    va_end (ap);
+
+    if (msg) {
+        DBusMessageIter args;
+        if (dbus_message_iter_init(msg, &args) && DBUS_TYPE_INT32 ==
+                dbus_message_iter_get_arg_type(&args))
+            dbus_message_iter_get_basic(&args, &ret);
+
+        dbus_message_unref (msg);
+    }
+
+    return ret;
+}
+
+DBusMessage*
+DBusConnection::send_with_reply(const char* method, int first_arg_type, ...)
+{
+    va_list ap;
+    va_start(ap, first_arg_type);
+    DBusMessage* msg = send_with_reply(method, first_arg_type, ap);
+    va_end(ap);
+    return msg;
+}
+
+DBusMessage*
+DBusConnection::send_with_reply(const char* method, int first_arg_type, va_list ap)
+{
+    QMutexLocker lock(&m_mutex);
+
+    DBusMessage* msg = dbus_message_new_method_call(
+            YAUAP_DBUS_SERVICE, YAUAP_DBUS_PATH, YAUAP_DBUS_INTERFACE, method);
+
+    if (msg) {
+        dbus_message_append_args_valist(msg, first_arg_type, ap);
+
+        DBusPendingCall* pcall = 0;
+
+        dbus_connection_send_with_reply(dbus_connection, msg, &pcall, -1);
+        dbus_message_unref (msg);
+
+        dbus_pending_call_block(pcall);
+        msg = dbus_pending_call_steal_reply(pcall);
+        dbus_pending_call_unref(pcall);
+    }
+
+    return msg;
+}
+
+
 /* emit state change signal */
 void 
 yauapEngine::change_state( Engine::State state )
@@ -161,74 +239,58 @@ yauapEngine::change_state( Engine::State
 /* destroy engine */
 yauapEngine::~yauapEngine()
 {
-    GError *error = NULL;
     /* make sure we really stopped */
     stop();
 
     /* quit the player */
-    if ( !dbus_g_proxy_call( remote_object, "quit", &error,
-                          G_TYPE_INVALID,
-                          G_TYPE_INVALID) )
-    {
-
-                debug() << "quit failed " << error->message <<  endl;
-                g_error_free( error );
-    }
-
+    if ( !con->send("quit", DBUS_TYPE_INVALID) )
+        debug() << "quit failed " <<  endl;
 
-    /* destroy Qt DBus connection */
-    if(con)
-        delete con; 
-
-    /* free remote object */
-    if(remote_object)
-        g_object_unref(remote_object);
-
-    /* kill yauap */
-#ifndef MANUAL_YAUAP_START
-    helper.kill();
-#endif
+    delete con;
 }
 
 /* fetch metadata from yauap */
 void 
-yauapEngine::update_metadata(void){
+yauapEngine::update_metadata()
+{
     Engine::SimpleMetaBundle bndl;
-    GError *error = NULL;
-    char **reply_list;
-    char **reply_ptr;
     debug() << " emit metadata change " << endl;
 
+    DBusMessage* msg = con->send_with_reply("get_metadata", DBUS_TYPE_INVALID);
+    if (msg) {
+        DBusMessageIter args;
+        if (dbus_message_iter_init(msg, &args) && DBUS_TYPE_ARRAY ==
+                dbus_message_iter_get_arg_type(&args)) {
+            DBusMessageIter sub;
+            dbus_message_iter_recurse(&args, &sub);
+            dbus_message_iter_next(&args);
+            while (dbus_message_iter_get_arg_type(&sub) == DBUS_TYPE_STRING) {
+                char* reply_ptr = 0;
+                dbus_message_iter_get_basic(&sub, &reply_ptr);
+                dbus_message_iter_next(&sub);
 
-    if( !dbus_g_proxy_call (remote_object, "get_metadata", &error,
-        G_TYPE_INVALID,G_TYPE_STRV, &reply_list, G_TYPE_INVALID) )
-    {
-        debug() << "get_metadata failed " << error->message <<  endl;
-        g_error_free(error);
-        return;
-    }
-    for(reply_ptr = reply_list; *reply_ptr; reply_ptr++)
-    {
-#define ASSIGN(a,b)  if(!strncmp(*reply_ptr,b,strlen(b)) && strlen(*reply_ptr + strlen(b) + 1)){ \
-                         bndl.a = *reply_ptr + strlen(b) + 1; \
+                debug() << "reply_ptr: " << reply_ptr << endl;
+
+#define ASSIGN(a,b)  if(!strncmp(reply_ptr,b,strlen(b)) && strlen(reply_ptr + strlen(b) + 1)){ \
+                         bndl.a = reply_ptr + strlen(b) + 1; \
                          continue; \
                      }
-        ASSIGN( title, "title" )
-        ASSIGN( artist, "artist" )
-        ASSIGN( album, "album" )
-        ASSIGN( comment, "comment" )
-        ASSIGN( genre, "genre" )
-        ASSIGN( samplerate, "samplerate" )
-        ASSIGN( year, "date" )
-        ASSIGN( tracknr, "track-number" )
-        ASSIGN( length, "length" )
-        ASSIGN( bitrate, "bitrate" )
+
+                ASSIGN( title, "title" )
+                ASSIGN( artist, "artist" )
+                ASSIGN( album, "album" )
+                ASSIGN( comment, "comment" )
+                ASSIGN( genre, "genre" )
+                ASSIGN( samplerate, "samplerate" )
+                ASSIGN( year, "date" )
+                ASSIGN( tracknr, "track-number" )
+                ASSIGN( length, "length" )
+                ASSIGN( bitrate, "bitrate" )
 #undef ASSIGN
+            }
+        }
+        dbus_message_unref(msg);
     }
-    /* free reply_list */
-    for( reply_ptr = reply_list; *reply_ptr; reply_ptr++)
-        free( *reply_ptr );
-    free( reply_list );
 
     debug() << "title:" << bndl.title << endl;
     debug() << "artist:" << bndl.artist << endl;
@@ -252,63 +314,66 @@ yauapEngine::update_metadata(void){
 
 /* fetch current sample buffer from yauap */
 const Engine::Scope &
-yauapEngine::scope(){ 
-    GError *error = NULL;
-    GArray *arr;
-    int i;
-
-//        debug() << " update scope " << endl;
+yauapEngine::scope()
+{
+    int len = 0;
+    dbus_int16_t* data = 0;
 
-    if (!dbus_g_proxy_call(remote_object, "get_scopedata", &error,
-        G_TYPE_INVALID,DBUS_TYPE_G_UCHAR_ARRAY, &arr, G_TYPE_INVALID))
-    {
-        debug() << "get_scopedata failed " << error->message <<  endl;
-        g_error_free( error );
-        return m_scope;
+    DBusMessage* msg = con->send_with_reply("get_scopedata", DBUS_TYPE_INVALID);
+    if (msg) {
+        DBusMessageIter args;
+        if (dbus_message_iter_init(msg, &args) && DBUS_TYPE_ARRAY ==
+                dbus_message_iter_get_arg_type(&args)) {
+            DBusMessageIter sub;
+            dbus_message_iter_recurse(&args, &sub);
+            dbus_message_iter_next(&args);
+            dbus_message_iter_get_fixed_array(&sub,&data,&len);
+        }
+        dbus_message_unref(msg);
     }
+
     /* 2 channel 16 bit samples */
-    if(arr->len == SCOPESIZE * 2)
+    if(len == SCOPESIZE * 2)
     {
-        /* and voila about 1000 memcpys later the data reaches amarok */
-        gint16 *data = reinterpret_cast<gint16 *>( arr->data );
-        for( i=0; i < SCOPESIZE ; i++)
+        for( int i=0; i < SCOPESIZE ; i++)
             m_scope[i] = data[i];
     }else
-       debug() << "get_scopedata returned the wrong amount of data " << arr->len << endl;
-    g_array_free( arr, TRUE);
+       debug() << "get_scopedata returned the wrong amount of data " << len << endl;
+
     return m_scope;
 }
 
-
-/* tell amarok that the current track ended */
-void 
-yauapEngine::track_ended( void )
+void
+yauapEngine::yauapProcessExited()
 {
-    m_state = Engine::Idle;
-    emit trackEnded();
+    debug() << "yauapProcessExited!!!!!" << endl;
+
+    closeDbusConnection();
+    initDbusConnection();
 }
 
-/* display a error message */
 void
-yauapEngine::error_msg( char * msg )
+yauapEngine::closeDbusConnection()
 {
-    emit statusText( msg );
+    /* destroy Qt DBus connection */
+    delete con;
+    con = 0;
+
+    /* kill yauap */
+#ifndef MANUAL_YAUAP_START
+    helper.kill();
+#endif
 }
 
-/* init engine */
-bool 
-yauapEngine::init( void )
+bool
+yauapEngine::initDbusConnection()
 {
-    GError *error = NULL;
-    int i,  ret = 0;
-
-    debug() << "In init" << endl;
-
 #ifndef MANUAL_YAUAP_START
     /* start yauap in slave mode */
+    helper.clearArguments();
     helper << "yauap" << "-noexit";
 
-    if( !helper.start() )
+    if( !helper.start(KProcess::NotifyOnExit, KProcess::All))
     {
         debug() << "could not start yauap " << endl;
         emit statusText( i18n( "could not start yauap" ) );
@@ -317,112 +382,93 @@ yauapEngine::init( void )
 #endif
 
     /* create and open qt DBus connection so that we are able to receive signals */
-    con = new DBusConnection( (void*) this );
-    con->open();
-
-    /* init g type for the DBus glib bindings */
-    g_type_init();
-
-    /* connect to DBus */
-    bus = dbus_g_bus_get( DBUS_BUS_SESSION, &error);
-    if( !bus )
+    con = new DBusConnection( this );
+    if (!con->open())
     {
         debug() << "could not connect to dbus" << endl;
         emit statusText( i18n( "Error: could not connect to dbus" ) );
         return false;
     }
 
-    /* create a yauap Remote Object */
-    remote_object = dbus_g_proxy_new_for_name( bus,
-                                             "org.yauap.CommandService",
-                                             "/yauapObject",
-                                             "org.yauap.CommandInterface");
-    if( !remote_object )
-    {
-        debug() << "could not create remote object" << endl;
-        return false;
-    }
-
     /* makes sure the player is stopped: retry the call a few times because it takes some
     time until yauap registered its dbus service  */
-
-    for( i=0; i < YAUAP_STARTUP_TIMEOUT ; i++ ){
-        if( dbus_g_proxy_call(remote_object, "stop", &error,
-            G_TYPE_INVALID,G_TYPE_INT,&ret, G_TYPE_INVALID) )
-             break;
-//                debug() << "stop failed " << error->message <<  endl;
-        usleep(1000);
-        g_error_free( error );
-        error = NULL;
+    for( int i=0; i < 2; ++i ) {
+        if( con->send("stop", DBUS_TYPE_INVALID) >= 0 )
+            return true;
+        usleep(20 * 1000);
     }
-    if( i >= YAUAP_STARTUP_TIMEOUT )
-    {
-        debug() << "timed out waiting for yauap" << endl;
-        emit statusText( i18n( "Error: timed out waiting for yauap" ) );
 
-        return false;
-    }
+    return false;
+}
 
-    return true;
+#if 0
+void 
+yauapEngine::handleDbusError(const char* method)
+{
+    debug() << method << " failed "  <<  endl;
+
+    closeDbusConnection();
+    initDbusConnection();
 }
+#endif
 
-/* check if the given url can be decoded */
+/* tell amarok that the current track ended */
+void 
+yauapEngine::track_ended()
+{
+    m_state = Engine::Idle;
+    emit trackEnded();
+}
+
+/* display a error message */
+void
+yauapEngine::error_msg( char * msg )
+{
+    emit statusText( msg );
+}
+
+/* init engine */
 bool 
-yauapEngine::canDecode( const KURL &kurl ) const 
+yauapEngine::init()
 {
-    GError *error = NULL;
-    QString qurl = kurl.url();
-    const char* url = qurl.ascii();
-    int can_decode = 0;
-
-    debug() << " In canDecode " << url << endl ;
-    if (!dbus_g_proxy_call( remote_object, "can_decode", &error,
-                          G_TYPE_STRING, url,
-                          G_TYPE_INVALID,
-                          G_TYPE_INT,&can_decode,
-                          G_TYPE_INVALID))
-    {
+    debug() << "In init" << endl;
 
-        debug() << "canDecode " << error->message <<  endl;
-        g_error_free( error );
-        return false;
-    }
+    m_state = Engine::Idle;
 
-    debug() << "=> " << can_decode << endl;
+    connect(&helper, SIGNAL(processExited(KProcess*)), SLOT(yauapProcessExited()));
 
-    if( can_decode )
+    if (initDbusConnection())
         return true;
+
+    emit statusText( i18n( "Error: timed out waiting for yauap" ) );
     return false;
 }
 
+/* check if the given url can be decoded */
+bool
+yauapEngine::canDecode( const KURL &kurl ) const
+{
+    QCString qurl = kurl.url().utf8();
+    const char* url = qurl.data();
+
+    return con->call("can_decode", DBUS_TYPE_STRING, &url, DBUS_TYPE_INVALID) > 0;
+}
+
 /* load a new track FIXME: implement cross fading */
 bool 
 yauapEngine::load( const KURL &url, bool isStream )
 {
-    GError *error = NULL;
     QString qurl = url.url();
     const char* curl = qurl.ascii();
-    int gerror = 0;
 
     m_isStream = isStream;
 
     Engine::Base::load( url, isStream || url.protocol() == "http" );
     change_state(Engine::Idle);
 
-    if (!dbus_g_proxy_call( remote_object, "load", &error,
-        G_TYPE_STRING,curl,
-        G_TYPE_INVALID,
-        G_TYPE_INT,&gerror,
-        G_TYPE_INVALID))
-    {
-        debug() << "load failed " << error->message <<  endl;
-        g_error_free( error );
+    if (!con->call("load", DBUS_TYPE_STRING, &curl, DBUS_TYPE_INVALID))
         return false;
-    }
 
-    debug() << "=> " << gerror << endl;
-    if( !gerror )
-        return false;
     loaded_url = url;
     return true;
 }
@@ -431,40 +477,31 @@ yauapEngine::load( const KURL &url, bool
 void 
 yauapEngine::setVolumeSW( uint volume )
 {
-    GError *error = NULL;
-    int gerror = 0;
+    dbus_uint32_t dbus_volume = volume;
+    int ret;
+
     debug() << "In setVolumeSW " << volume << endl;
-    if( !dbus_g_proxy_call( remote_object, "set_volume", &error,
-        G_TYPE_UINT,volume,G_TYPE_INVALID,G_TYPE_INT,&gerror,G_TYPE_INVALID))
-    {
-        debug() << "set_volume failed " << error->message <<  endl;
-        g_error_free(error);
-        return;
-    }
-    debug() << "=> " << gerror << endl;
+
+    ret = con->call("set_volume", DBUS_TYPE_UINT32, &dbus_volume, DBUS_TYPE_INVALID);
+    debug() << "=> " << ret << endl;
 }
 
+#include <assert.h>
+
 /* start playback */
 bool 
 yauapEngine::play( uint offset )
 {
-    GError *error = NULL;
-    int gerror = 0;
+    dbus_uint32_t dbus_offset = offset;
+
     debug() << "In play" << endl;
-    if (!dbus_g_proxy_call(remote_object, "start", &error,
-        G_TYPE_UINT,offset,G_TYPE_INVALID,G_TYPE_INT,&gerror,G_TYPE_INVALID))
-    {
-        debug() << "play failed " << error->message <<  endl;
-        g_error_free( error );
-        return false;
-    }
 
-    debug() << "=> " << gerror << endl;
-    if(gerror)
+    if (con->call("start", DBUS_TYPE_UINT32, &dbus_offset, DBUS_TYPE_INVALID) > 0)
     {
         change_state( Engine::Playing );
         return true;
     }
+
     change_state( Engine::Empty );
     return false;
 }
@@ -472,158 +509,123 @@ yauapEngine::play( uint offset )
 
 /* stop playback */
 void 
-yauapEngine::stop( void )
+yauapEngine::stop()
 {
-    GError *error = NULL;
-    int gerror = 0;
     change_state( Engine::Empty );
 
-    if (!dbus_g_proxy_call(remote_object, "stop", &error,
-        G_TYPE_INVALID,G_TYPE_INT,&gerror,G_TYPE_INVALID))
+    if (con->send("stop", DBUS_TYPE_INVALID) <= 0)
     {
-        debug() << "stop failed " << error->message <<  endl;
-        g_error_free(error);
+        debug() << "stop failed " <<  endl;
         return;
     }
 
-    debug() << "=> " << gerror << endl;
+    change_state(Engine::Empty);
 }
 
 
 /* pause playback */
 void 
-yauapEngine::pause( void )
+yauapEngine::pause()
 {
-    GError *error = NULL;
-    int gerror = 0;
     debug() << "In pause " << endl;
-    if ( !dbus_g_proxy_call(remote_object, "pause", &error,
-        G_TYPE_INVALID,G_TYPE_INT,&gerror,G_TYPE_INVALID) )
-    {
-        debug() << "pause failed " << error->message <<  endl;
-        g_error_free( error );
-        return;
-    }
 
-    debug() << "=> " << gerror << endl;
+    if (!con->call("pause", DBUS_TYPE_INVALID))
+        return;
 
-    if( gerror ){
-        if( state() == Engine::Playing )
-            change_state( Engine::Paused );
-         else
-            change_state( Engine::Playing );
-    }
+    if( state() == Engine::Playing )
+        change_state( Engine::Paused );
+    else
+        change_state( Engine::Playing );
 }
 
 /* unpause playback */
-void 
-yauapEngine::unpause( void )
+void
+yauapEngine::unpause()
 {
     pause();
 }
 
 /* get track length in ms */
-uint 
-yauapEngine::length( void ) const 
+uint
+yauapEngine::length() const
 {
-    GError *error = NULL;
-    uint length = 0;
     debug() << "In length " << endl;
-    if (!dbus_g_proxy_call(remote_object, "get_length", &error,
-        G_TYPE_INVALID,G_TYPE_UINT,&length,G_TYPE_INVALID))
-    {
-        debug() << "get_length failed " << error->message <<  endl;
-        g_error_free(error);
-        return 0;
-    }
+
+    int length = con->call("get_length", DBUS_TYPE_INVALID);
+    if (length < 0) return 0;
 
     debug() << "=> " << length << endl;
-    return length;
+    return (uint) length;
 }
 
 /* get current position */
-uint 
-yauapEngine::position( void ) const 
+uint
+yauapEngine::position() const
 {
-    GError *error = NULL;
-    uint position = 0;
-//	debug() << "In position " << endl;
-    if ( !dbus_g_proxy_call(remote_object, "get_position", &error,
-        G_TYPE_INVALID,G_TYPE_UINT,&position,G_TYPE_INVALID) )
-    {
+    int position = 0;
 
-        debug() << "get_positon failed " << error->message <<  endl;
-        g_error_free(error);
-        return 0;
-    }
-//	debug() << "=> " << position << endl;
-    return position;
+    position = con->call("get_position", DBUS_TYPE_INVALID);
+    if (position < 0) position = 0;
+    return (uint) position;
 }
 
 /* seek to offset in ms */
-void 
+void
 yauapEngine::seek( uint offset )
 {
-    GError *error = NULL;
-    int ret = 0;
-    debug() << "In seek " << endl;
-    if ( !dbus_g_proxy_call( remote_object, "seek", &error,
-        G_TYPE_UINT, offset, G_TYPE_INVALID, G_TYPE_INT, &ret, G_TYPE_INVALID) )
-    {
-        debug() << "seek failed " << error->message <<  endl;
-        g_error_free(error);
-        return;
-    }
-    debug() << "=> " << ret << endl;
-}
+    dbus_uint32_t dbus_offset = offset;
 
+    if (!con->send("seek", DBUS_TYPE_UINT32, &dbus_offset, DBUS_TYPE_INVALID))
+        debug() << "seek failed " <<  endl;
+}
 
 bool
 yauapEngine::getAudioCDContents(const QString &device, KURL::List &urls)
 {
-    GError *error = NULL;
-    char **reply_list;
-    char **reply_ptr;
-    int i = 0;
-    
-
     debug() << "Getting AudioCD contents..." << endl;
 
-    if( !dbus_g_proxy_call (remote_object, "get_audio_cd_contents", &error,
-        G_TYPE_STRING,(char*)device.latin1(),G_TYPE_INVALID,G_TYPE_STRV, &reply_list, G_TYPE_INVALID) )
-    {
-        debug() << "get_audio_cd_contents failed " << error->message <<  endl;
-        g_error_free(error);
-        return false;
+    QCString cdevice = device.latin1();
+    const char* cdevice_ptr = cdevice.data();
+
+    DBusMessage* msg = con->send_with_reply("get_audio_cd_contents",
+            DBUS_TYPE_STRING, &cdevice_ptr, DBUS_TYPE_INVALID);
+    if (msg) {
+        DBusMessageIter args;
+        int i = 0;
+
+        if (dbus_message_iter_init(msg, &args) && DBUS_TYPE_ARRAY ==
+                dbus_message_iter_get_arg_type(&args)) {
+            DBusMessageIter sub;
+            dbus_message_iter_recurse(&args, &sub);
+            dbus_message_iter_next(&args);
+            while (dbus_message_iter_get_arg_type(&sub) == DBUS_TYPE_STRING) {
+                char* reply_ptr = 0;
+                dbus_message_iter_get_basic(&sub, &reply_ptr);
+                dbus_message_iter_next(&sub);
+
+                debug() << "reply_ptr: " << reply_ptr << endl;
+
+                Engine::SimpleMetaBundle b;
+                char* saveptr;
+                KURL url = QString("cdda://").append( strtok_r(reply_ptr,"=",&saveptr)); 
+                urls << url;
+                debug() << url << endl;
+                b.title  = QString( i18n( "Track %1" ) ).arg( i+1 );
+                b.length = strtok_r(NULL,"=",&saveptr);
+                b.album = "AudioCD";
+                b.tracknr = i+1;
+                b.samplerate = "44100";
+                b.bitrate = "1411";
+                cd_tracks.push_back(b);
+                ++i;
+            }
+        }
+        dbus_message_unref(msg);
     }
-   
-    cd_tracks.clear(); 
-    for(reply_ptr = reply_list; *reply_ptr; reply_ptr++)
-    {
-        Engine::SimpleMetaBundle b;
-        char* saveptr;
-        KURL url = QString("cdda://").append( strtok_r(*reply_ptr,"=",&saveptr)); 
-        urls << url;
-        debug() << url << endl;
-        b.title  = QString( i18n( "Track %1" ) ).arg( i+1 );
-        b.length = strtok_r(NULL,"=",&saveptr);
-        b.album = "AudioCD";
-        b.tracknr = i+1;
-        b.samplerate = "44100";
-        b.bitrate = "1411";
-        cd_tracks.push_back(b);
-        ++i;
-    }
-    /* free reply_list */
-    for( reply_ptr = reply_list; *reply_ptr; reply_ptr++)
-        free( *reply_ptr );
-    free( reply_list );
 
     return true;
 }
 
-
-
 bool 
 yauapEngine::metaDataForUrl(const KURL &url, Engine::SimpleMetaBundle &b)
 {
@@ -635,3 +637,4 @@ yauapEngine::metaDataForUrl(const KURL &
     return false;
 }
 
+#include "yauap-engine.moc"
--- amarok/src/engine/yauap/yauap-engine.h
+++ amarok/src/engine/yauap/yauap-engine.h
@@ -13,6 +13,9 @@ copyright            : (C) 2006 by Sasch
  *                                                                         *
  ***************************************************************************/
 
+#ifndef AMAROK_YAUAP_ENGINE_H
+#define AMAROK_YAUAP_ENGINE_H
+
 #define DBUS_API_SUBJECT_TO_CHANGE
 #include <dbus/connection.h>
 
@@ -21,24 +24,35 @@ copyright            : (C) 2006 by Sasch
 #include "enginebase.h"
 #include "debug.h"
 
+class yauapEngine;
 
-
-/* DBus Connection for the signal handler */
-class DBusConnection : public QObject 
+class DBusConnection : public QObject
 {
-//    Q_OBJECT
+    friend class yauapEngine;
+
     DBusQt::Connection *qt_connection;
     DBusConnection *dbus_connection;
-    void *context;
+    yauapEngine *context;
+    QMutex m_mutex;
+
 public:
     bool open();
     void close();
-    DBusConnection( void *context );
+    DBusConnection( yauapEngine *context );
     ~DBusConnection();
+
+    bool send(const char *method, int first_arg_type, ...);
+    DBusMessage* send_with_reply(const char* method, int first_arg_type, ...);
+    DBusMessage* send_with_reply(const char* method, int first_arg_type, va_list);
+    int call(const char *method, int first_arg_type, ...);
 };
 
-class yauapEngine : public Engine::Base 
+class yauapEngine : public Engine::Base
 {
+    Q_OBJECT
+
+    friend class DBusConnection;
+
     virtual ~yauapEngine();
     virtual bool init();
     virtual bool canDecode( const KURL& ) const;
@@ -55,24 +69,28 @@ class yauapEngine : public Engine::Base 
     virtual const Engine::Scope &scope();
     virtual bool getAudioCDContents(const QString &device, KURL::List &urls);
     virtual bool metaDataForUrl(const KURL &url, Engine::SimpleMetaBundle &b);
-public: 
+public:
     yauapEngine() : EngineBase() {}
     /* these need to be public because they are called from the dbus signal handler */
     void update_metadata();
     void update_scope();
     void track_ended();
     void error_msg(char* msg);
+
+private slots:
+    void yauapProcessExited();
+
 private:
     KURL loaded_url;
     std::vector<Engine::SimpleMetaBundle> cd_tracks;
     void change_state( Engine::State );
-    DBusGConnection *bus;
-    DBusGProxy *remote_object;
+    bool initDbusConnection();
+    void closeDbusConnection();
+
     Engine::State m_state;
     DBusConnection *con;
     /* helper process to start */
     KProcess helper;
 };
 
-
-
+#endif
--- amarok/src/engine/yauap/Makefile.am
+++ amarok/src/engine/yauap/Makefile.am
@@ -23,8 +23,7 @@ libamarok_yauap_engine_plugin_la_LDFLAGS
     $(KDE_PLUGIN) \
     $(all_libraries)
 
-METASOURCES = \
-    AUTO
+METASOURCES = AUTO
 
 kde_services_DATA = \
     amarok_yauap-engine_plugin.desktop
