From 6e7344b837e8d90593104418d47544687597ddc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 19 Feb 2020 01:52:59 +0100 Subject: [PATCH] dateMenu: Use BindConstraint for indicator pad Now that Clutter.BindConstraint modifies the size request in addition to the allocation, we can use it instead of the custom IndicatorPad widget. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1026 --- js/ui/dateMenu.js | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index 8fb56b192..fbfccfc1b 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -488,26 +488,6 @@ class MessagesIndicator extends St.Icon { } }); -var IndicatorPad = GObject.registerClass( -class IndicatorPad extends St.Widget { - _init(actor) { - this._source = actor; - this._source.connect('notify::size', () => this.queue_relayout()); - super._init(); - this._source.bind_property('visible', - this, 'visible', - GObject.BindingFlags.SYNC_CREATE); - } - - vfunc_get_preferred_width(forHeight) { - return this._source.get_preferred_width(forHeight); - } - - vfunc_get_preferred_height(forWidth) { - return this._source.get_preferred_height(forWidth); - } -}); - var FreezableBinLayout = GObject.registerClass( class FreezableBinLayout extends Clutter.BinLayout { _init() { @@ -576,8 +556,17 @@ class DateMenuButton extends PanelMenu.Button { this._clockDisplay = new St.Label({ y_align: Clutter.ActorAlign.CENTER }); this._indicator = new MessagesIndicator(); + const indicatorPad = new St.Widget(); + this._indicator.bind_property('visible', + indicatorPad, 'visible', + GObject.BindingFlags.SYNC_CREATE); + indicatorPad.add_constraint(new Clutter.BindConstraint({ + source: this._indicator, + coordinate: Clutter.BindCoordinate.SIZE, + })); + let box = new St.BoxLayout({ style_class: 'clock-display-box' }); - box.add_actor(new IndicatorPad(this._indicator)); + box.add_actor(indicatorPad); box.add_actor(this._clockDisplay); box.add_actor(this._indicator);