osdWindow: Allow label and level to be null

Allow passing 'null' to setLevel and setLabel, so 'null' and 'undefined'
behave the same way.

Fixes a regression introduced by a42f7c23, which caused parts of old
notifications to persist into new notifications, or elements being
incorrectly made visible

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2917>
This commit is contained in:
Stuart Hayhurst 2023-08-27 19:25:42 +01:00 committed by Florian Müllner
parent 2bb64bc3c4
commit 215282a320

View File

@ -65,15 +65,15 @@ class OsdWindow extends Clutter.Actor {
}
setLabel(label) {
this._label.visible = label !== undefined;
if (label)
this._label.visible = label != null;
if (this._label.visible)
this._label.text = label;
this._updateBoxVisibility();
}
setLevel(value) {
this._level.visible = value !== undefined;
if (value !== undefined) {
this._level.visible = value != null;
if (this._level.visible) {
if (this.visible) {
this._level.ease_property('value', value, {
mode: Clutter.AnimationMode.EASE_OUT_QUAD,