Commit 3af84bff authored by David Edmundson's avatar David Edmundson
Browse files

[dataengines/mpris] Port to QDBusServiceWatcher

QDBusServiceWatcher gained wildcard support in Qt 5.14. We can now port
to use it over the deprecated signal on QDBusConnectionInterface.

This not only ports away from deprecated code, but should reduce
plasmashell wakeups for unreltaed enties.
parent 4dff8eb5
......@@ -22,6 +22,7 @@
#include <QDBusConnectionInterface>
#include <QDBusPendingCallWatcher>
#include <QDBusPendingReply>
#include <QDBusServiceWatcher>
#include <QStringList>
#include "debug.h"
......@@ -34,9 +35,11 @@ Mpris2Engine::Mpris2Engine(QObject* parent,
const QVariantList& args)
: Plasma::DataEngine(parent, args)
{
connect(QDBusConnection::sessionBus().interface(), &QDBusConnectionInterface::serviceOwnerChanged,
this, &Mpris2Engine::serviceOwnerChanged);
auto watcher = new QDBusServiceWatcher(QStringLiteral("org.mpris.MediaPlayer2*"),
QDBusConnection::sessionBus(),
QDBusServiceWatcher::WatchForOwnerChange,
this);
connect(watcher, &QDBusServiceWatcher::serviceOwnerChanged, this, &Mpris2Engine::serviceOwnerChanged);
QDBusPendingCall async = QDBusConnection::sessionBus().interface()->asyncCall(QStringLiteral("ListNames"));
QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(async, this);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment