messageTray: Remove support for transient notifications
Transient notifications have used for lots of different "system status" notifications, like network, low power, low disk space, etc. However, a majority of these notifications should really also be persistent instead of going away after they appear. Users have reported getting confused after seeing a notification appear up in the corner of their eye, and then have no record of what it was since the tray was empty. To simplify the code, set the users more at ease, and also make things like low power and low disk space more noticeable and urgent after they go away. Applications can and should explicitly close any notification it wants to when state changes, so these notifications shouldn't linger if the user e.g. plugs in his power cable, or clears up some disk space.
This commit is contained in:
parent
ef1ab043a3
commit
d519a0a181
@ -416,7 +416,6 @@ const AutorunTransientNotification = new Lang.Class({
|
||||
|
||||
// set the notification to transient and urgent, so that it
|
||||
// expands out
|
||||
this.setTransient(true);
|
||||
this.setUrgency(MessageTray.Urgency.CRITICAL);
|
||||
},
|
||||
|
||||
|
@ -281,7 +281,6 @@ function notify(msg, details) {
|
||||
let source = new MessageTray.SystemNotificationSource();
|
||||
messageTray.add(source);
|
||||
let notification = new MessageTray.Notification(source, msg, details);
|
||||
notification.setTransient(true);
|
||||
source.notify(notification);
|
||||
}
|
||||
|
||||
|
@ -476,8 +476,6 @@ const Notification = new Lang.Class({
|
||||
this.source = source;
|
||||
this.title = title;
|
||||
this.urgency = Urgency.NORMAL;
|
||||
// 'transient' is a reserved keyword in JS, so we have to use an alternate variable name
|
||||
this.isTransient = false;
|
||||
this.isMusic = false;
|
||||
this.forFeedback = false;
|
||||
this.expanded = false;
|
||||
@ -750,10 +748,6 @@ const Notification = new Lang.Class({
|
||||
this.urgency = urgency;
|
||||
},
|
||||
|
||||
setTransient: function(isTransient) {
|
||||
this.isTransient = isTransient;
|
||||
},
|
||||
|
||||
setForFeedback: function(forFeedback) {
|
||||
this.forFeedback = forFeedback;
|
||||
},
|
||||
@ -997,8 +991,7 @@ const Source = new Lang.Class({
|
||||
},
|
||||
|
||||
get indicatorCount() {
|
||||
let notifications = this.notifications.filter(function(n) { return !n.isTransient; });
|
||||
return notifications.length;
|
||||
return this.notifications.length;
|
||||
},
|
||||
|
||||
get unseenCount() {
|
||||
@ -2426,8 +2419,6 @@ const MessageTray = new Lang.Class({
|
||||
|
||||
let notification = this._notification;
|
||||
this._notification = null;
|
||||
if (notification.isTransient)
|
||||
notification.destroy(NotificationDestroyedReason.EXPIRED);
|
||||
|
||||
this._pointerInNotification = false;
|
||||
this._notificationRemoved = false;
|
||||
|
@ -180,10 +180,6 @@ const FdoNotificationDaemon = new Lang.Class({
|
||||
if (!pid && !(ndata && ndata.notification))
|
||||
return null;
|
||||
|
||||
// We use notification's source for the notifications we still have
|
||||
// around that are getting replaced because we don't keep sources
|
||||
// for transient notifications in this._sources, but we still want
|
||||
// the notification associated with them to get replaced correctly.
|
||||
if (ndata && ndata.notification)
|
||||
return ndata.notification.source;
|
||||
|
||||
@ -422,9 +418,6 @@ const FdoNotificationDaemon = new Lang.Class({
|
||||
notification.setUrgency(MessageTray.Urgency.CRITICAL);
|
||||
break;
|
||||
}
|
||||
// 'transient' is a reserved keyword in JS, so we have to retrieve the value
|
||||
// of the 'transient' hint with hints['transient'] rather than hints.transient
|
||||
notification.setTransient(hints['transient'] == true);
|
||||
|
||||
let sourceGIcon = source.useNotificationIcon ? gicon : null;
|
||||
source.processNotification(notification, sourceGIcon);
|
||||
|
@ -72,7 +72,6 @@ const ShellInfo = new Lang.Class({
|
||||
let notification = null;
|
||||
if (this._source.notifications.length == 0) {
|
||||
notification = new MessageTray.Notification(this._source, text, null);
|
||||
notification.setTransient(true);
|
||||
notification.setForFeedback(forFeedback);
|
||||
} else {
|
||||
notification = this._source.notifications[0];
|
||||
|
@ -253,7 +253,6 @@ const ShellUnmountNotifier = new Lang.Class({
|
||||
|
||||
if (!this._notification) {
|
||||
this._notification = new MessageTray.Notification(this, header, text);
|
||||
this._notification.setTransient(true);
|
||||
this._notification.setUrgency(MessageTray.Urgency.CRITICAL);
|
||||
} else {
|
||||
this._notification.update(header, text);
|
||||
@ -270,7 +269,6 @@ const ShellUnmountNotifier = new Lang.Class({
|
||||
|
||||
if (message) {
|
||||
let notification = new MessageTray.Notification(this, message, null);
|
||||
notification.setTransient(true);
|
||||
|
||||
this.notify(notification);
|
||||
}
|
||||
|
@ -1632,7 +1632,6 @@ const NMApplet = new Lang.Class({
|
||||
let gicon = new Gio.ThemedIcon({ name: iconName });
|
||||
this._notification = new MessageTray.Notification(this._source, title, text, { gicon: gicon });
|
||||
this._notification.setUrgency(urgency);
|
||||
this._notification.setTransient(true);
|
||||
this._notification.connect('destroy', function() {
|
||||
this._notification = null;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user