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:
parent
83ea818a0a
commit
940b658071
@ -575,27 +575,6 @@ export const Notification = GObject.registerClass({
|
|||||||
});
|
});
|
||||||
SignalTracker.registerDestroyableType(Notification);
|
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({
|
export const Source = GObject.registerClass({
|
||||||
Properties: {
|
Properties: {
|
||||||
'count': GObject.ParamSpec.int(
|
'count': GObject.ParamSpec.int(
|
||||||
@ -931,6 +910,7 @@ export const MessageTray = GObject.registerClass({
|
|||||||
this._notificationRemoved = true;
|
this._notificationRemoved = true;
|
||||||
if (this._notificationState === State.SHOWN ||
|
if (this._notificationState === State.SHOWN ||
|
||||||
this._notificationState === State.SHOWING) {
|
this._notificationState === State.SHOWING) {
|
||||||
|
this._pointerInNotification = false;
|
||||||
this._updateNotificationTimeout(0);
|
this._updateNotificationTimeout(0);
|
||||||
this._updateState();
|
this._updateState();
|
||||||
}
|
}
|
||||||
@ -1059,12 +1039,6 @@ export const MessageTray = GObject.registerClass({
|
|||||||
return GLib.SOURCE_REMOVE;
|
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
|
// All of the logic for what happens when occurs here; the various
|
||||||
// event handlers merely update variables such as
|
// event handlers merely update variables such as
|
||||||
// 'this._pointerInNotification', 'this._traySummoned', etc, and
|
// '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.idleMonitor.add_user_active_watch(this._onIdleMonitorBecameActive.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
this._banner = new NotificationBanner(this._notification);
|
this._banner = new Calendar.NotificationMessage(this._notification);
|
||||||
this._banner.connectObject('done-displaying', this._escapeTray.bind(this), this);
|
this._banner.can_focus = false;
|
||||||
|
this._banner.add_style_class_name('notification-banner');
|
||||||
|
|
||||||
this._bannerBin.add_child(this._banner);
|
this._bannerBin.add_child(this._banner);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user