overview: Provide public access for search provider registration

Provide a reasonably public way to register and unregister search
providers, without adding too much API.

`Main.overview.searchController` provides access that may be generally
useful, while `SearchController.addProvider()` and
`SearchController.removeProvider()` provide a simple interface for
extensions.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2783>
This commit is contained in:
Andy Holmes 2023-06-01 15:54:59 -07:00 committed by Andy Holmes
parent e1145defa9
commit 32b9109967
3 changed files with 32 additions and 0 deletions

View File

@ -102,6 +102,10 @@ class OverviewActor extends St.BoxLayout {
return this._controls.dash; return this._controls.dash;
} }
get searchController() {
return this._controls.searchController;
}
get searchEntry() { get searchEntry() {
return this._controls.searchEntry; return this._controls.searchEntry;
} }
@ -708,6 +712,10 @@ var Overview = class extends Signals.EventEmitter {
return this.dash.showAppsButton; return this.dash.showAppsButton;
} }
get searchController() {
return this._overview.searchController;
}
get searchEntry() { get searchEntry() {
return this._overview.searchEntry; return this._overview.searchEntry;
} }

View File

@ -871,6 +871,10 @@ class ControlsManager extends St.Widget {
}); });
} }
get searchController() {
return this._searchController;
}
get searchEntry() { get searchEntry() {
return this._searchEntry; return this._searchEntry;
} }

View File

@ -320,6 +320,26 @@ var SearchController = GObject.registerClass({
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
} }
/**
* addProvider:
* @param {object} provider - a search provider implementation
*
* Add a search provider to the controller.
*/
addProvider(provider) {
this._searchResults._registerProvider(provider);
}
/**
* removeProvider:
* @param {object} provider - a search provider implementation
*
* Remove a search provider from the controller.
*/
removeProvider(provider) {
this._searchResults._unregisterProvider(provider);
}
get searchActive() { get searchActive() {
return this._searchActive; return this._searchActive;
} }