From fe24de3ef2b96ce82f3eddd2fc7ec87d6ea70ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 9 May 2024 14:01:26 +0200 Subject: [PATCH] unlockDialog: Bind source titles After the recent notification changes, the title may still be null when the source is originally added. Handle that case and make sure we pick up later title changes by setting up a property binding. Part-of: --- js/ui/unlockDialog.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js index 7b2ab8d38..f741b20a6 100644 --- a/js/ui/unlockDialog.js +++ b/js/ui/unlockDialog.js @@ -96,11 +96,13 @@ const NotificationsBox = GObject.registerClass({ box.add_child(textBox); let title = new St.Label({ - text: source.title, style_class: 'unlock-dialog-notification-label', x_expand: true, x_align: Clutter.ActorAlign.START, }); + source.bind_property('title', + title, 'text', + GObject.BindingFlags.SYNC_CREATE); textBox.add_child(title); let count = source.unseenCount; @@ -127,9 +129,13 @@ const NotificationsBox = GObject.registerClass({ box.add_child(textBox); let title = new St.Label({ - text: source.title.replace(/\n/g, ' '), style_class: 'unlock-dialog-notification-label', }); + source.bind_property_full('title', + title, 'text', + GObject.BindingFlags.SYNC_CREATE, + (bind, sourceVal) => [true, sourceVal?.replace(/\n/g, ' ') ?? ''], + null); textBox.add_child(title); let visible = false;