From 5f92c12c727bd447d7e539b1e6c8f3ac6ddf715a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 22 Nov 2024 19:36:42 +0100 Subject: [PATCH] loginDialog: Update banner asynchronously We will soon allow reading the banner text from a file. Prepare for that by making the method asynchronous. Part-of: --- js/gdm/loginDialog.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index c3c397c0d..125cf299f 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -505,9 +505,9 @@ export const LoginDialog = GObject.registerClass({ this._settings = new Gio.Settings({schema_id: GdmUtil.LOGIN_SCREEN_SCHEMA}); this._settings.connect(`changed::${GdmUtil.BANNER_MESSAGE_KEY}`, - this._updateBanner.bind(this)); + () => this._updateBanner().catch(logError)); this._settings.connect(`changed::${GdmUtil.BANNER_MESSAGE_TEXT_KEY}`, - this._updateBanner.bind(this)); + () => this._updateBanner().catch(logError)); this._settings.connect(`changed::${GdmUtil.DISABLE_USER_LIST_KEY}`, this._updateDisableUserList.bind(this)); this._settings.connect(`changed::${GdmUtil.LOGO_KEY}`, @@ -576,7 +576,7 @@ export const LoginDialog = GObject.registerClass({ this._bannerLabel.clutter_text.line_wrap = true; this._bannerLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; bannerBox.add_child(this._bannerLabel); - this._updateBanner(); + this._updateBanner().catch(logError); this._sessionMenuButton = new SessionMenuButton(); this._sessionMenuButton.connect('session-activated', @@ -873,16 +873,19 @@ export const LoginDialog = GObject.registerClass({ this._authPrompt.cancelButton.visible = cancelVisible; } - _getBannerText() { + async _getBannerText() { const enabled = this._settings.get_boolean(GdmUtil.BANNER_MESSAGE_KEY); if (!enabled) return null; + // placeholder + await false; + return this._settings.get_string(GdmUtil.BANNER_MESSAGE_TEXT_KEY); } - _updateBanner() { - const text = this._getBannerText(); + async _updateBanner() { + const text = await this._getBannerText(); if (text) { this._bannerLabel.set_text(text);