From 71cad8cd3f7c06f28be11fa27ca349920347f2d1 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Wed, 17 Jun 2009 18:37:54 +0200 Subject: [PATCH] Fix a regression: search in the overlay not working anymore With commit a3d35af444445b92b3fe2475ebef4e282b8c34d1 variable itemInfo in js/ui/appDisplay.js was changed to a new object (AppInfo from js/misc/appInfo.js) but some of the code in js/ui/appDisplay.js wasn't updated accordingly. This commit fixes that and makes the search box in the overlay usable again. --- js/misc/appInfo.js | 2 ++ js/ui/appDisplay.js | 18 +++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/js/misc/appInfo.js b/js/misc/appInfo.js index c7bf9c7a4..d77b14746 100644 --- a/js/misc/appInfo.js +++ b/js/misc/appInfo.js @@ -44,8 +44,10 @@ AppInfo.prototype = { if (!this._gAppInfo) throw new Error('Unknown appId ' + appId); + this.id = this._gAppInfo.get_id(); this.name = this._gAppInfo.get_name(); this.description = this._gAppInfo.get_description(); + this.executable = this._gAppInfo.get_executable(); this._gicon = this._gAppInfo.get_icon(); }, diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index ab53772fe..883421570 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -374,7 +374,7 @@ AppDisplay.prototype = { _compareItems : function(itemIdA, itemIdB) { let appA = this._allItems[itemIdA]; let appB = this._allItems[itemIdB]; - return appA.get_name().localeCompare(appB.get_name()); + return appA.name.localeCompare(appB.name); }, // Checks if the item info can be a match for the search string by checking @@ -391,7 +391,7 @@ AppDisplay.prototype = { }, _isInfoMatchingMenu : function(itemInfo, search) { - let id = itemInfo.get_id(); + let id = itemInfo.id; for (let i = 0; i < this._activeMenuApps.length; i++) { let activeId = this._activeMenuApps[i]; if (activeId == id) @@ -404,27 +404,27 @@ AppDisplay.prototype = { if (search == null || search == '') return true; - let name = itemInfo.get_name().toLowerCase(); + let name = itemInfo.name.toLowerCase(); if (name.indexOf(search) >= 0) return true; - let description = itemInfo.get_description(); + let description = itemInfo.description; if (description) { description = description.toLowerCase(); if (description.indexOf(search) >= 0) return true; } - if (itemInfo.get_executable() == null) { - log("Missing an executable for " + itemInfo.get_name()); + if (itemInfo.executable == null) { + log("Missing an executable for " + itemInfo.name); } else { - let exec = itemInfo.get_executable().toLowerCase(); + let exec = itemInfo.executable.toLowerCase(); if (exec.indexOf(search) >= 0) return true; } - // we expect this._appCategories.hasOwnProperty(itemInfo.get_id()) to always be true here - let categories = this._appCategories[itemInfo.get_id()]; + // we expect this._appCategories.hasOwnProperty(itemInfo.id) to always be true here + let categories = this._appCategories[itemInfo.id]; for (let i = 0; i < categories.length; i++) { let category = categories[i].toLowerCase(); if (category.indexOf(search) >= 0)