[gnome-shell/wip/notif-d3: 1/7] messageTray: Remove support for transient notifications



commit d519a0a181171f0e89800e79341f00fdd293c896
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Jun 12 14:04:54 2014 -0400

    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.

 js/ui/components/autorunManager.js |    1 -
 js/ui/main.js                      |    1 -
 js/ui/messageTray.js               |   11 +----------
 js/ui/notificationDaemon.js        |    7 -------
 js/ui/overview.js                  |    1 -
 js/ui/shellMountOperation.js       |    2 --
 js/ui/status/network.js            |    1 -
 7 files changed, 1 insertions(+), 23 deletions(-)
---
diff --git a/js/ui/components/autorunManager.js b/js/ui/components/autorunManager.js
index d3a0a4e..c76f64d 100644
--- a/js/ui/components/autorunManager.js
+++ b/js/ui/components/autorunManager.js
@@ -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);
     },
 
diff --git a/js/ui/main.js b/js/ui/main.js
index 6218f33..36c374f 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -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);
 }
 
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 72bd9ce..a6e7913 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -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;
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 9b2d29c..b35be43 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -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);
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 5e000cd..dab5481 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -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];
diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js
index a1cc81d..a74b2df 100644
--- a/js/ui/shellMountOperation.js
+++ b/js/ui/shellMountOperation.js
@@ -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);
         }
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 7d68fbd..f8e4f10 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -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;
         });


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]