on xenial help sign in
switch to proper dbus interface
2833057Michael Zanetti
plugins/Unity/Launcher/dbusinterface.cpp+12−12
@@ -13,10 +13,10 @@ DBusInterface::DBusInterface(LauncherModel *parent):
13{
13{
14 /* Set up ourselves on DBus */
14 /* Set up ourselves on DBus */
15 QDBusConnection con = QDBusConnection::sessionBus();
15 QDBusConnection con = QDBusConnection::sessionBus();
16− if (!con.registerService("com.canonical.Unity.Launcher2")) {
16+ if (!con.registerService("com.canonical.Unity.Launcher")) {
17 qWarning() << "Unable to register launcher name";
17 qWarning() << "Unable to register launcher name";
18 }
18 }
19− if (!con.registerVirtualObject("/com/canonical/Unity/Launcher2", this, QDBusConnection::VirtualObjectRegisterOption::SubPath)) {
19+ if (!con.registerVirtualObject("/com/canonical/Unity/Launcher", this, QDBusConnection::VirtualObjectRegisterOption::SubPath)) {
20 qWarning() << "Unable to register launcher object";
20 qWarning() << "Unable to register launcher object";
21 }
21 }
22}
22}
@@ -25,19 +25,19 @@ DBusInterface::~DBusInterface()
25{
25{
26 /* Remove oursevles from DBus */
26 /* Remove oursevles from DBus */
27 QDBusConnection con = QDBusConnection::sessionBus();
27 QDBusConnection con = QDBusConnection::sessionBus();
28− con.unregisterService("com.canonical.Unity.Launcher2");
28+ con.unregisterService("com.canonical.Unity.Launcher");
29− con.unregisterObject("/com/canonical/Unity/Launcher2");
29+ con.unregisterObject("/com/canonical/Unity/Launcher");
30}
30}
31
31
32QString DBusInterface::introspect(const QString &path) const
32QString DBusInterface::introspect(const QString &path) const
33{
33{
34 qDebug() << "introspecting" << path;
34 qDebug() << "introspecting" << path;
35 /* This case we should just list the nodes */
35 /* This case we should just list the nodes */
36− if (path == "/com/canonical/Unity/Launcher2/" || path == "/com/canonical/Unity/Launcher2") {
36+ if (path == "/com/canonical/Unity/Launcher/" || path == "/com/canonical/Unity/Launcher") {
37 QString nodes;
37 QString nodes;
38
38
39 // Add Refresh to introspect
39 // Add Refresh to introspect
40− nodes = "<interface name=\"com.canonical.Unity.Launcher2\">"
40+ nodes = "<interface name=\"com.canonical.Unity.Launcher\">"
41 "<method name=\"Refresh\"/>"
41 "<method name=\"Refresh\"/>"
42 "</interface>";
42 "</interface>";
43
43
@@ -51,13 +51,13 @@ QString DBusInterface::introspect(const QString &path) const
51 }
51 }
52
52
53 /* Should not happen, but let's handle it */
53 /* Should not happen, but let's handle it */
54− if (!path.startsWith("/com/canonical/Unity/Launcher2")) {
54+ if (!path.startsWith("/com/canonical/Unity/Launcher")) {
55 return "";
55 return "";
56 }
56 }
57
57
58 /* Now we should be looking at a node */
58 /* Now we should be looking at a node */
59 QString nodeiface =
59 QString nodeiface =
60− "<interface name=\"com.canonical.Unity.Launcher2.Item\">"
60+ "<interface name=\"com.canonical.Unity.Launcher.Item\">"
61 "<property name=\"count\" type=\"i\" access=\"readwrite\" />"
61 "<property name=\"count\" type=\"i\" access=\"readwrite\" />"
62 "<property name=\"countVisible\" type=\"b\" access=\"readwrite\" />"
62 "<property name=\"countVisible\" type=\"b\" access=\"readwrite\" />"
63 "</interface>";
63 "</interface>";
@@ -134,16 +134,16 @@ bool DBusInterface::handleMessage(const QDBusMessage& message, const QDBusConnec
134 return false;
134 return false;
135 }
135 }
136
136
137− if (message.member() != "GetAll" && message.arguments()[0].toString() != "com.canonical.Unity.Launcher2.Item") {
137+ if (message.member() != "GetAll" && message.arguments()[0].toString() != "com.canonical.Unity.Launcher.Item") {
138 return false;
138 return false;
139 }
139 }
140
140
141 /* Break down the path to just the app id */
141 /* Break down the path to just the app id */
142 QString pathtemp = message.path();
142 QString pathtemp = message.path();
143− if (!pathtemp.startsWith("/com/canonical/Unity/Launcher2/")) {
143+ if (!pathtemp.startsWith("/com/canonical/Unity/Launcher/")) {
144 return false;
144 return false;
145 }
145 }
146− pathtemp.remove("/com/canonical/Unity/Launcher2/");
146+ pathtemp.remove("/com/canonical/Unity/Launcher/");
147 if (pathtemp.indexOf('/') >= 0) {
147 if (pathtemp.indexOf('/') >= 0) {
148 return false;
148 return false;
149 }
149 }
@@ -194,7 +194,7 @@ bool DBusInterface::handleMessage(const QDBusMessage& message, const QDBusConnec
194
194
195void DBusInterface::emitPropChangedDbus(const QString& appId, const QString& property, const QVariant &value)
195void DBusInterface::emitPropChangedDbus(const QString& appId, const QString& property, const QVariant &value)
196{
196{
197− QString path("/com/canonical/Unity/Launcher2/");
197+ QString path("/com/canonical/Unity/Launcher/");
198 path.append(encodeAppId(appId));
198 path.append(encodeAppId(appId));
199
199
200 QDBusMessage message = QDBusMessage::createSignal(path, "org.freedesktop.DBus.Properties", "PropertiesChanged");
200 QDBusMessage message = QDBusMessage::createSignal(path, "org.freedesktop.DBus.Properties", "PropertiesChanged");