messageTray: Drop NotificationBanner

We want to have the same widget used to display the notification in the
calendar popover as in the messageTray, so let's actually use the same
widget.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3173>
This commit is contained in:
Julian Sparber 2024-02-12 13:07:37 +01:00 committed by Florian Müllner
parent 83ea818a0a
commit 940b658071

View File

@ -575,27 +575,6 @@ export const Notification = GObject.registerClass({
});
SignalTracker.registerDestroyableType(Notification);
export const NotificationBanner = GObject.registerClass({
Signals: {
'done-displaying': {},
},
}, class NotificationBanner extends Calendar.NotificationMessage {
_init(notification) {
super._init(notification);
this.can_focus = false;
this.add_style_class_name('notification-banner');
this.notification.connectObject('activated', () => {
// We hide all types of notifications once the user clicks on
// them because the common outcome of clicking should be the
// relevant window being brought forward and the user's
// attention switching to the window.
this.emit('done-displaying');
}, this);
}
});
export const Source = GObject.registerClass({
Properties: {
'count': GObject.ParamSpec.int(
@ -931,6 +910,7 @@ export const MessageTray = GObject.registerClass({
this._notificationRemoved = true;
if (this._notificationState === State.SHOWN ||
this._notificationState === State.SHOWING) {
this._pointerInNotification = false;
this._updateNotificationTimeout(0);
this._updateState();
}
@ -1059,12 +1039,6 @@ export const MessageTray = GObject.registerClass({
return GLib.SOURCE_REMOVE;
}
_escapeTray() {
this._pointerInNotification = false;
this._updateNotificationTimeout(0);
this._updateState();
}
// All of the logic for what happens when occurs here; the various
// event handlers merely update variables such as
// 'this._pointerInNotification', 'this._traySummoned', etc, and
@ -1147,8 +1121,9 @@ export const MessageTray = GObject.registerClass({
this.idleMonitor.add_user_active_watch(this._onIdleMonitorBecameActive.bind(this));
}
this._banner = new NotificationBanner(this._notification);
this._banner.connectObject('done-displaying', this._escapeTray.bind(this), this);
this._banner = new Calendar.NotificationMessage(this._notification);
this._banner.can_focus = false;
this._banner.add_style_class_name('notification-banner');
this._bannerBin.add_child(this._banner);