From c8f1dca3c7e9bdf22c2f82ab0b66b009d9763685 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Fri, 15 Jan 2021 09:59:58 -0300 Subject: [PATCH] Rename ViewSelector to SearchController Rename ViewSelector to SearchController, since ViewSelector now effectively only handles search. Rename the file correspondingly as well. Part-of: --- js/js-resources.gresource.xml | 2 +- js/ui/overviewControls.js | 31 ++++++++++--------- .../{viewSelector.js => searchController.js} | 8 ++--- po/POTFILES.in | 2 +- 4 files changed, 22 insertions(+), 21 deletions(-) rename js/ui/{viewSelector.js => searchController.js} (98%) diff --git a/js/js-resources.gresource.xml b/js/js-resources.gresource.xml index 45b5de436..e65e0e9cf 100644 --- a/js/js-resources.gresource.xml +++ b/js/js-resources.gresource.xml @@ -94,6 +94,7 @@ ui/screenshot.js ui/scripting.js ui/search.js + ui/searchController.js ui/sessionMode.js ui/shellDBus.js ui/shellEntry.js @@ -104,7 +105,6 @@ ui/switchMonitor.js ui/unlockDialog.js ui/userWidget.js - ui/viewSelector.js ui/welcomeDialog.js ui/windowAttentionHandler.js ui/windowMenu.js diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js index 4e2c3f8cd..dcc93bb44 100644 --- a/js/ui/overviewControls.js +++ b/js/ui/overviewControls.js @@ -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(); diff --git a/js/ui/viewSelector.js b/js/ui/searchController.js similarity index 98% rename from js/ui/viewSelector.js rename to js/ui/searchController.js index 210598d8c..75e27d048 100644 --- a/js/ui/viewSelector.js +++ b/js/ui/searchController.js @@ -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, diff --git a/po/POTFILES.in b/po/POTFILES.in index 37f656903..cb279c1ee 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -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