Don't show the banner when hiding the notification or showing it in the summary mode

The banner should not be appearing briefly when we are hiding the notification.
For that, we should only restore the opacity of the banner in popInCompleted()
when we are done hiding the notification. We do need to restore the opacity
in case the notification is updated and is shown in the banner mode again.

The banner should not be appearing briefly when we are showing the notification
in the summary mode. For that, we should not use the animation time to fade out
the banner in popOut() for summary notifications.

These two problems were particularly visible when the ANIMATION_TIME was increased.

https://bugzilla.gnome.org/show_bug.cgi?id=623970
This commit is contained in:
Marina Zhurakhinskaya 2010-08-29 00:04:33 -04:00
parent cc06916811
commit 539b8ae9f6

View File

@ -379,26 +379,23 @@ Notification.prototype = {
})); }));
}, },
popOut: function() { popOut: function(animate) {
if (this.actor.row_count <= 1) if (this.actor.row_count <= 1)
return false; return false;
if (animate)
Tweener.addTween(this._bannerLabel, Tweener.addTween(this._bannerLabel,
{ opacity: 0, { opacity: 0,
time: ANIMATION_TIME, time: ANIMATION_TIME,
transition: 'easeOutQuad' }); transition: 'easeOutQuad' });
else
this._bannerLabel.opacity = 0;
return true; return true;
}, },
popIn: function() { popInCompleted: function() {
if (this.actor.row_count <= 1) this._bannerLabel.opacity = 255;
return false;
Tweener.addTween(this._bannerLabel,
{ opacity: 255,
time: ANIMATION_TIME,
transition: 'easeOutQuad' });
return true;
}, },
grabFocus: function(lockTray) { grabFocus: function(lockTray) {
@ -1241,7 +1238,6 @@ MessageTray.prototype = {
_hideNotification: function() { _hideNotification: function() {
this._notification.ungrabFocus(); this._notification.ungrabFocus();
this._notification.popIn();
if (this._reExpandNotificationId) { if (this._reExpandNotificationId) {
this._notificationBin.disconnect(this._reExpandNotificationId); this._notificationBin.disconnect(this._reExpandNotificationId);
@ -1262,11 +1258,12 @@ MessageTray.prototype = {
this._notificationRemoved = false; this._notificationRemoved = false;
this._notificationBin.hide(); this._notificationBin.hide();
this._notificationBin.child = null; this._notificationBin.child = null;
this._notification.popInCompleted();
this._notification = null; this._notification = null;
}, },
_expandNotification: function() { _expandNotification: function() {
if (this._notification && this._notification.popOut()) { if (this._notification && this._notification.popOut(true)) {
// Don't grab focus in urgent notifications that are auto-expanded. // Don't grab focus in urgent notifications that are auto-expanded.
if (!this._notification.urgent) if (!this._notification.urgent)
this._notification.grabFocus(false); this._notification.grabFocus(false);
@ -1335,7 +1332,7 @@ MessageTray.prototype = {
this._notificationQueue.splice(index, 1); this._notificationQueue.splice(index, 1);
this._summaryNotificationBin.child = this._summaryNotification.actor; this._summaryNotificationBin.child = this._summaryNotification.actor;
this._summaryNotification.popOut(); this._summaryNotification.popOut(false);
this._summaryNotification.grabFocus(true); this._summaryNotification.grabFocus(true);
this._summaryNotificationBin.opacity = 0; this._summaryNotificationBin.opacity = 0;
@ -1366,7 +1363,6 @@ MessageTray.prototype = {
if (this._summaryState != State.SHOWN) if (this._summaryState != State.SHOWN)
this._clickedSummaryItem = null; this._clickedSummaryItem = null;
this._summaryNotification.ungrabFocus(); this._summaryNotification.ungrabFocus();
this._summaryNotification.popIn();
this._tween(this._summaryNotificationBin, '_summaryNotificationState', State.HIDDEN, this._tween(this._summaryNotificationBin, '_summaryNotificationState', State.HIDDEN,
{ y: this.actor.height, { y: this.actor.height,
@ -1386,6 +1382,7 @@ MessageTray.prototype = {
_hideSummaryNotificationCompleted: function() { _hideSummaryNotificationCompleted: function() {
this._summaryNotificationBin.hide(); this._summaryNotificationBin.hide();
this._summaryNotificationBin.child = null; this._summaryNotificationBin.child = null;
this._summaryNotification.popInCompleted();
this._summaryNotification = null; this._summaryNotification = null;
} }
}; };