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) {
|
_init: function(source) {
|
||||||
this.parent(source, source.title, null, { customContent: true, secondaryGIcon: source.getSecondaryIcon() });
|
this.parent(source, source.title, null, { customContent: true, secondaryGIcon: source.getSecondaryIcon() });
|
||||||
this.setResident(true);
|
|
||||||
|
|
||||||
this._responseEntry = new St.Entry({ style_class: 'chat-response',
|
this._responseEntry = new St.Entry({ style_class: 'chat-response',
|
||||||
can_focus: true });
|
can_focus: true });
|
||||||
|
@ -490,7 +490,6 @@ const Notification = new Lang.Class({
|
|||||||
this.source = source;
|
this.source = source;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.urgency = Urgency.NORMAL;
|
this.urgency = Urgency.NORMAL;
|
||||||
this.resident = false;
|
|
||||||
// 'transient' is a reserved keyword in JS, so we have to use an alternate variable name
|
// 'transient' is a reserved keyword in JS, so we have to use an alternate variable name
|
||||||
this.isTransient = false;
|
this.isTransient = false;
|
||||||
this.isMusic = false;
|
this.isMusic = false;
|
||||||
@ -847,14 +846,8 @@ const Notification = new Lang.Class({
|
|||||||
button.connect('clicked', Lang.bind(this, function() {
|
button.connect('clicked', Lang.bind(this, function() {
|
||||||
callback();
|
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.emit('done-displaying');
|
||||||
this.destroy();
|
this.destroy();
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.updated();
|
this.updated();
|
||||||
@ -880,10 +873,6 @@ const Notification = new Lang.Class({
|
|||||||
this.urgency = urgency;
|
this.urgency = urgency;
|
||||||
},
|
},
|
||||||
|
|
||||||
setResident: function(resident) {
|
|
||||||
this.resident = resident;
|
|
||||||
},
|
|
||||||
|
|
||||||
setTransient: function(isTransient) {
|
setTransient: function(isTransient) {
|
||||||
this.isTransient = isTransient;
|
this.isTransient = isTransient;
|
||||||
},
|
},
|
||||||
@ -1121,11 +1110,7 @@ const Notification = new Lang.Class({
|
|||||||
|
|
||||||
_onClicked: function() {
|
_onClicked: function() {
|
||||||
this.emit('clicked');
|
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');
|
this.emit('done-displaying');
|
||||||
if (!this.resident)
|
|
||||||
this.destroy();
|
this.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1294,7 +1279,7 @@ const Source = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
get indicatorCount() {
|
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;
|
return notifications.length;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1307,7 +1292,7 @@ const Source = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
get isClearable() {
|
get isClearable() {
|
||||||
return !this.trayIcon && !this.isChat && !this.resident;
|
return !this.trayIcon && !this.isChat;
|
||||||
},
|
},
|
||||||
|
|
||||||
countUpdated: function() {
|
countUpdated: function() {
|
||||||
@ -1451,9 +1436,8 @@ const Source = new Lang.Class({
|
|||||||
open: function() {
|
open: function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
destroyNonResidentNotifications: function() {
|
destroyNotifications: function() {
|
||||||
for (let i = this.notifications.length - 1; i >= 0; i--)
|
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();
|
this.countUpdated();
|
||||||
|
@ -475,7 +475,7 @@ const FdoNotificationDaemon = new Lang.Class({
|
|||||||
for (let i = 0; i < this._sources.length; i++) {
|
for (let i = 0; i < this._sources.length; i++) {
|
||||||
let source = this._sources[i];
|
let source = this._sources[i];
|
||||||
if (source.app == tracker.focus_app) {
|
if (source.app == tracker.focus_app) {
|
||||||
source.destroyNonResidentNotifications();
|
source.destroyNotifications();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -630,7 +630,7 @@ const FdoNotificationDaemonSource = new Lang.Class({
|
|||||||
|
|
||||||
open: function() {
|
open: function() {
|
||||||
this.openApp();
|
this.openApp();
|
||||||
this.destroyNonResidentNotifications();
|
this.destroyNotifications();
|
||||||
},
|
},
|
||||||
|
|
||||||
_lastNotificationRemoved: function() {
|
_lastNotificationRemoved: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user