messageList: Use GObject properties for Message

This will allow us to use property bindings.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3173>
This commit is contained in:
Julian Sparber
2024-02-14 12:10:29 +01:00
committed by Florian Müllner
parent ffaec5615a
commit f0e863f529
3 changed files with 76 additions and 31 deletions

View File

@ -767,14 +767,10 @@ export const Calendar = GObject.registerClass({
export const NotificationMessage = GObject.registerClass(
class NotificationMessage extends MessageList.Message {
_init(notification) {
super._init(notification.source, notification.title, notification.body);
this.setUseBodyMarkup(notification.useBodyMarkup);
constructor(notification) {
super(notification.source);
this.notification = notification;
this.datetime = notification.datetime;
this.setIcon(notification.gicon);
this.connect('close', () => {
this._closed = true;
@ -792,6 +788,8 @@ class NotificationMessage extends MessageList.Message {
this.close();
}, this);
this._onUpdated(notification);
this._actions = new Map();
this.notification.actions.forEach(action => {
this._addAction(action);
@ -800,10 +798,10 @@ class NotificationMessage extends MessageList.Message {
_onUpdated(n, _clear) {
this.datetime = n.datetime;
this.setIcon(n.gicon);
this.setTitle(n.title);
this.setBody(n.body);
this.setUseBodyMarkup(n.useBodyMarkup);
this.icon = n.gicon;
this.title = n.title;
this.body = n.body;
this.useBodyMarkup = n.useBodyMarkup;
}
vfunc_clicked() {