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>
This commit is contained in:
Georges Basile Stavracas Neto 2020-11-27 11:07:03 -03:00 committed by Marge Bot
parent 491a69a5a2
commit c9a6424f2e

View File

@ -361,24 +361,15 @@ class DashSlider extends SlidingControl {
}); });
var DashSpacer = GObject.registerClass( var DashSpacer = GObject.registerClass(
class DashSpacer extends St.Widget { class DashSpacer extends Clutter.Actor {
_init(params) { _init(source) {
super._init(params); super._init();
this._bindConstraint = null; this._bindConstraint = new Clutter.BindConstraint({
} source,
coordinate: Clutter.BindCoordinate.SIZE,
setDashActor(dashActor) { });
if (this._bindConstraint) { this.add_constraint(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);
}
} }
vfunc_get_preferred_width(forHeight) { vfunc_get_preferred_width(forHeight) {
@ -406,8 +397,7 @@ class ControlsManager extends St.Widget {
this.dash = new Dash.Dash(); this.dash = new Dash.Dash();
this._dashSlider = new DashSlider(this.dash); this._dashSlider = new DashSlider(this.dash);
this._dashSpacer = new DashSpacer(); this._dashSpacer = new DashSpacer(this._dashSlider);
this._dashSpacer.setDashActor(this._dashSlider);
let workspaceManager = global.workspace_manager; let workspaceManager = global.workspace_manager;
let activeWorkspaceIndex = workspaceManager.get_active_workspace_index(); let activeWorkspaceIndex = workspaceManager.get_active_workspace_index();