@@ -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,15 +413,23 @@ void LauncherBackend::loadFromVariant(const QVariantMap &details)
400413 }
401414 QString appId = details.value("id").toString();
402415
416+ QString desktopFile = findDesktopFile(appId);
417+ if (desktopFile.isEmpty()) {
418+ return;
419+ }
420+
403421 LauncherBackendItem *item = m_itemCache.value(appId, nullptr);
404422 if (item) {
405423 delete item;
406424 }
407425
408− item = new LauncherBackendItem();
409−
410− item->displayName = details.value("name").toString();
411− item->icon = details.value("icon").toString();
426+ if (qgetenv("USER") == "lightdm") {
427+ item = new LauncherBackendItem();
428+ item->displayName = details.value("name").toString();
429+ item->icon = details.value("icon").toString();
430+ } else {
431+ item = parseDesktopFile(desktopFile);
432+ }
412433 item->count = details.value("count").toInt();
413434 item->countVisible = details.value("countVisible").toBool();
414435
@@ -442,6 +463,16 @@ bool LauncherBackend::handleMessage(const QDBusMessage& message, const QDBusConn
442463 if (message.type() != QDBusMessage::MessageType::MethodCallMessage) {
443464 return false;
444465 }
466+ // First handle methods of the Launcher interface
467+ if (message.interface() == "com.canonical.Unity.Launcher") {
468+ if (message.member() == "Refresh") {
469+ QDBusMessage reply = message.createReply();
470+ refresh();
471+ return connection.send(reply);
472+ }
473+ }
474+
475+ // Now handle dynamic properties (for launcher emblems)
445476 if (message.interface() != "org.freedesktop.DBus.Properties") {
446477 return false;
447478 }
@@ -491,6 +522,12 @@ QString LauncherBackend::introspect(const QString &path) const
491522 if (path == "/com/canonical/Unity/Launcher/" || path == "/com/canonical/Unity/Launcher") {
492523 QString nodes;
493524
525+ // Add Refresh to introspect
526+ nodes = "<interface name=\"com.canonical.Unity.Launcher\">"
527+ "<method name=\"Refresh\"/>"
528+ "</interface>";
529+
530+ // Add dynamic properties for launcher emblems
494531 Q_FOREACH(const QString &appId, m_itemCache.keys()) {
495532 nodes.append("<node name=\"");
496533 nodes.append(encodeAppId(appId));