mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-17 23:24:51 +00:00
messageTray: Use display-hint property instead of individual properties
This makes use of the new display-hint instead of using individual properties.
This commit is contained in:
parent
a1d5663085
commit
b2b05a9770
10 changed files with 29 additions and 21 deletions
|
|
@ -1081,7 +1081,7 @@ export const LoginDialog = GObject.registerClass({
|
|||
title: _('Login Attempt Timed Out'),
|
||||
body: _('Login took too long, please try again'),
|
||||
urgency: MessageTray.Urgency.CRITICAL,
|
||||
isTransient: true,
|
||||
displayHint: MessageTray.DisplayHint.TRANSIENT,
|
||||
});
|
||||
this._conflictingSessionNotification.connect('destroy', () => {
|
||||
this._conflictingSessionNotification = null;
|
||||
|
|
|
|||
|
|
@ -204,8 +204,7 @@ class AppFavorites extends Signals.EventEmitter {
|
|||
source,
|
||||
title,
|
||||
body,
|
||||
isTransient: true,
|
||||
forFeedback: true,
|
||||
displayHint: MessageTray.DisplayHint.TRANSIENT | MessageTray.DisplayHint.FORCE_IMMEDIATELY,
|
||||
});
|
||||
notification.addAction(_('Undo'), () => undoCallback());
|
||||
source.addNotification(notification);
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ async function _initializeUI() {
|
|||
source,
|
||||
title: _('System was put in unsafe mode'),
|
||||
body: _('Apps now have unrestricted access'),
|
||||
isTransient: true,
|
||||
displayHint: MessageTray.DisplayHint.TRANSIENT,
|
||||
});
|
||||
notification.addAction(_('Undo'),
|
||||
() => (global.context.unsafe_mode = false));
|
||||
|
|
@ -620,7 +620,7 @@ export function notify(msg, details) {
|
|||
source,
|
||||
title: msg,
|
||||
body: details,
|
||||
isTransient: true,
|
||||
displayHint: MessageTray.DisplayHint.TRANSIENT,
|
||||
});
|
||||
source.addNotification(notification);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@ export class Notification extends GObject.Object {
|
|||
// because it is common for such notifications to update themselves with new
|
||||
// information based on the action. We'd like to display the updated information
|
||||
// in place, rather than pop-up a new notification.
|
||||
if (this.resident)
|
||||
if (this.displayHint & DisplayHint.RESIDENT)
|
||||
return;
|
||||
|
||||
this.destroy();
|
||||
|
|
@ -499,7 +499,7 @@ export class Notification extends GObject.Object {
|
|||
// because it is common for such notifications to update themselves with new
|
||||
// information based on the action. We'd like to display the updated information
|
||||
// in place, rather than pop-up a new notification.
|
||||
if (this.resident)
|
||||
if (this.displayHint & DisplayHint.RESIDENT)
|
||||
return;
|
||||
|
||||
this.destroy();
|
||||
|
|
@ -1093,7 +1093,9 @@ export const MessageTray = GObject.registerClass({
|
|||
let nextNotification = this._notificationQueue[0] || null;
|
||||
if (hasNotifications && nextNotification) {
|
||||
let limited = this._busy || Main.layoutManager.primaryMonitor.inFullscreen;
|
||||
let showNextNotification = !limited || nextNotification.forFeedback || nextNotification.urgency === Urgency.CRITICAL;
|
||||
let showNextNotification = !limited ||
|
||||
nextNotification.displayHint & DisplayHint.FORCE_IMMEDIATELY ||
|
||||
nextNotification.urgency === Urgency.CRITICAL;
|
||||
if (showNextNotification)
|
||||
this._showNotification();
|
||||
}
|
||||
|
|
@ -1284,7 +1286,7 @@ export const MessageTray = GObject.registerClass({
|
|||
_hideNotificationCompleted() {
|
||||
let notification = this._notification;
|
||||
this._notification = null;
|
||||
if (!this._notificationRemoved && notification.isTransient)
|
||||
if (!this._notificationRemoved && notification.displayHint & DisplayHint.TRANSIENT)
|
||||
notification.destroy(NotificationDestroyedReason.EXPIRED);
|
||||
|
||||
this._pointerInNotification = false;
|
||||
|
|
|
|||
|
|
@ -247,15 +247,20 @@ class FdoNotificationDaemon {
|
|||
notification.urgency = MessageTray.Urgency.CRITICAL;
|
||||
break;
|
||||
}
|
||||
notification.resident = !!hints.resident;
|
||||
|
||||
if (hints.resident)
|
||||
notification.displayHint |= MessageTray.DisplayHint.RESIDENT;
|
||||
|
||||
// 'transient' is a reserved keyword in JS, so we have to retrieve the value
|
||||
// of the 'transient' hint with hints['transient'] rather than hints.transient
|
||||
notification.isTransient = !!hints['transient'];
|
||||
if (hints['transient'])
|
||||
notification.displayHint |= MessageTray.DisplayHint.TRANSIENT;
|
||||
|
||||
let privacyScope = hints['x-gnome-privacy-scope'] || 'user';
|
||||
notification.privacyScope = privacyScope === 'system'
|
||||
? MessageTray.PrivacyScope.SYSTEM
|
||||
: MessageTray.PrivacyScope.USER;
|
||||
if (hints['x-gnome-privacy-scope'] === 'system')
|
||||
notification.displayHint |= MessageTray.DisplayHint.SHOW_CONTENT_ON_LOCKSCREEN;
|
||||
else
|
||||
// Always show the notification on the lockscreen but without any content
|
||||
notification.displayHint |= MessageTray.DisplayHint.SHOW_ON_LOCKSCREEN;
|
||||
|
||||
// Only fallback to 'app-icon' when the source doesn't have a valid app
|
||||
const sourceGIcon = source.app ? null : this._iconForNotificationData(appIcon);
|
||||
|
|
|
|||
|
|
@ -2092,7 +2092,7 @@ export const ScreenshotUI = GObject.registerClass({
|
|||
title,
|
||||
// Translators: notification body when a screencast was recorded.
|
||||
body: this._screencastPath ? _('Click here to view the video.') : '',
|
||||
isTransient: true,
|
||||
displayHint: MessageTray.DisplayHint.TRANSIENT,
|
||||
});
|
||||
|
||||
if (this._screencastPath) {
|
||||
|
|
@ -2337,7 +2337,7 @@ function _storeScreenshot(bytes, pixbuf) {
|
|||
body: _('You can paste the image from the clipboard.'),
|
||||
datetime: time,
|
||||
gicon: content,
|
||||
isTransient: true,
|
||||
displayHint: MessageTray.DisplayHint.TRANSIENT,
|
||||
});
|
||||
|
||||
if (!disableSaveToDisk) {
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ export class ShellMountOperation {
|
|||
source,
|
||||
title,
|
||||
body,
|
||||
isTransient: true,
|
||||
displayHint: MessageTray.DisplayHint.TRANSIENT,
|
||||
iconName: 'media-removable-symbolic',
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -2036,7 +2036,7 @@ class Indicator extends SystemIndicator {
|
|||
body: _('Activation of network connection failed'),
|
||||
iconName: 'network-error-symbolic',
|
||||
urgency: MessageTray.Urgency.HIGH,
|
||||
isTransient: true,
|
||||
displayHint: MessageTray.DisplayHint.TRANSIENT,
|
||||
});
|
||||
this._notification.connect('destroy',
|
||||
() => (this._notification = null));
|
||||
|
|
|
|||
|
|
@ -166,7 +166,9 @@ const NotificationsBox = GObject.registerClass({
|
|||
|
||||
_shouldShowDetails(source) {
|
||||
return source.policy.detailsInLockScreen ||
|
||||
source.narrowestPrivacyScope === MessageTray.PrivacyScope.SYSTEM;
|
||||
source.notifications.every(n =>
|
||||
n.displayHint & MessageTray.DisplayHint.SHOW_CONTENT_ON_LOCKSCREEN
|
||||
);
|
||||
}
|
||||
|
||||
_updateSourceBoxStyle(source, obj, box) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export class WindowAttentionHandler {
|
|||
source,
|
||||
title,
|
||||
body,
|
||||
forFeedback: true,
|
||||
displayHint: MessageTray.DisplayHint.FORCE_IMMEDIATELY,
|
||||
});
|
||||
notification.connect('activated', () => {
|
||||
source.open();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue