notification: Stop using old setter methods of MessageTray.Notification

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3173>
This commit is contained in:
Julian Sparber
2024-02-14 11:35:03 +01:00
committed by Florian Müllner
parent 9ac4c7da53
commit 1d1d9806f3
8 changed files with 40 additions and 28 deletions

View File

@ -237,24 +237,24 @@ class FdoNotificationDaemon {
switch (hints.urgency) {
case Urgency.LOW:
notification.setUrgency(MessageTray.Urgency.LOW);
notification.urgency = MessageTray.Urgency.LOW;
break;
case Urgency.NORMAL:
notification.setUrgency(MessageTray.Urgency.NORMAL);
notification.urgency = MessageTray.Urgency.NORMAL;
break;
case Urgency.CRITICAL:
notification.setUrgency(MessageTray.Urgency.CRITICAL);
notification.urgency = MessageTray.Urgency.CRITICAL;
break;
}
notification.setResident(!!hints.resident);
notification.resident = !!hints.resident;
// 'transient' is a reserved keyword in JS, so we have to retrieve the value
// of the 'transient' hint with hints['transient'] rather than hints.transient
notification.setTransient(!!hints['transient']);
notification.isTransient = !!hints['transient'];
let privacyScope = hints['x-gnome-privacy-scope'] || 'user';
notification.setPrivacyScope(privacyScope === 'system'
notification.privacyScope = privacyScope === 'system'
? MessageTray.PrivacyScope.SYSTEM
: MessageTray.PrivacyScope.USER);
: MessageTray.PrivacyScope.USER;
// Only fallback to 'app-icon' when the source doesn't have a valid app
const sourceGIcon = source.app ? null : this._iconForNotificationData(appIcon);
@ -424,13 +424,13 @@ class GtkNotificationDaemonNotification extends MessageTray.Notification {
if (priority) {
let urgency = PRIORITY_URGENCY_MAP[priority.unpack()];
this.setUrgency(urgency !== undefined ? urgency : MessageTray.Urgency.NORMAL);
this.urgency = urgency !== undefined ? urgency : MessageTray.Urgency.NORMAL;
} else if (urgent) {
this.setUrgency(urgent.unpack()
this.urgency = urgent.unpack()
? MessageTray.Urgency.CRITICAL
: MessageTray.Urgency.NORMAL);
: MessageTray.Urgency.NORMAL;
} else {
this.setUrgency(MessageTray.Urgency.NORMAL);
this.urgency = MessageTray.Urgency.NORMAL;
}
if (buttons) {