@@ -314,6 +314,19 @@ void LauncherBackend::syncToAccounts()
317+void LauncherBackend::refresh()
319+ QList<QString> removedApps;
320+ Q_FOREACH (const QString &appId, m_storedApps) {
321+ if (findDesktopFile(appId).isEmpty()) {
322+ removedApps << appId;
325+ Q_FOREACH (const QString &appId, removedApps) {
326+ Q_EMIT appUninstalled(appId);
317QString LauncherBackend::findDesktopFile(const QString &appId) const
330QString LauncherBackend::findDesktopFile(const QString &appId) const
319 int dashPos = -1;
332 int dashPos = -1;
@@ -400,6 +413,10 @@ void LauncherBackend::loadFromVariant(const QVariantMap &details)
401 QString appId = details.value("id").toString();
414 QString appId = details.value("id").toString();
416+ if (findDesktopFile(appId).isEmpty()) {
403 LauncherBackendItem *item = m_itemCache.value(appId, nullptr);
420 LauncherBackendItem *item = m_itemCache.value(appId, nullptr);
404 if (item) {
421 if (item) {
405 delete item;
422 delete item;
@@ -442,6 +459,16 @@ bool LauncherBackend::handleMessage(const QDBusMessage& message, const QDBusConn
442 if (message.type() != QDBusMessage::MessageType::MethodCallMessage) {
459 if (message.type() != QDBusMessage::MessageType::MethodCallMessage) {
443 return false;
460 return false;
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();
467+ return connection.send(reply);
471+ // Now handle dynamic properties (for launcher emblems)
445 if (message.interface() != "org.freedesktop.DBus.Properties") {
472 if (message.interface() != "org.freedesktop.DBus.Properties") {
446 return false;
473 return false;
@@ -491,6 +518,12 @@ QString LauncherBackend::introspect(const QString &path) const
491 if (path == "/com/canonical/Unity/Launcher/" || path == "/com/canonical/Unity/Launcher") {
518 if (path == "/com/canonical/Unity/Launcher/" || path == "/com/canonical/Unity/Launcher") {
492 QString nodes;
519 QString nodes;
521+ // Add Refresh to introspect
522+ nodes = "<interface name=\"com.canonical.Unity.Launcher\">"
523+ "<method name=\"Refresh\"/>"
526+ // Add dynamic properties for launcher emblems
494 Q_FOREACH(const QString &appId, m_itemCache.keys()) {
527 Q_FOREACH(const QString &appId, m_itemCache.keys()) {
495 nodes.append("<node name=\"");
528 nodes.append("<node name=\"");
496 nodes.append(encodeAppId(appId));
529 nodes.append(encodeAppId(appId));