[gnome-shell/wip/new-notifications: 7/17] messageTray: Remove support for resident notifications



commit 65521ef4a3cbc8f1cedb47b0d6f89998e7b4c4a2
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jul 3 16:42:53 2013 -0400

    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.

 js/ui/components/telepathyClient.js |    1 -
 js/ui/messageTray.js                |   30 +++++++-----------------------
 js/ui/notificationDaemon.js         |    4 ++--
 3 files changed, 9 insertions(+), 26 deletions(-)
---
diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js
index 0b307e5..5781868 100644
--- a/js/ui/components/telepathyClient.js
+++ b/js/ui/components/telepathyClient.js
@@ -571,7 +571,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 });
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index f905768..1d87066 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -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;
     },
@@ -1118,12 +1107,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() {
@@ -1277,7 +1262,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;
     },
 
@@ -1290,7 +1275,7 @@ const Source = new Lang.Class({
     },
 
     get isClearable() {
-        return !this.trayIcon && !this.isChat && !this.resident;
+        return !this.trayIcon && !this.isChat;
     },
 
     countUpdated: function() {
@@ -1434,10 +1419,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();
     },
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 99597ba..a04ed35 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -489,7 +489,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;
             }
         }
@@ -648,7 +648,7 @@ const FdoNotificationDaemonSource = new Lang.Class({
 
     open: function() {
         this.openApp();
-        this.destroyNonResidentNotifications();
+        this.destroyNotifications();
     },
 
     _lastNotificationRemoved: function() {


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