[gnome-shell] overviewControls: Simplify DashSpacer



commit c9a6424f2e652e6e17afe0484fbe9c7d413ac40e
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Nov 27 11:07:03 2020 -0300

    overviewControls: Simplify DashSpacer
    
    Make it subclass ClutterActor, since we don't need any of StWidget's
    features. Pass the source actor of the bind constraint in the
    constructor, and remove the extra method to set the source actor.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1518>

 js/ui/overviewControls.js | 28 +++++++++-------------------
 1 file changed, 9 insertions(+), 19 deletions(-)
---
diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js
index 3d313e7d40..9d18d82f89 100644
--- a/js/ui/overviewControls.js
+++ b/js/ui/overviewControls.js
@@ -361,24 +361,15 @@ class DashSlider extends SlidingControl {
 });
 
 var DashSpacer = GObject.registerClass(
-class DashSpacer extends St.Widget {
-    _init(params) {
-        super._init(params);
-
-        this._bindConstraint = null;
-    }
+class DashSpacer extends Clutter.Actor {
+    _init(source) {
+        super._init();
 
-    setDashActor(dashActor) {
-        if (this._bindConstraint) {
-            this.remove_constraint(this._bindConstraint);
-            this._bindConstraint = null;
-        }
-
-        if (dashActor) {
-            this._bindConstraint = new Clutter.BindConstraint({ source: dashActor,
-                                                                coordinate: Clutter.BindCoordinate.SIZE });
-            this.add_constraint(this._bindConstraint);
-        }
+        this._bindConstraint = new Clutter.BindConstraint({
+            source,
+            coordinate: Clutter.BindCoordinate.SIZE,
+        });
+        this.add_constraint(this._bindConstraint);
     }
 
     vfunc_get_preferred_width(forHeight) {
@@ -406,8 +397,7 @@ class ControlsManager extends St.Widget {
 
         this.dash = new Dash.Dash();
         this._dashSlider = new DashSlider(this.dash);
-        this._dashSpacer = new DashSpacer();
-        this._dashSpacer.setDashActor(this._dashSlider);
+        this._dashSpacer = new DashSpacer(this._dashSlider);
 
         let workspaceManager = global.workspace_manager;
         let activeWorkspaceIndex = workspaceManager.get_active_workspace_index();


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