[gnome-shell] Don't show the summary if a new item got removed before we had a chance to show it
- From: Marina Zhurakhinskaya <marinaz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Don't show the summary if a new item got removed before we had a chance to show it
- Date: Tue, 5 Oct 2010 20:15:08 +0000 (UTC)
commit b017a2187bc69e8d775d8f2cb71268742965228b
Author: Marina Zhurakhinskaya <marinaz redhat com>
Date: Thu Sep 30 17:02:16 2010 -0400
Don't show the summary if a new item got removed before we had a chance to show it
It's possible that an item that was added to the summary got removed before
we had a chance to show the summary because the user has interacted with
the notification (e.g. clicked on an application ready notification). We should
not be showing the summary with an unchanged set of items in this case.
However, it is possible that multiple items were added to the summary before
we had a chance to show the summary, and only some of them got removed. In view
of this scenario, we can't just use a boolean flag to indicate if the summary
needs to be shown, but have to maintain an array of new summary items instead.
https://bugzilla.gnome.org/show_bug.cgi?id=630939
js/ui/messageTray.js | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 7bdf2f4..aa65a15 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -917,6 +917,11 @@ MessageTray.prototype = {
}));
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._longestSummaryItem = null;
},
@@ -955,7 +960,6 @@ MessageTray.prototype = {
let summaryItem = new SummaryItem(source, minTitleWidth);
this._summary.insert_actor(summaryItem.actor, 0);
- this._summaryNeedsToBeShown = true;
let newItemTitleWidth = summaryItem.getTitleNaturalWidth();
if (newItemTitleWidth > minTitleWidth) {
@@ -967,6 +971,7 @@ MessageTray.prototype = {
}
this._summaryItems.push(summaryItem);
+ this._newSummaryItems.push(summaryItem);
source.connect('notify', Lang.bind(this, this._onNotify));
@@ -1007,6 +1012,10 @@ MessageTray.prototype = {
this._summary.remove_actor(this._summaryItems[index].actor);
+ let newSummaryItemsIndex = this._newSummaryItems.indexOf(this._summaryItems[index]);
+ if (newSummaryItemsIndex != -1)
+ this._newSummaryItems.splice(newSummaryItemsIndex, 1);
+
this._summaryItems.splice(index, 1);
if (this._longestSummaryItem.source == source) {
@@ -1214,7 +1223,7 @@ MessageTray.prototype = {
let notificationsDone = !notificationsVisible && !notificationsPending;
if (this._summaryState == State.HIDDEN) {
- if (notificationsDone && this._summaryNeedsToBeShown)
+ if (notificationsDone && this._newSummaryItems.length > 0)
this._showSummary(true);
else if (summarySummoned)
this._showSummary(false);
@@ -1438,7 +1447,7 @@ MessageTray.prototype = {
},
_showSummaryCompleted: function(withTimeout) {
- this._summaryNeedsToBeShown = false;
+ this._newSummaryItems = [];
if (withTimeout) {
this._summaryTimeoutId =
@@ -1459,7 +1468,7 @@ MessageTray.prototype = {
time: ANIMATION_TIME,
transition: 'easeOutQuad'
});
- this._summaryNeedsToBeShown = false;
+ this._newSummaryItems = [];
},
_showSummaryNotification: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]