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
This commit is contained in:
Giovanni Campagna 2012-08-27 14:42:22 +02:00
parent b3041ae9fc
commit b7ae74edb9
3 changed files with 7 additions and 24 deletions

View File

@ -433,7 +433,6 @@ function notify(msg, details) {
messageTray.add(source); messageTray.add(source);
let notification = new MessageTray.Notification(source, msg, details); let notification = new MessageTray.Notification(source, msg, details);
notification.setTransient(true); notification.setTransient(true);
notification.setShowWhenLocked(true);
source.notify(notification); source.notify(notification);
} }

View File

@ -319,7 +319,6 @@ const Notification = new Lang.Class({
this.isTransient = false; this.isTransient = false;
this.expanded = false; this.expanded = false;
this.focused = false; this.focused = false;
this.showWhenLocked = false;
this.acknowledged = false; this.acknowledged = false;
this._destroyed = false; this._destroyed = false;
this._useActionIcons = false; this._useActionIcons = false;
@ -712,14 +711,6 @@ const Notification = new Lang.Class({
this.isTransient = isTransient; 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) { setUseActionIcons: function(useIcons) {
this._useActionIcons = useIcons; this._useActionIcons = useIcons;
}, },
@ -1904,14 +1895,10 @@ const MessageTray = new Lang.Class({
// at the present time. // at the present time.
_updateState: function() { _updateState: function() {
// Notifications // Notifications
let notificationQueue = this._notificationQueue.filter(Lang.bind(this, function(notification) { let notificationQueue = this._notificationQueue;
return notification.showWhenLocked || Main.sessionMode.hasNotifications;
}));
let notificationUrgent = notificationQueue.length > 0 && notificationQueue[0].urgency == Urgency.CRITICAL; let notificationUrgent = notificationQueue.length > 0 && notificationQueue[0].urgency == Urgency.CRITICAL;
// notificationsLimited is false when the screen is locked, because they go through let notificationsLimited = this._busy || this._inFullscreen;
// different filtering, and we want to show non urgent messages at times let notificationsPending = notificationQueue.length > 0 && (!notificationsLimited || notificationUrgent) && Main.sessionMode.hasNotifications;
let notificationsLimited = (this._busy || this._inFullscreen) && Main.sessionMode.hasNotifications;
let notificationsPending = notificationQueue.length > 0 && (!notificationsLimited || notificationUrgent);
let nextNotification = notificationQueue.length > 0 ? notificationQueue[0] : null; let nextNotification = notificationQueue.length > 0 ? notificationQueue[0] : null;
let notificationPinned = this._pointerInTray && !this._pointerInSummary && !this._notificationRemoved; let notificationPinned = this._pointerInTray && !this._pointerInSummary && !this._notificationRemoved;
let notificationExpanded = this._notification && this._notification.expanded; let notificationExpanded = this._notification && this._notification.expanded;
@ -1921,15 +1908,13 @@ const MessageTray = new Lang.Class({
!this._pointerInTray && !this._pointerInTray &&
!this._locked && !this._locked &&
!(this._pointerInKeyboard && notificationExpanded); !(this._pointerInKeyboard && notificationExpanded);
let notificationLockedOut = !Main.sessionMode.hasNotifications && (this._notification && !this._notification.showWhenLocked); let notificationLockedOut = !Main.sessionMode.hasNotifications && this._notification;
// TODO: how to deal with locked out notiifcations if want to keep showing notifications?!
let notificationMustClose = this._notificationRemoved || notificationLockedOut || (notificationExpired && this._userActiveWhileNotificationShown) || this._notificationClosed; let notificationMustClose = this._notificationRemoved || notificationLockedOut || (notificationExpired && this._userActiveWhileNotificationShown) || this._notificationClosed;
let canShowNotification = notificationsPending && this._summaryState == State.HIDDEN; let canShowNotification = notificationsPending && this._summaryState == State.HIDDEN;
if (this._notificationState == State.HIDDEN) { if (this._notificationState == State.HIDDEN) {
if (canShowNotification) { if (canShowNotification) {
this._showNotification(nextNotification); this._showNotification();
this._notificationQueue.splice(this._notificationQueue.indexOf(nextNotification), 1);
} }
} else if (this._notificationState == State.SHOWN) { } else if (this._notificationState == State.SHOWN) {
if (notificationMustClose) if (notificationMustClose)
@ -2123,8 +2108,8 @@ const MessageTray = new Lang.Class({
this._updateState(); this._updateState();
}, },
_showNotification: function(notification) { _showNotification: function() {
this._notification = notification; this._notification = this._notificationQueue.shift();
this._userActiveWhileNotificationShown = this.idleMonitor.get_idletime() <= IDLE_TIME; this._userActiveWhileNotificationShown = this.idleMonitor.get_idletime() <= IDLE_TIME;
this._idleMonitorWatchId = this.idleMonitor.add_watch(IDLE_TIME, this._idleMonitorWatchId = this.idleMonitor.add_watch(IDLE_TIME,
Lang.bind(this, this._onIdleMonitorWatch)); Lang.bind(this, this._onIdleMonitorWatch));

View File

@ -71,7 +71,6 @@ const ShellInfo = new Lang.Class({
if (this._source.notifications.length == 0) { if (this._source.notifications.length == 0) {
notification = new MessageTray.Notification(this._source, text, null); notification = new MessageTray.Notification(this._source, text, null);
notification.setTransient(true); notification.setTransient(true);
notification.setShowWhenLocked(true);
} else { } else {
notification = this._source.notifications[0]; notification = this._source.notifications[0];
notification.update(text, null, { clear: true }); notification.update(text, null, { clear: true });