diff --git a/src/shell-app-system.c b/src/shell-app-system.c index c7876c725..ac0206c43 100644 --- a/src/shell-app-system.c +++ b/src/shell-app-system.c @@ -96,6 +96,32 @@ scan_startup_wm_class_to_id (ShellAppSystem *self) g_list_free_full (apps, g_object_unref); } +static gboolean +app_is_stale (ShellApp *app) +{ + GDesktopAppInfo *info; + gboolean is_stale; + + if (shell_app_is_window_backed (app)) + return FALSE; + + info = g_desktop_app_info_new (shell_app_get_id (app)); + is_stale = (info == NULL); + + if (info) + g_object_unref (info); + + return is_stale; +} + +static gboolean +stale_app_remove_func (gpointer key, + gpointer value, + gpointer user_data) +{ + return app_is_stale (value); +} + static void installed_changed (GAppInfoMonitor *monitor, gpointer user_data) @@ -104,6 +130,8 @@ installed_changed (GAppInfoMonitor *monitor, scan_startup_wm_class_to_id (self); + g_hash_table_foreach_remove (self->priv->id_to_app, stale_app_remove_func, NULL); + g_signal_emit (self, signals[INSTALLED_CHANGED], 0, NULL); }