@@ -314,6 +314,19 @@ void LauncherBackend::syncToAccounts()
314314 }
315315}
316316
317+void LauncherBackend::refresh()
318+{
319+ QList<QString> removedApps;
320+ Q_FOREACH (const QString &appId, m_storedApps) {
321+ if (findDesktopFile(appId).isEmpty()) {
322+ removedApps << appId;
323+ }
324+ }
325+ Q_FOREACH (const QString &appId, removedApps) {
326+ Q_EMIT appUninstalled(appId);
327+ }
328+}
329+
317330QString LauncherBackend::findDesktopFile(const QString &appId) const
318331{
319332 int dashPos = -1;
@@ -400,6 +413,10 @@ void LauncherBackend::loadFromVariant(const QVariantMap &details)
400413 }
401414 QString appId = details.value("id").toString();
402415
416+ if (findDesktopFile(appId).isEmpty()) {
417+ return;
418+ }
419+
403420 LauncherBackendItem *item = m_itemCache.value(appId, nullptr);
404421 if (item) {
405422 delete item;
@@ -442,6 +459,16 @@ bool LauncherBackend::handleMessage(const QDBusMessage& message, const QDBusConn
442459 if (message.type() != QDBusMessage::MessageType::MethodCallMessage) {
443460 return false;
444461 }
462+ // First handle methods of the Launcher interface
463+ if (message.interface() == "com.canonical.Unity.Launcher") {
464+ if (message.member() == "Refresh") {
465+ QDBusMessage reply = message.createReply();
466+ refresh();
467+ return connection.send(reply);
468+ }
469+ }
470+
471+ // Now handle dynamic properties (for launcher emblems)
445472 if (message.interface() != "org.freedesktop.DBus.Properties") {
446473 return false;
447474 }
@@ -491,6 +518,12 @@ QString LauncherBackend::introspect(const QString &path) const
491518 if (path == "/com/canonical/Unity/Launcher/" || path == "/com/canonical/Unity/Launcher") {
492519 QString nodes;
493520
521+ // Add Refresh to introspect
522+ nodes = "<interface name=\"com.canonical.Unity.Launcher\">"
523+ "<method name=\"Refresh\"/>"
524+ "</interface>";
525+
526+ // Add dynamic properties for launcher emblems
494527 Q_FOREACH(const QString &appId, m_itemCache.keys()) {
495528 nodes.append("<node name=\"");
496529 nodes.append(encodeAppId(appId));