2008-12-19 23:27:57 -05:00
|
|
|
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
|
|
|
2009-11-29 17:45:30 -05:00
|
|
|
const Gettext = imports.gettext.domain('gnome-shell');
|
|
|
|
const _ = Gettext.gettext;
|
2008-12-19 23:27:57 -05:00
|
|
|
|
2009-06-16 12:20:12 -04:00
|
|
|
const DocInfo = imports.misc.docInfo;
|
2009-11-29 17:45:30 -05:00
|
|
|
const Search = imports.ui.search;
|
2008-12-19 23:27:57 -05:00
|
|
|
|
2009-09-25 14:54:40 -04:00
|
|
|
|
2009-11-29 17:45:30 -05:00
|
|
|
function DocSearchProvider() {
|
|
|
|
this._init();
|
|
|
|
}
|
|
|
|
|
|
|
|
DocSearchProvider.prototype = {
|
|
|
|
__proto__: Search.SearchProvider.prototype,
|
|
|
|
|
|
|
|
_init: function(name) {
|
2009-12-25 12:41:58 -05:00
|
|
|
Search.SearchProvider.prototype._init.call(this, _("RECENT ITEMS"));
|
2009-11-29 17:45:30 -05:00
|
|
|
this._docManager = DocInfo.getDocManager();
|
|
|
|
},
|
|
|
|
|
|
|
|
getResultMeta: function(resultId) {
|
|
|
|
let docInfo = this._docManager.lookupByUri(resultId);
|
|
|
|
if (!docInfo)
|
|
|
|
return null;
|
|
|
|
return { 'id': resultId,
|
|
|
|
'name': docInfo.name,
|
|
|
|
'icon': docInfo.createIcon(Search.RESULT_ICON_SIZE)};
|
|
|
|
},
|
|
|
|
|
|
|
|
activateResult: function(id) {
|
|
|
|
let docInfo = this._docManager.lookupByUri(id);
|
|
|
|
docInfo.launch();
|
|
|
|
},
|
|
|
|
|
|
|
|
getInitialResultSet: function(terms) {
|
|
|
|
return this._docManager.initialSearch(terms);
|
|
|
|
},
|
|
|
|
|
|
|
|
getSubsearchResultSet: function(previousResults, terms) {
|
|
|
|
return this._docManager.subsearch(previousResults, terms);
|
|
|
|
},
|
|
|
|
|
|
|
|
expandSearch: function(terms) {
|
2010-05-13 15:46:04 -04:00
|
|
|
log('TODO expand docs search');
|
2009-11-29 17:45:30 -05:00
|
|
|
}
|
|
|
|
};
|