[gnome-shell] dateMenu: Use BindConstraint for indicator pad
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] dateMenu: Use BindConstraint for indicator pad
- Date: Wed, 19 Feb 2020 12:51:55 +0000 (UTC)
commit 6e7344b837e8d90593104418d47544687597ddc6
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Feb 19 01:52:59 2020 +0100
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 8fb56b1921..fbfccfc1b4 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]