@@ -16,28 +16,24 @@
1616
1717#include "dashcommunicator.h"
1818
19−#include <QObject>
2019#include <QDBusConnection>
20+#include <QDBusConnectionInterface>
2121#include <QDBusInterface>
2222#include <QDebug>
2323
24−DashCommunicator::DashCommunicator(QObject *parent):
25− QObject(parent)
24+DashCommunicator::DashCommunicator(QObject *parent)
25+ : AbstractDBusServiceMonitor("com.canonical.UnityDash",
26+ "/com/canonical/UnityDash",
27+ "", parent)
2628{
2729}
2830
29−DashCommunicator::~DashCommunicator()
30−{
31−}
32−
33−
3431void DashCommunicator::setCurrentScope(const QString &scopeId, bool animate, bool reset)
3532{
36− QDBusConnection connection = QDBusConnection::sessionBus();
37− QDBusInterface dashIface ("com.canonical.UnityDash",
38− "/com/canonical/UnityDash",
39− "",
40− connection);
41−
42− dashIface.call("SetCurrentScope", scopeId, animate, reset);
33+ if (dbusInterface() == nullptr) {
34+ qDebug() << "DashCommunicator - setCurrentScope failed as Dash DBus interface not available";
35+ return;
36+ } else {
37+ dbusInterface()->asyncCall("SetCurrentScope", scopeId, animate, reset);
38+ }
4339}