overview: Move the entry out of the SearchTab into the overview
The entry should be positioned in the center of the overview. This makes that its position can’t be set in the viewSelector without making things overly complicated. Therefore we move the entry to the overview. https://bugzilla.gnome.org/show_bug.cgi?id=682109
This commit is contained in:
parent
b5dc78a968
commit
0ea2d98768
@ -185,7 +185,17 @@ const Overview = new Lang.Class({
|
|||||||
|
|
||||||
this._shellInfo = new ShellInfo();
|
this._shellInfo = new ShellInfo();
|
||||||
|
|
||||||
this._viewSelector = new ViewSelector.ViewSelector();
|
this._searchEntry = new St.Entry({ name: 'searchEntry',
|
||||||
|
/* 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._group.add_actor(this._searchEntry);
|
||||||
|
|
||||||
|
this._viewSelector = new ViewSelector.ViewSelector(this._searchEntry);
|
||||||
this._group.add_actor(this._viewSelector.actor);
|
this._group.add_actor(this._viewSelector.actor);
|
||||||
|
|
||||||
// TODO - recalculate everything when desktop size changes
|
// TODO - recalculate everything when desktop size changes
|
||||||
@ -477,10 +487,15 @@ const Overview = new Lang.Class({
|
|||||||
this._coverPane.set_position(0, contentY);
|
this._coverPane.set_position(0, contentY);
|
||||||
this._coverPane.set_size(primary.width, contentHeight);
|
this._coverPane.set_size(primary.width, contentHeight);
|
||||||
|
|
||||||
|
let searchWidth = this._searchEntry.get_width();
|
||||||
|
let searchHeight = this._searchEntry.get_height();
|
||||||
|
let searchX = (primary.width - searchWidth) / 2;
|
||||||
|
let searchY = contentY + this._spacing;
|
||||||
|
|
||||||
let dashWidth = Math.round(DASH_SPLIT_FRACTION * primary.width);
|
let dashWidth = Math.round(DASH_SPLIT_FRACTION * primary.width);
|
||||||
let viewWidth = primary.width - dashWidth - this._spacing;
|
let viewWidth = primary.width - dashWidth - this._spacing;
|
||||||
let viewHeight = contentHeight - 2 * this._spacing;
|
let viewHeight = contentHeight - 2 * this._spacing - searchHeight;
|
||||||
let viewY = contentY + this._spacing;
|
let viewY = contentY + this._spacing + searchHeight;
|
||||||
let viewX = rtl ? 0 : dashWidth + this._spacing;
|
let viewX = rtl ? 0 : dashWidth + this._spacing;
|
||||||
|
|
||||||
// Set the dash's x position - y is handled by a constraint
|
// Set the dash's x position - y is handled by a constraint
|
||||||
@ -493,6 +508,7 @@ const Overview = new Lang.Class({
|
|||||||
}
|
}
|
||||||
this._dash.actor.set_x(dashX);
|
this._dash.actor.set_x(dashX);
|
||||||
|
|
||||||
|
this._searchEntry.set_position(searchX, searchY);
|
||||||
this._viewSelector.actor.set_position(viewX, viewY);
|
this._viewSelector.actor.set_position(viewX, viewY);
|
||||||
this._viewSelector.actor.set_size(viewWidth, viewHeight);
|
this._viewSelector.actor.set_size(viewWidth, viewHeight);
|
||||||
},
|
},
|
||||||
|
@ -102,21 +102,14 @@ const SearchTab = new Lang.Class({
|
|||||||
Name: 'SearchTab',
|
Name: 'SearchTab',
|
||||||
Extends: BaseTab,
|
Extends: BaseTab,
|
||||||
|
|
||||||
_init: function() {
|
_init: function(searchEntry) {
|
||||||
this.active = false;
|
this.active = false;
|
||||||
this._searchPending = false;
|
this._searchPending = false;
|
||||||
this._searchTimeoutId = 0;
|
this._searchTimeoutId = 0;
|
||||||
|
|
||||||
this._searchSystem = new Search.SearchSystem();
|
this._searchSystem = new Search.SearchSystem();
|
||||||
|
|
||||||
this._entry = new St.Entry({ name: 'searchEntry',
|
this._entry = searchEntry;
|
||||||
/* 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 });
|
|
||||||
ShellEntry.addContextMenu(this._entry);
|
ShellEntry.addContextMenu(this._entry);
|
||||||
this._text = this._entry.clutter_text;
|
this._text = this._entry.clutter_text;
|
||||||
this._text.connect('key-press-event', Lang.bind(this, this._onKeyPress));
|
this._text.connect('key-press-event', Lang.bind(this, this._onKeyPress));
|
||||||
@ -132,7 +125,7 @@ const SearchTab = new Lang.Class({
|
|||||||
this._iconClickedId = 0;
|
this._iconClickedId = 0;
|
||||||
|
|
||||||
this._searchResults = new SearchDisplay.SearchResults(this._searchSystem);
|
this._searchResults = new SearchDisplay.SearchResults(this._searchSystem);
|
||||||
this.parent(this._entry, this._searchResults.actor, _("Search"), 'edit-find');
|
this.parent(new St.Bin() /* Dummy */, this._searchResults.actor, _("Search"), 'edit-find');
|
||||||
|
|
||||||
this._text.connect('text-changed', Lang.bind(this, this._onTextChanged));
|
this._text.connect('text-changed', Lang.bind(this, this._onTextChanged));
|
||||||
this._text.connect('key-press-event', Lang.bind(this, function (o, e) {
|
this._text.connect('key-press-event', Lang.bind(this, function (o, e) {
|
||||||
@ -352,7 +345,7 @@ const SearchTab = new Lang.Class({
|
|||||||
const ViewSelector = new Lang.Class({
|
const ViewSelector = new Lang.Class({
|
||||||
Name: 'ViewSelector',
|
Name: 'ViewSelector',
|
||||||
|
|
||||||
_init : function() {
|
_init : function(searchEntry) {
|
||||||
this.actor = new St.BoxLayout({ name: 'viewSelector',
|
this.actor = new St.BoxLayout({ name: 'viewSelector',
|
||||||
vertical: true });
|
vertical: true });
|
||||||
|
|
||||||
@ -388,7 +381,7 @@ const ViewSelector = new Lang.Class({
|
|||||||
this._tabs = [];
|
this._tabs = [];
|
||||||
this._activeTab = null;
|
this._activeTab = null;
|
||||||
|
|
||||||
this._searchTab = new SearchTab();
|
this._searchTab = new SearchTab(searchEntry);
|
||||||
this._searchArea.set_child(this._searchTab.title);
|
this._searchArea.set_child(this._searchTab.title);
|
||||||
this._addTab(this._searchTab);
|
this._addTab(this._searchTab);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user