From 301686ee5fd1226201cb57843567fdead1dc5b48 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Wed, 30 Dec 2020 17:02:14 -0300 Subject: [PATCH] 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: --- .../gnome-shell-sass/widgets/_overview.scss | 4 +++ js/ui/overview.js | 22 ++-------------- js/ui/overviewControls.js | 25 +++++++++++++++++-- 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/data/theme/gnome-shell-sass/widgets/_overview.scss b/data/theme/gnome-shell-sass/widgets/_overview.scss index b429bcf0c..eb62ba68f 100644 --- a/data/theme/gnome-shell-sass/widgets/_overview.scss +++ b/data/theme/gnome-shell-sass/widgets/_overview.scss @@ -4,6 +4,10 @@ spacing: 24px; } +#overview-group { + spacing: 24px; +} + #overviewGroup { background-color: $system_bg_color; } diff --git a/js/ui/overview.js b/js/ui/overview.js index 72bf82061..e29868022 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -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() { diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js index b27a1d9f6..911576c4e 100644 --- a/js/ui/overviewControls.js +++ b/js/ui/overviewControls.js @@ -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; + } });