mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 00:09:47 +01:00
Make D-Bus call in fdonotify asynchronous
This commit is contained in:
parent
461f650dbd
commit
6759f6c72f
@ -46,7 +46,6 @@
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include <QtDBus/QDBusConnection>
|
||||
#include <QtDBus/QDBusMessage>
|
||||
#include <QtGui/QImage>
|
||||
|
||||
namespace Tomahawk
|
||||
@ -167,10 +166,19 @@ FdoNotifyPlugin::nowPlaying( const QVariant &input )
|
||||
arguments << qint32( -1 ); //expire_timeout
|
||||
message.setArguments( arguments );
|
||||
|
||||
const QDBusMessage &reply = QDBusConnection::sessionBus().call( message );
|
||||
const QVariantList &list = reply.arguments();
|
||||
if ( list.count() > 0 )
|
||||
m_nowPlayingId = list.at( 0 ).toInt();
|
||||
// Handle reply in a callback, so that this a non-blocking call
|
||||
QDBusConnection::sessionBus().callWithCallback( message, this, SLOT( dbusReplyReceived( QDBusMessage ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the DBus reply triggered by FdoNotifyPlugin::nowPlaying
|
||||
*/
|
||||
void
|
||||
FdoNotifyPlugin::dbusReplyReceived( const QDBusMessage &reply )
|
||||
{
|
||||
const QVariantList &list = reply.arguments();
|
||||
if ( list.count() > 0 )
|
||||
m_nowPlayingId = list.at( 0 ).toInt();
|
||||
}
|
||||
|
||||
} //ns InfoSystem
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "infoplugins/InfoPluginDllMacro.h"
|
||||
#include "infosystem/InfoSystem.h"
|
||||
|
||||
#include <QtDBus/QDBusMessage>
|
||||
|
||||
namespace Tomahawk
|
||||
{
|
||||
|
||||
@ -41,7 +43,9 @@ public:
|
||||
|
||||
protected slots:
|
||||
virtual void init() {}
|
||||
|
||||
|
||||
virtual void dbusReplyReceived( const QDBusMessage &reply );
|
||||
|
||||
virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||
{
|
||||
Q_UNUSED( requestData );
|
||||
|
Loading…
x
Reference in New Issue
Block a user