[gnome-shell/gbsneto/new-lock-screen-part2: 52/52] unlockDialog: Add .critical CSS class to critical notifications
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/new-lock-screen-part2: 52/52] unlockDialog: Add .critical CSS class to critical notifications
- Date: Wed, 5 Feb 2020 16:16:48 +0000 (UTC)
commit cd0c19d57b599e590e605a46e44c36f9d06981d8
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Feb 5 11:58:57 2020 -0300
unlockDialog: Add .critical CSS class to critical notifications
data/theme/gnome-shell-sass/widgets/_screen-shield.scss | 2 ++
js/ui/unlockDialog.js | 17 +++++++++++++++++
2 files changed, 19 insertions(+)
---
diff --git a/data/theme/gnome-shell-sass/widgets/_screen-shield.scss
b/data/theme/gnome-shell-sass/widgets/_screen-shield.scss
index 5958c3ea80..8e0b994d3c 100644
--- a/data/theme/gnome-shell-sass/widgets/_screen-shield.scss
+++ b/data/theme/gnome-shell-sass/widgets/_screen-shield.scss
@@ -35,6 +35,8 @@
background-color: transparentize($osd_bg_color,0.5);
color: $osd_fg_color;
border-radius: 4px;
+
+ &.critical { background-color: transparentize($osd_bg_color,0.1) }
}
}
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index f8bf58a100..4e7ec3f7ec 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -145,6 +145,20 @@ var NotificationsBox = GObject.registerClass({
source.narrowestPrivacyScope === MessageTray.PrivacyScope.SYSTEM;
}
+ _updateSourceBoxStyle(source, obj, box) {
+ let hasCriticalNotification =
+ source.notifications.some(n => n.urgency === MessageTray.Urgency.CRITICAL);
+
+ if (hasCriticalNotification !== obj.hasCriticalNotification) {
+ obj.hasCriticalNotification = hasCriticalNotification;
+
+ if (hasCriticalNotification)
+ box.style_class = 'unlock-dialog-notification-source critical';
+ else
+ box.style_class = 'unlock-dialog-notification-source';
+ }
+ }
+
_showSource(source, obj, box) {
if (obj.detailed)
[obj.titleLabel, obj.countLabel] = this._makeNotificationDetailedSource(source, box);
@@ -152,6 +166,8 @@ var NotificationsBox = GObject.registerClass({
[obj.titleLabel, obj.countLabel] = this._makeNotificationSource(source, box);
box.visible = obj.visible && (source.unseenCount > 0);
+
+ this._updateSourceBoxStyle(source, obj, box);
}
_sourceAdded(tray, source, initial) {
@@ -165,6 +181,7 @@ var NotificationsBox = GObject.registerClass({
sourceBox: null,
titleLabel: null,
countLabel: null,
+ hasCriticalNotification: false,
};
obj.sourceBox = new St.BoxLayout({
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]