mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Merge pull request #162 from xhochy/feature/fdonotify-dbus-async-reply
Make D-Bus call in fdonotify asynchronous
This commit is contained in:
@@ -46,9 +46,8 @@
|
|||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/TomahawkUtilsGui.h"
|
#include "utils/TomahawkUtilsGui.h"
|
||||||
|
|
||||||
#include <QtDBus/QDBusConnection>
|
#include <QDBusConnection>
|
||||||
#include <QtDBus/QDBusMessage>
|
#include <QImage>
|
||||||
#include <QtGui/QImage>
|
|
||||||
|
|
||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
@@ -184,10 +183,19 @@ FdoNotifyPlugin::nowPlaying( const QVariant &input )
|
|||||||
arguments << qint32( -1 ); //expire_timeout
|
arguments << qint32( -1 ); //expire_timeout
|
||||||
message.setArguments( arguments );
|
message.setArguments( arguments );
|
||||||
|
|
||||||
const QDBusMessage &reply = QDBusConnection::sessionBus().call( message );
|
// Handle reply in a callback, so that this a non-blocking call
|
||||||
const QVariantList &list = reply.arguments();
|
QDBusConnection::sessionBus().callWithCallback( message, this, SLOT( dbusPlayingReplyReceived( QDBusMessage ) ) );
|
||||||
if ( list.count() > 0 )
|
}
|
||||||
m_nowPlayingId = list.at( 0 ).toInt();
|
|
||||||
|
/**
|
||||||
|
* Handle the DBus reply triggered by FdoNotifyPlugin::nowPlaying
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
FdoNotifyPlugin::dbusPlayingReplyReceived( const QDBusMessage &reply )
|
||||||
|
{
|
||||||
|
const QVariantList &list = reply.arguments();
|
||||||
|
if ( list.count() > 0 )
|
||||||
|
m_nowPlayingId = list.at( 0 ).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
} //ns InfoSystem
|
} //ns InfoSystem
|
||||||
|
@@ -23,6 +23,8 @@
|
|||||||
#include "infoplugins/InfoPluginDllMacro.h"
|
#include "infoplugins/InfoPluginDllMacro.h"
|
||||||
#include "infosystem/InfoSystem.h"
|
#include "infosystem/InfoSystem.h"
|
||||||
|
|
||||||
|
#include <QDBusMessage>
|
||||||
|
|
||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -41,7 +43,9 @@ public:
|
|||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void init() {}
|
virtual void init() {}
|
||||||
|
|
||||||
|
virtual void dbusPlayingReplyReceived( const QDBusMessage &reply );
|
||||||
|
|
||||||
virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData )
|
||||||
{
|
{
|
||||||
Q_UNUSED( requestData );
|
Q_UNUSED( requestData );
|
||||||
|
Reference in New Issue
Block a user