messageTray: Remove support for resident notifications
Now the only resident notification is a chat notification. The convenient thing about this special-case behavior is that there's already special-case code for it and the shell, and we always know that a chat notification will always be 1:1 with its chat source.
This commit is contained in:
parent
0951d36e8f
commit
e6e15489aa
@ -586,7 +586,6 @@ const ChatNotification = new Lang.Class({
|
||||
|
||||
_init: function(source) {
|
||||
this.parent(source, source.title, null, { customContent: true, secondaryGIcon: source.getSecondaryIcon() });
|
||||
this.setResident(true);
|
||||
|
||||
this._responseEntry = new St.Entry({ style_class: 'chat-response',
|
||||
can_focus: true });
|
||||
|
@ -490,7 +490,6 @@ const Notification = new Lang.Class({
|
||||
this.source = source;
|
||||
this.title = title;
|
||||
this.urgency = Urgency.NORMAL;
|
||||
this.resident = false;
|
||||
// 'transient' is a reserved keyword in JS, so we have to use an alternate variable name
|
||||
this.isTransient = false;
|
||||
this.isMusic = false;
|
||||
@ -847,14 +846,8 @@ const Notification = new Lang.Class({
|
||||
button.connect('clicked', Lang.bind(this, function() {
|
||||
callback();
|
||||
|
||||
if (!this.resident) {
|
||||
// We don't hide a resident notification when the user invokes one of its actions,
|
||||
// because it is common for such notifications to update themselves with new
|
||||
// information based on the action. We'd like to display the updated information
|
||||
// in place, rather than pop-up a new notification.
|
||||
this.emit('done-displaying');
|
||||
this.destroy();
|
||||
}
|
||||
this.emit('done-displaying');
|
||||
this.destroy();
|
||||
}));
|
||||
|
||||
this.updated();
|
||||
@ -880,10 +873,6 @@ const Notification = new Lang.Class({
|
||||
this.urgency = urgency;
|
||||
},
|
||||
|
||||
setResident: function(resident) {
|
||||
this.resident = resident;
|
||||
},
|
||||
|
||||
setTransient: function(isTransient) {
|
||||
this.isTransient = isTransient;
|
||||
},
|
||||
@ -1121,12 +1110,8 @@ const Notification = new Lang.Class({
|
||||
|
||||
_onClicked: function() {
|
||||
this.emit('clicked');
|
||||
// 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');
|
||||
if (!this.resident)
|
||||
this.destroy();
|
||||
this.destroy();
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
@ -1294,7 +1279,7 @@ const Source = new Lang.Class({
|
||||
},
|
||||
|
||||
get indicatorCount() {
|
||||
let notifications = this.notifications.filter(function(n) { return !n.isTransient && !n.resident; });
|
||||
let notifications = this.notifications.filter(function(n) { return !n.isTransient; });
|
||||
return notifications.length;
|
||||
},
|
||||
|
||||
@ -1307,7 +1292,7 @@ const Source = new Lang.Class({
|
||||
},
|
||||
|
||||
get isClearable() {
|
||||
return !this.trayIcon && !this.isChat && !this.resident;
|
||||
return !this.trayIcon && !this.isChat;
|
||||
},
|
||||
|
||||
countUpdated: function() {
|
||||
@ -1451,10 +1436,9 @@ const Source = new Lang.Class({
|
||||
open: function() {
|
||||
},
|
||||
|
||||
destroyNonResidentNotifications: function() {
|
||||
destroyNotifications: function() {
|
||||
for (let i = this.notifications.length - 1; i >= 0; i--)
|
||||
if (!this.notifications[i].resident)
|
||||
this.notifications[i].destroy();
|
||||
this.notifications[i].destroy();
|
||||
|
||||
this.countUpdated();
|
||||
},
|
||||
|
@ -475,7 +475,7 @@ const FdoNotificationDaemon = new Lang.Class({
|
||||
for (let i = 0; i < this._sources.length; i++) {
|
||||
let source = this._sources[i];
|
||||
if (source.app == tracker.focus_app) {
|
||||
source.destroyNonResidentNotifications();
|
||||
source.destroyNotifications();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -630,7 +630,7 @@ const FdoNotificationDaemonSource = new Lang.Class({
|
||||
|
||||
open: function() {
|
||||
this.openApp();
|
||||
this.destroyNonResidentNotifications();
|
||||
this.destroyNotifications();
|
||||
},
|
||||
|
||||
_lastNotificationRemoved: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user