@@ -15,32 +15,38 @@
1515 */
1616
1717#include "dashcommunicator.h"
18−
18+#include "dashconnection.h"
1919
2020#include <QObject>
21−#include <QDBusConnection>
22−#include <QDBusConnectionInterface>
23−#include <QDBusInterface>
24−#include <QDebug>
25−#include <QDBusPendingCall>
2621
2722DashCommunicator::DashCommunicator(QObject *parent):
2823 QThread(parent),
29− m_dashService(nullptr)
24+ m_dashConnection(nullptr),
25+ m_created(false)
3026{
3127 start();
3228}
3329
3430void DashCommunicator::setCurrentScope(const QString &scopeId, bool animate, bool isSwipe)
3531{
36− m_dashService->dbusInterface()->asyncCall("SetCurrentScope", scopeId, animate, isSwipe);
32+ m_mutex.lock();
33+ if (m_created) {
34+ QMetaObject::invokeMethod(m_dashConnection, "setCurrentScope",
35+ Q_ARG(QString, scopeId),
36+ Q_ARG(bool, animate),
37+ Q_ARG(bool, isSwipe));
38+ }
39+ m_mutex.unlock();
3740}
3841
3942void DashCommunicator::run()
4043{
41− m_dashService = new AbstractDBusServiceMonitor("com.canonical.UnityDash",
44+ m_dashConnection = new DashConnection("com.canonical.UnityDash",
4245 "/com/canonical/UnityDash",
43− "", AbstractDBusServiceMonitor::SessionBus, this);
46+ "", this);
47+ m_mutex.lock();
48+ m_created = true;
49+ m_mutex.unlock();
4450
4551 exec();
4652}