[gnome-shell] Rename ViewSelector to SearchController



commit c8f1dca3c7e9bdf22c2f82ab0b66b009d9763685
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Jan 15 09:59:58 2021 -0300

    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>

 js/js-resources.gresource.xml                  |  2 +-
 js/ui/overviewControls.js                      | 31 +++++++++++++-------------
 js/ui/{viewSelector.js => searchController.js} |  8 +++----
 po/POTFILES.in                                 |  2 +-
 4 files changed, 22 insertions(+), 21 deletions(-)
---
diff --git a/js/js-resources.gresource.xml b/js/js-resources.gresource.xml
index 45b5de4362..e65e0e9cfd 100644
--- a/js/js-resources.gresource.xml
+++ b/js/js-resources.gresource.xml
@@ -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>
diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js
index 4e2c3f8cdb..dcc93bb44f 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 210598d8cd..75e27d0483 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 37f6569033..cb279c1ee5 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]