From f328eee88c4e700a29625e87fd6fc997a138c66b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 22 Nov 2024 19:23:59 +0100 Subject: [PATCH] loginDialog: Split out getBannerText() helper The new methods will make it easier to add alternative sources for the banner text. Part-of: --- js/gdm/loginDialog.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index 27baae83a..c3c397c0d 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -873,11 +873,18 @@ export const LoginDialog = GObject.registerClass({ this._authPrompt.cancelButton.visible = cancelVisible; } - _updateBanner() { - let enabled = this._settings.get_boolean(GdmUtil.BANNER_MESSAGE_KEY); - let text = this._settings.get_string(GdmUtil.BANNER_MESSAGE_TEXT_KEY); + _getBannerText() { + const enabled = this._settings.get_boolean(GdmUtil.BANNER_MESSAGE_KEY); + if (!enabled) + return null; - if (enabled && text) { + return this._settings.get_string(GdmUtil.BANNER_MESSAGE_TEXT_KEY); + } + + _updateBanner() { + const text = this._getBannerText(); + + if (text) { this._bannerLabel.set_text(text); this._bannerLabel.show(); } else {