@@ -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,15 +413,23 @@ void LauncherBackend::loadFromVariant(const QVariantMap &details)
401 QString appId = details.value("id").toString();
414 QString appId = details.value("id").toString();
416+ QString desktopFile = findDesktopFile(appId);
417+ if (desktopFile.isEmpty()) {
403 LauncherBackendItem *item = m_itemCache.value(appId, nullptr);
421 LauncherBackendItem *item = m_itemCache.value(appId, nullptr);
404 if (item) {
422 if (item) {
405 delete item;
423 delete item;
426+ if (qgetenv("USER") == "lightdm") {
408− item = new LauncherBackendItem();
427+ item = new LauncherBackendItem();
410− item->displayName = details.value("name").toString();
428+ item->displayName = details.value("name").toString();
411− item->icon = details.value("icon").toString();
429+ item->icon = details.value("icon").toString();
431+ item = parseDesktopFile(desktopFile);
412 item->count = details.value("count").toInt();
433 item->count = details.value("count").toInt();
413 item->countVisible = details.value("countVisible").toBool();
434 item->countVisible = details.value("countVisible").toBool();
@@ -442,6 +463,16 @@ bool LauncherBackend::handleMessage(const QDBusMessage& message, const QDBusConn
442 if (message.type() != QDBusMessage::MessageType::MethodCallMessage) {
463 if (message.type() != QDBusMessage::MessageType::MethodCallMessage) {
443 return false;
464 return false;
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();
471+ return connection.send(reply);
475+ // Now handle dynamic properties (for launcher emblems)
445 if (message.interface() != "org.freedesktop.DBus.Properties") {
476 if (message.interface() != "org.freedesktop.DBus.Properties") {
446 return false;
477 return false;
@@ -491,6 +522,12 @@ QString LauncherBackend::introspect(const QString &path) const
491 if (path == "/com/canonical/Unity/Launcher/" || path == "/com/canonical/Unity/Launcher") {
522 if (path == "/com/canonical/Unity/Launcher/" || path == "/com/canonical/Unity/Launcher") {
492 QString nodes;
523 QString nodes;
525+ // Add Refresh to introspect
526+ nodes = "<interface name=\"com.canonical.Unity.Launcher\">"
527+ "<method name=\"Refresh\"/>"
530+ // Add dynamic properties for launcher emblems
494 Q_FOREACH(const QString &appId, m_itemCache.keys()) {
531 Q_FOREACH(const QString &appId, m_itemCache.keys()) {
495 nodes.append("<node name=\"");
532 nodes.append("<node name=\"");
496 nodes.append(encodeAppId(appId));
533 nodes.append(encodeAppId(appId));