diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 883421570..3eefc5011 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -208,6 +208,7 @@ AppDisplay.prototype = { this._redisplayMenus(); })); this._appMonitor.connect('changed', Lang.bind(this, function(monitor) { + this._appsStale = true; this._redisplay(false); })); @@ -316,18 +317,23 @@ AppDisplay.prototype = { } }, - _addApp: function(appId) { + _addAppForId: function(appId) { let appInfo = AppInfo.getAppInfo(appId); if (appInfo != null) { - this._allItems[appId] = appInfo; - // [] is returned if we could not get the categories or the list of categories was empty - let categories = Shell.get_categories_for_desktop_file(appId); - this._appCategories[appId] = categories; + this._addApp(appInfo); } else { log("appInfo for " + appId + " was not found."); } }, + _addApp: function(appInfo) { + let appId = appInfo.id; + this._allItems[appId] = appInfo; + // [] is returned if we could not get the categories or the list of categories was empty + let categories = Shell.get_categories_for_desktop_file(appId); + this._appCategories[appId] = categories; + }, + //// Protected method overrides //// // Gets information about all applications by calling Gio.app_info_get_all(). @@ -347,7 +353,7 @@ AppDisplay.prototype = { let menuApps = this._appSystem.get_applications_for_menu(menu.id); for (let j = 0; j < menuApps.length; j++) { let appId = menuApps[j]; - this._addApp(appId); + this._addAppForId(appId); } } @@ -356,9 +362,18 @@ AppDisplay.prototype = { let settings = this._appSystem.get_all_settings(); for (let i = 0; i < settings.length; i++) { let appId = settings[i]; - this._addApp(appId); + this._addAppForId(appId); } + // Some applications, such as Evince, might not be in the menus, + // but might be returned by the applications monitor as most used + // applications, in which case we include them. + let mostUsedAppInfos = AppInfo.getMostUsedApps(MAX_ITEMS); + for (let i = 0; i < mostUsedAppInfos.length; i++) { + let appInfo = mostUsedAppInfos[i]; + this._addApp(appInfo); + } + this._appsStale = false; },