Fix a regression: search in the overlay not working anymore

With commit a3d35af444 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.
This commit is contained in:
Siegfried-Angel Gevatter Pujals 2009-06-17 18:37:54 +02:00 committed by Dan Winship
parent a3d35af444
commit 71cad8cd3f
2 changed files with 11 additions and 9 deletions

View File

@ -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();
},

View File

@ -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)