notification: Stop using 'update()' from MessageTray.Notification

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

View File

@ -200,13 +200,15 @@ class FdoNotificationDaemon {
const soundFile = 'sound-file' in hints const soundFile = 'sound-file' in hints
? Gio.File.new_for_path(hints['sound-file']) : null; ? Gio.File.new_for_path(hints['sound-file']) : null;
notification.acknowledged = false; notification.set({
notification.update(summary, body, { title: summary,
body,
gicon, gicon,
bannerMarkup: true, bannerMarkup: true,
clear: true,
sound: new MessageTray.Sound(soundFile, hints['sound-name']), sound: new MessageTray.Sound(soundFile, hints['sound-name']),
acknowledged: false,
}); });
notification.clearActions();
let hasDefaultAction = false; let hasDefaultAction = false;
@ -444,7 +446,9 @@ class GtkNotificationDaemonNotification extends MessageTray.Notification {
this._defaultAction = defaultAction?.unpack(); this._defaultAction = defaultAction?.unpack();
this._defaultActionTarget = defaultActionTarget; this._defaultActionTarget = defaultActionTarget;
this.update(title.unpack(), body?.unpack(), { this.set({
title: title.unpack(),
body: body?.unpack(),
gicon: gicon gicon: gicon
? Gio.icon_deserialize(gicon) : null, ? Gio.icon_deserialize(gicon) : null,
datetime: time datetime: time

View File

@ -28,7 +28,7 @@ const DND_WINDOW_SWITCH_TIMEOUT = 750;
const OVERVIEW_ACTIVATION_TIMEOUT = 0.5; const OVERVIEW_ACTIVATION_TIMEOUT = 0.5;
class ShellInfo { class ShellInfo {
setMessage(text, options) { setMessage(title, options) {
options = Params.parse(options, { options = Params.parse(options, {
undoCallback: null, undoCallback: null,
forFeedback: false, forFeedback: false,
@ -41,14 +41,14 @@ class ShellInfo {
if (!this._notification) { if (!this._notification) {
this._notification = new MessageTray.Notification({ this._notification = new MessageTray.Notification({
source, source,
title: text,
isTransient: true, isTransient: true,
forFeedback, forFeedback,
}); });
this._notification.connect('destroy', () => delete this._notification); this._notification.connect('destroy', () => delete this._notification);
} else {
this._notification.update(text, null, {clear: true});
} }
this._notification.set({title});
this._notification.clearActions();
if (undoCallback) if (undoCallback)
this._notification.addAction(_('Undo'), () => undoCallback()); this._notification.addAction(_('Undo'), () => undoCallback());

View File

@ -218,7 +218,7 @@ export class ShellMountOperation {
if (!this._notification) if (!this._notification)
this._createNotification(title, body); this._createNotification(title, body);
else else
this._notification.update(title, body); this._notification.set({title, body});
} }
} }

View File

@ -53,7 +53,7 @@ export class WindowAttentionHandler {
window.connectObject('notify::title', () => { window.connectObject('notify::title', () => {
[title, body] = this._getTitleAndBanner(app, window); [title, body] = this._getTitleAndBanner(app, window);
notification.update(title, body); notification.set({title, body});
}, source); }, source);
} }
} }