appDisplay: Use the desktop file index for app searching

Rather than scanning all apps for searching, use Ryan's new desktop
file index and the glib support APIs for app searching instead of our
own system.

https://bugzilla.gnome.org/show_bug.cgi?id=711631
This commit is contained in:
Jasper St. Pierre
2013-11-02 20:13:42 -04:00
parent 831bd07b0d
commit ba602c17d4
9 changed files with 26 additions and 422 deletions

View File

@ -889,11 +889,24 @@ const AppSearchProvider = new Lang.Class({
},
getInitialResultSet: function(terms, callback, cancellable) {
callback(this._appSys.initial_search(terms));
let query = terms.join(' ');
let groups = Gio.DesktopAppInfo.search(query);
let usage = Shell.AppUsage.get_default();
let results = [];
groups.forEach(function(group) {
group = group.filter(function(appID) {
let app = Gio.DesktopAppInfo.new(appID);
return app && app.should_show();
});
results = results.concat(group.sort(function(a, b) {
return usage.compare('', a, b);
}));
});
callback(results);
},
getSubsearchResultSet: function(previousResults, terms, callback, cancellable) {
callback(this._appSys.subsearch(previousResults, terms));
this.getInitialResultSet(terms, callback, cancellable);
},
activateResult: function(result) {