overview: Move search entry to ControlsManager

Next commit will tie all these widgets up with a single
layout manager, and we need to control the search entry
position.

Move it to OverviewControls.ControlsManager.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1624>
This commit is contained in:
Georges Basile Stavracas Neto 2020-12-30 17:02:14 -03:00 committed by Marge Bot
parent d02612e790
commit 301686ee5f
3 changed files with 29 additions and 22 deletions

View File

@ -4,6 +4,10 @@
spacing: 24px;
}
#overview-group {
spacing: 24px;
}
#overviewGroup {
background-color: $system_bg_color;
}

View File

@ -92,26 +92,8 @@ class OverviewActor extends St.BoxLayout {
});
this.add_actor(panelGhost);
this._searchEntry = new St.Entry({
style_class: 'search-entry',
/* Translators: this is the text displayed
in the search entry when no search is
active; it should not exceed ~30
characters. */
hint_text: _('Type to search'),
track_hover: true,
can_focus: true,
});
this._searchEntry.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS);
let searchEntryBin = new St.Bin({
child: this._searchEntry,
x_align: Clutter.ActorAlign.CENTER,
});
this.add_actor(searchEntryBin);
this._controls = new OverviewControls.ControlsManager(this._searchEntry);
// Add our same-line elements after the search entry
this._controls = new OverviewControls.ControlsManager();
this.add_child(this._controls);
}
@ -120,7 +102,7 @@ class OverviewActor extends St.BoxLayout {
}
get searchEntry() {
return this._searchEntry;
return this._controls.searchEntry;
}
get viewSelector() {

View File

@ -8,7 +8,7 @@ const ViewSelector = imports.ui.viewSelector;
var ControlsManager = GObject.registerClass(
class ControlsManager extends St.Widget {
_init(searchEntry) {
_init() {
super._init({
layout_manager: new Clutter.BinLayout(),
x_expand: true,
@ -16,6 +16,22 @@ class ControlsManager extends St.Widget {
clip_to_allocation: true,
});
this._searchEntry = new St.Entry({
style_class: 'search-entry',
/* Translators: this is the text displayed
in the search entry when no search is
active; it should not exceed ~30
characters. */
hint_text: _('Type to search'),
track_hover: true,
can_focus: true,
});
this._searchEntry.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS);
const searchEntryBin = new St.Bin({
child: this._searchEntry,
x_align: Clutter.ActorAlign.CENTER,
});
this.dash = new Dash.Dash();
let workspaceManager = global.workspace_manager;
@ -35,7 +51,7 @@ class ControlsManager extends St.Widget {
workspaceManager.connect('notify::n-workspaces',
this._updateAdjustment.bind(this));
this.viewSelector = new ViewSelector.ViewSelector(searchEntry,
this.viewSelector = new ViewSelector.ViewSelector(this._searchEntry,
this._workspaceAdjustment, this.dash.showAppsButton);
this._group = new St.BoxLayout({
@ -46,6 +62,7 @@ class ControlsManager extends St.Widget {
});
this.add_actor(this._group);
this._group.add_child(searchEntryBin);
this._group.add_child(this.viewSelector);
this._group.add_actor(this.dash);
@ -68,4 +85,8 @@ class ControlsManager extends St.Widget {
this._workspaceAdjustment.remove_transition('value');
this._workspaceAdjustment.value = activeIndex;
}
get searchEntry() {
return this._searchEntry;
}
});