[gnome-shell] Revert showing notifications in the locked screen



commit b7ae74edb92fea5e16d197bdff16fcc98509d228
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Mon Aug 27 14:42:22 2012 +0200

    Revert showing notifications in the locked screen
    
    As PAM messages are now shown below the password entry, there is no
    need for this complexity, and we can just hide all notifications.
    Also, this avoids the ambiguity between notification.showWhenLocked and
    source.showInLockScreen, which have very different effects.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683369

 js/ui/main.js        |    1 -
 js/ui/messageTray.js |   29 +++++++----------------------
 js/ui/overview.js    |    1 -
 3 files changed, 7 insertions(+), 24 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index 0fbd731..40b87d3 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -433,7 +433,6 @@ function notify(msg, details) {
     messageTray.add(source);
     let notification = new MessageTray.Notification(source, msg, details);
     notification.setTransient(true);
-    notification.setShowWhenLocked(true);
     source.notify(notification);
 }
 
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index f5fdeb4..c563b8f 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -319,7 +319,6 @@ const Notification = new Lang.Class({
         this.isTransient = false;
         this.expanded = false;
         this.focused = false;
-        this.showWhenLocked = false;
         this.acknowledged = false;
         this._destroyed = false;
         this._useActionIcons = false;
@@ -712,14 +711,6 @@ const Notification = new Lang.Class({
         this.isTransient = isTransient;
     },
 
-    setShowWhenLocked: function(show) {
-        if (show && !this.isTransient) {
-            throw new Error('ShowWhenLocked can only be set on a transient notification');
-        }
-
-        this.showWhenLocked = show;
-    },
-
     setUseActionIcons: function(useIcons) {
         this._useActionIcons = useIcons;
     },
@@ -1904,14 +1895,10 @@ const MessageTray = new Lang.Class({
     // at the present time.
     _updateState: function() {
         // Notifications
-        let notificationQueue = this._notificationQueue.filter(Lang.bind(this, function(notification) {
-            return notification.showWhenLocked || Main.sessionMode.hasNotifications;
-        }));
+        let notificationQueue = this._notificationQueue;
         let notificationUrgent = notificationQueue.length > 0 && notificationQueue[0].urgency == Urgency.CRITICAL;
-        // notificationsLimited is false when the screen is locked, because they go through
-        // different filtering, and we want to show non urgent messages at times
-        let notificationsLimited = (this._busy || this._inFullscreen) && Main.sessionMode.hasNotifications;
-        let notificationsPending = notificationQueue.length > 0 && (!notificationsLimited || notificationUrgent);
+        let notificationsLimited = this._busy || this._inFullscreen;
+        let notificationsPending = notificationQueue.length > 0 && (!notificationsLimited || notificationUrgent) && Main.sessionMode.hasNotifications;
         let nextNotification = notificationQueue.length > 0 ? notificationQueue[0] : null;
         let notificationPinned = this._pointerInTray && !this._pointerInSummary && !this._notificationRemoved;
         let notificationExpanded = this._notification && this._notification.expanded;
@@ -1921,15 +1908,13 @@ const MessageTray = new Lang.Class({
                                   !this._pointerInTray &&
                                   !this._locked &&
                                   !(this._pointerInKeyboard && notificationExpanded);
-        let notificationLockedOut = !Main.sessionMode.hasNotifications && (this._notification && !this._notification.showWhenLocked);
-        // TODO: how to deal with locked out notiifcations if want to keep showing notifications?!
+        let notificationLockedOut = !Main.sessionMode.hasNotifications && this._notification;
         let notificationMustClose = this._notificationRemoved || notificationLockedOut || (notificationExpired && this._userActiveWhileNotificationShown) || this._notificationClosed;
         let canShowNotification = notificationsPending && this._summaryState == State.HIDDEN;
 
         if (this._notificationState == State.HIDDEN) {
             if (canShowNotification) {
-                this._showNotification(nextNotification);
-                this._notificationQueue.splice(this._notificationQueue.indexOf(nextNotification), 1);
+                this._showNotification();
             }
         } else if (this._notificationState == State.SHOWN) {
             if (notificationMustClose)
@@ -2123,8 +2108,8 @@ const MessageTray = new Lang.Class({
         this._updateState();
     },
 
-    _showNotification: function(notification) {
-        this._notification = notification;
+    _showNotification: function() {
+        this._notification = this._notificationQueue.shift();
         this._userActiveWhileNotificationShown = this.idleMonitor.get_idletime() <= IDLE_TIME;
         this._idleMonitorWatchId = this.idleMonitor.add_watch(IDLE_TIME,
                                                               Lang.bind(this, this._onIdleMonitorWatch));
diff --git a/js/ui/overview.js b/js/ui/overview.js
index eab79ff..ddf2780 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -71,7 +71,6 @@ const ShellInfo = new Lang.Class({
         if (this._source.notifications.length == 0) {
             notification = new MessageTray.Notification(this._source, text, null);
             notification.setTransient(true);
-            notification.setShowWhenLocked(true);
         } else {
             notification = this._source.notifications[0];
             notification.update(text, null, { clear: true });



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