2008-12-20 04:27:57 +00:00
|
|
|
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
|
|
|
2009-06-16 16:20:12 +00:00
|
|
|
const DocInfo = imports.misc.docInfo;
|
2011-01-30 21:09:58 +00:00
|
|
|
const Params = imports.misc.params;
|
2009-11-29 22:45:30 +00:00
|
|
|
const Search = imports.ui.search;
|
2008-12-20 04:27:57 +00:00
|
|
|
|
2009-09-25 18:54:40 +00:00
|
|
|
|
2009-11-29 22:45:30 +00:00
|
|
|
function DocSearchProvider() {
|
|
|
|
this._init();
|
|
|
|
}
|
|
|
|
|
|
|
|
DocSearchProvider.prototype = {
|
|
|
|
__proto__: Search.SearchProvider.prototype,
|
|
|
|
|
|
|
|
_init: function(name) {
|
2009-12-25 17:41:58 +00:00
|
|
|
Search.SearchProvider.prototype._init.call(this, _("RECENT ITEMS"));
|
2009-11-29 22:45:30 +00:00
|
|
|
this._docManager = DocInfo.getDocManager();
|
|
|
|
},
|
|
|
|
|
|
|
|
getResultMeta: function(resultId) {
|
|
|
|
let docInfo = this._docManager.lookupByUri(resultId);
|
|
|
|
if (!docInfo)
|
|
|
|
return null;
|
|
|
|
return { 'id': resultId,
|
|
|
|
'name': docInfo.name,
|
2011-02-28 19:36:52 +00:00
|
|
|
'createIcon': function(size) {
|
|
|
|
return docInfo.createIcon(size);
|
|
|
|
}
|
|
|
|
};
|
2009-11-29 22:45:30 +00:00
|
|
|
},
|
|
|
|
|
2011-01-30 21:09:58 +00:00
|
|
|
activateResult: function(id, params) {
|
2011-08-11 09:35:23 +00:00
|
|
|
params = Params.parse(params, { workspace: -1,
|
|
|
|
timestamp: 0 });
|
2011-01-30 21:09:58 +00:00
|
|
|
|
2009-11-29 22:45:30 +00:00
|
|
|
let docInfo = this._docManager.lookupByUri(id);
|
2011-08-11 09:35:23 +00:00
|
|
|
docInfo.launch(params.workspace);
|
2009-11-29 22:45:30 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
getInitialResultSet: function(terms) {
|
|
|
|
return this._docManager.initialSearch(terms);
|
|
|
|
},
|
|
|
|
|
|
|
|
getSubsearchResultSet: function(previousResults, terms) {
|
|
|
|
return this._docManager.subsearch(previousResults, terms);
|
|
|
|
}
|
|
|
|
};
|