messageTray: Hide notifications when the tray is summoned

If the user summons the tray, it should take priority over a
notification showing.

https://bugzilla.gnome.org/show_bug.cgi?id=700639
This commit is contained in:
Jasper St. Pierre 2013-05-20 14:05:59 -04:00
parent d96726c392
commit d5f95db68d

View File

@ -2218,8 +2218,10 @@ const MessageTray = new Lang.Class({
!(this._notification && this._notification.focused) && !(this._notification && this._notification.focused) &&
!this._pointerInNotification; !this._pointerInNotification;
let notificationLockedOut = !hasNotifications && this._notification; let notificationLockedOut = !hasNotifications && this._notification;
let notificationMustClose = this._notificationRemoved || notificationLockedOut || (notificationExpired && this._userActiveWhileNotificationShown) || this._notificationClosed; let notificationMustClose = (this._notificationRemoved || notificationLockedOut ||
let canShowNotification = notificationsPending && this._trayState == State.HIDDEN; (notificationExpired && this._userActiveWhileNotificationShown) ||
this._notificationClosed || this._traySummoned);
let canShowNotification = notificationsPending && this._trayState == State.HIDDEN && !this._traySummoned;
if (this._notificationState == State.HIDDEN) { if (this._notificationState == State.HIDDEN) {
if (canShowNotification) if (canShowNotification)
@ -2233,8 +2235,6 @@ const MessageTray = new Lang.Class({
this._ensureNotificationFocused(); this._ensureNotificationFocused();
} }
let mustHideTray = this._notificationState != State.HIDDEN || !hasNotifications;
// Summary notification // Summary notification
let haveClickedSummaryItem = this._clickedSummaryItem != null; let haveClickedSummaryItem = this._clickedSummaryItem != null;
let summarySourceIsMainNotificationSource = (haveClickedSummaryItem && this._notification && let summarySourceIsMainNotificationSource = (haveClickedSummaryItem && this._notification &&
@ -2264,7 +2264,7 @@ const MessageTray = new Lang.Class({
// Tray itself // Tray itself
let trayIsVisible = (this._trayState == State.SHOWING || let trayIsVisible = (this._trayState == State.SHOWING ||
this._trayState == State.SHOWN); this._trayState == State.SHOWN);
let trayShouldBeVisible = this._traySummoned && !this._keyboardVisible && !mustHideTray; let trayShouldBeVisible = this._traySummoned && !this._keyboardVisible && hasNotifications;
if (!trayIsVisible && trayShouldBeVisible) if (!trayIsVisible && trayShouldBeVisible)
trayShouldBeVisible = this._showTray(); trayShouldBeVisible = this._showTray();
else if (trayIsVisible && !trayShouldBeVisible) else if (trayIsVisible && !trayShouldBeVisible)