[gnome-shell/wip/message-tray: 8/22] messageTray: don't show the tray after new items are added



commit bac877935d4536ef625a959360357ed419179675
Author: Marina Zhurakhinskaya <marinaz redhat com>
Date:   Tue Jul 31 01:36:20 2012 +0200

    messageTray: don't show the tray after new items are added
    
    Because showing the tray now moves the desktop around, we should no
    longer show it when it's not triggered by the user.

 js/ui/messageTray.js |   66 ++++----------------------------------------------
 1 files changed, 5 insertions(+), 61 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index cbb257c..4d152dd 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1491,7 +1491,6 @@ const MessageTray = new Lang.Class({
         this._pointerInTray = false;
         this._pointerInKeyboard = false;
         this._summaryState = State.HIDDEN;
-        this._summaryTimeoutId = 0;
         this._pointerInSummary = false;
         this._notificationState = State.HIDDEN;
         this._notificationTimeoutId = 0;
@@ -1552,11 +1551,6 @@ const MessageTray = new Lang.Class({
                                       Lang.bind(this, this.toggle));
 
         this._summaryItems = [];
-        // We keep a list of new summary items that were added to the summary since the last
-        // time it was shown to the user. We automatically show the summary to the user if there
-        // are items in this list once the notifications are done showing or once an item gets
-        // added to the summary without a notification being shown.
-        this._newSummaryItems = [];
         this._chatSummaryItemsCount = 0;
     },
 
@@ -1609,18 +1603,6 @@ const MessageTray = new Lang.Class({
 
         this._summaryItems.push(summaryItem);
 
-        // We keep this._newSummaryItems to track any new sources that were added to the
-        // summary and show the summary with them to the user for a short period of time
-        // after notifications are done showing. However, we don't want that to happen for
-        // transient sources, which are removed after the notification is shown, but are
-        // not removed fast enough because of the callbacks to avoid the summary popping up.
-        // So we just don't add transient sources to this._newSummaryItems.
-        // We don't want that to happen for chat sources neither, because they
-        // can be added when the user starts a chat from Empathy and they are not transient.
-        // The notification will popup on incoming message anyway. See bug #657249.
-        if (!source.isTransient && !source.isChat)
-            this._newSummaryItems.push(summaryItem);
-
         source.connect('notify', Lang.bind(this, this._onNotify));
 
         source.connect('muted-changed', Lang.bind(this,
@@ -1658,10 +1640,6 @@ const MessageTray = new Lang.Class({
 
         let summaryItemToRemove = this._summaryItems[index];
 
-        let newSummaryItemsIndex = this._newSummaryItems.indexOf(this._summaryItems[index]);
-        if (newSummaryItemsIndex != -1)
-            this._newSummaryItems.splice(newSummaryItemsIndex, 1);
-
         this._summaryItems.splice(index, 1);
 
         if (source.isChat)
@@ -1874,7 +1852,6 @@ const MessageTray = new Lang.Class({
         if (status == GnomeSession.PresenceStatus.BUSY) {
             // remove notification and allow the summary to be closed now
             this._updateNotificationTimeout(0);
-            this._unsetSummaryTimeout();
             this._busy = true;
         } else if (status != GnomeSession.PresenceStatus.IDLE) {
             // We preserve the previous value of this._busy if the status turns to IDLE
@@ -1904,7 +1881,6 @@ const MessageTray = new Lang.Class({
             this._pointerInTray = false;
             this._pointerInSummary = false;
             this._updateNotificationTimeout(0);
-            this._unsetSummaryTimeout();
             this._updateState();
         }
         return false;
@@ -1915,7 +1891,6 @@ const MessageTray = new Lang.Class({
         this._pointerInTray = false;
         this._pointerInSummary = false;
         this._updateNotificationTimeout(0);
-        this._unsetSummaryTimeout();
         this._updateState();
     },
 
@@ -1966,7 +1941,7 @@ const MessageTray = new Lang.Class({
 
         // Summary
         let summarySummoned = this._pointerInSummary || this._overviewVisible ||  this._traySummoned;
-        let summaryPinned = this._summaryTimeoutId != 0 || this._pointerInTray || summarySummoned || this._locked;
+        let summaryPinned = this._pointerInTray || summarySummoned || this._locked;
         let summaryHovered = this._pointerInTray || this._pointerInSummary;
 
         let notificationsVisible = (this._notificationState == State.SHOWING ||
@@ -1977,14 +1952,9 @@ const MessageTray = new Lang.Class({
         let mustHideSummary = (notificationsPending && (notificationUrgent || summaryOptionalInOverview))
                               || notificationsVisible || this._isScreenLocked;
 
-        if (this._summaryState == State.HIDDEN && !mustHideSummary) {
-            if (summarySummoned) {
-                this._showSummary(0);
-            } else if (notificationsDone && !this._busy && !this._inFullscreen) {
-                if (this._newSummaryItems.length > 0)
-                    this._showSummary(SUMMARY_TIMEOUT);
-            }
-        } else if (this._summaryState == State.SHOWN && (!summaryPinned || mustHideSummary))
+        if (this._summaryState == State.HIDDEN && !mustHideSummary && summarySummoned)
+            this._showSummary();
+        else if (this._summaryState == State.SHOWN && (!summaryPinned || mustHideSummary))
             this._hideSummary();
 
         // Summary notification
@@ -2207,13 +2177,6 @@ const MessageTray = new Lang.Class({
                                      Lang.bind(this, this._notificationTimeout));
     },
 
-    _unsetSummaryTimeout: function(timeout) {
-        if (this._summaryTimeoutId) {
-            Mainloop.source_remove(this._summaryTimeoutId);
-            this._summaryTimeoutId = 0;
-        }
-    },
-
     _notificationTimeout: function() {
         let [x, y, mods] = global.get_pointer();
         if (y > this._lastSeenMouseY + 10 && !this.actor.hover) {
@@ -2296,8 +2259,7 @@ const MessageTray = new Lang.Class({
         this._focusGrabber.grabFocus(this._notification.actor);
     },
 
-    _showSummary: function(timeout) {
-        this._newSummaryItems = [];
+    _showSummary: function() {
         this._summaryBin.opacity = 0;
         this._summaryBin.y = this.actor.height;
         this._tween(this._summaryBin, '_summaryState', State.SHOWN,
@@ -2305,27 +2267,9 @@ const MessageTray = new Lang.Class({
                       opacity: 255,
                       time: ANIMATION_TIME,
                       transition: 'easeOutQuad',
-                      onComplete: this._showSummaryCompleted,
-                      onCompleteScope: this,
-                      onCompleteParams: [timeout]
                     });
     },
 
-    _showSummaryCompleted: function(timeout) {
-        this._newSummaryItems = [];
-        if (timeout != 0) {
-            this._summaryTimeoutId =
-                Mainloop.timeout_add(timeout * 1000,
-                                     Lang.bind(this, this._summaryTimeout));
-        }
-    },
-
-    _summaryTimeout: function() {
-        this._summaryTimeoutId = 0;
-        this._updateState();
-        return false;
-    },
-
     _hideSummary: function() {
         this._tween(this._summaryBin, '_summaryState', State.HIDDEN,
                     { opacity: 0,



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