Rename ViewSelector to SearchController

Rename ViewSelector to SearchController, since ViewSelector now effectively
only handles search. Rename the file correspondingly as well.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1667>
This commit is contained in:
Georges Basile Stavracas Neto 2021-01-15 09:59:58 -03:00 committed by Marge Bot
parent 27627bd40a
commit c8f1dca3c7
4 changed files with 22 additions and 21 deletions

View File

@ -94,6 +94,7 @@
<file>ui/screenshot.js</file>
<file>ui/scripting.js</file>
<file>ui/search.js</file>
<file>ui/searchController.js</file>
<file>ui/sessionMode.js</file>
<file>ui/shellDBus.js</file>
<file>ui/shellEntry.js</file>
@ -104,7 +105,6 @@
<file>ui/switchMonitor.js</file>
<file>ui/unlockDialog.js</file>
<file>ui/userWidget.js</file>
<file>ui/viewSelector.js</file>
<file>ui/welcomeDialog.js</file>
<file>ui/windowAttentionHandler.js</file>
<file>ui/windowMenu.js</file>

View File

@ -7,8 +7,8 @@ const AppDisplay = imports.ui.appDisplay;
const Dash = imports.ui.dash;
const Main = imports.ui.main;
const Overview = imports.ui.overview;
const SearchController = imports.ui.searchController;
const Util = imports.misc.util;
const ViewSelector = imports.ui.viewSelector;
const WindowManager = imports.ui.windowManager;
const WorkspaceThumbnail = imports.ui.workspaceThumbnail;
const WorkspacesView = imports.ui.workspacesView;
@ -26,7 +26,7 @@ var ControlsState = {
var ControlsManagerLayout = GObject.registerClass(
class ControlsManagerLayout extends Clutter.BoxLayout {
_init(searchEntry, appDisplay, workspacesDisplay, workspacesThumbnails,
viewSelector, dash, stateAdjustment) {
searchController, dash, stateAdjustment) {
super._init({ orientation: Clutter.Orientation.VERTICAL });
this._appDisplay = appDisplay;
@ -34,7 +34,7 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
this._workspacesThumbnails = workspacesThumbnails;
this._stateAdjustment = stateAdjustment;
this._searchEntry = searchEntry;
this._viewSelector = viewSelector;
this._searchController = searchController;
this._dash = dash;
this._cachedWorkspaceBoxes = new Map();
@ -178,11 +178,11 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
}
this._appDisplay.allocate(appDisplayBox);
// ViewSelector
// Search
childBox.set_origin(0, searchHeight + spacing);
childBox.set_size(width, availableHeight);
this._viewSelector.allocate(childBox);
this._searchController.allocate(childBox);
}
getWorkspacesBoxForState(state) {
@ -285,9 +285,10 @@ class ControlsManager extends St.Widget {
workspaceManager.connect('notify::n-workspaces',
this._updateAdjustment.bind(this));
this.viewSelector = new ViewSelector.ViewSelector(this._searchEntry,
this._searchController = new SearchController.SearchController(
this._searchEntry,
this.dash.showAppsButton);
this.viewSelector.connect('notify::search-active', this._onSearchChanged.bind(this));
this._searchController.connect('notify::search-active', this._onSearchChanged.bind(this));
this._thumbnailsBox =
new WorkspaceThumbnail.ThumbnailsBox(this._workspaceAdjustment);
@ -300,7 +301,7 @@ class ControlsManager extends St.Widget {
this.add_child(searchEntryBin);
this.add_child(this._appDisplay);
this.add_child(this.dash);
this.add_child(this.viewSelector);
this.add_child(this._searchController);
this.add_child(this._thumbnailsBox);
this.add_child(this._workspacesDisplay);
@ -308,7 +309,7 @@ class ControlsManager extends St.Widget {
this._appDisplay,
this._workspacesDisplay,
this._thumbnailsBox,
this.viewSelector,
this._searchController,
this.dash,
this._stateAdjustment);
@ -402,7 +403,7 @@ class ControlsManager extends St.Widget {
}
_updateThumbnailsBox(animate = false) {
const { searchActive } = this.viewSelector;
const { searchActive } = this._searchController;
const [opacity, scale, translationY] = this._getThumbnailsBoxParams();
const thumbnailsBoxVisible = !searchActive && opacity !== 0;
@ -442,14 +443,14 @@ class ControlsManager extends St.Widget {
}
_onSearchChanged() {
const { searchActive } = this.viewSelector;
const { searchActive } = this._searchController;
if (!searchActive) {
this._appDisplay.show();
this._workspacesDisplay.reactive = true;
this._workspacesDisplay.setPrimaryWorkspaceVisible(true);
} else {
this.viewSelector.show();
this._searchController.show();
}
this._updateThumbnailsBox(true);
@ -469,11 +470,11 @@ class ControlsManager extends St.Widget {
this._workspacesDisplay.setPrimaryWorkspaceVisible(!searchActive);
},
});
this.viewSelector.ease({
this._searchController.ease({
opacity: searchActive ? 255 : 0,
duration: SIDE_CONTROLS_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onComplete: () => (this.viewSelector.visible = searchActive),
onComplete: () => (this._searchController.visible = searchActive),
});
}
@ -526,7 +527,7 @@ class ControlsManager extends St.Widget {
animateToOverview(state, callback) {
this._ignoreShowAppsButtonToggle = true;
this.viewSelector.prepareToEnterOverview();
this._searchController.prepareToEnterOverview();
this._workspacesDisplay.prepareToEnterOverview();
if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows())
Main.overview.fadeOutDesktop();

View File

@ -1,5 +1,5 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported ViewSelector */
/* exported SearchController */
const { Clutter, GObject, St } = imports.gi;
@ -26,17 +26,17 @@ function getTermsForSearchString(searchString) {
return terms;
}
var ViewSelector = GObject.registerClass({
var SearchController = GObject.registerClass({
Properties: {
'search-active': GObject.ParamSpec.boolean(
'search-active', 'search-active', 'search-active',
GObject.ParamFlags.READABLE,
false),
},
}, class ViewSelector extends St.Widget {
}, class SearchController extends St.Widget {
_init(searchEntry, showAppsButton) {
super._init({
name: 'viewSelector',
name: 'searchController',
layout_manager: new Clutter.BinLayout(),
x_expand: true,
y_expand: true,

View File

@ -49,6 +49,7 @@ js/ui/runDialog.js
js/ui/screenShield.js
js/ui/screenshot.js
js/ui/search.js
js/ui/searchController.js
js/ui/shellEntry.js
js/ui/shellMountOperation.js
js/ui/status/accessibility.js
@ -67,7 +68,6 @@ js/ui/status/thunderbolt.js
js/ui/status/volume.js
js/ui/switchMonitor.js
js/ui/unlockDialog.js
js/ui/viewSelector.js
js/ui/welcomeDialog.js
js/ui/windowAttentionHandler.js
js/ui/windowManager.js