screenShield: Show detailed notification data if notifications hint it
Allow notifications to set a x-gnome-privacy-scope hint, with values in ['system', 'user']. If all the notifications in a particular source hint that their privacy scope is ‘system’, don’t hide the notification details on the lock screen. This is aimed at fixing the particular case of power notifications: they contain information which is not private to the user (it relates to the system: battery state or AC state, which is obvious to anyone who can see the machine), so hiding the details of a power management notification when the screen is locked is pointless. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://gitlab.gnome.org/GNOME/gnome-shell/issues/726
This commit is contained in:

committed by
Florian Müllner

parent
37e0a73c8f
commit
e92477a752
@ -203,6 +203,11 @@ var NotificationsBox = class {
|
||||
return [title, null];
|
||||
}
|
||||
|
||||
_shouldShowDetails(source) {
|
||||
return source.policy.detailsInLockScreen ||
|
||||
source.narrowestPrivacyScope == MessageTray.PrivacyScope.SYSTEM;
|
||||
}
|
||||
|
||||
_showSource(source, obj, box) {
|
||||
if (obj.detailed) {
|
||||
[obj.titleLabel, obj.countLabel] = this._makeNotificationDetailedSource(source, box);
|
||||
@ -216,7 +221,7 @@ var NotificationsBox = class {
|
||||
_sourceAdded(tray, source, initial) {
|
||||
let obj = {
|
||||
visible: source.policy.showInLockScreen,
|
||||
detailed: source.policy.detailsInLockScreen,
|
||||
detailed: this._shouldShowDetails(source),
|
||||
sourceDestroyId: 0,
|
||||
sourceCountChangedId: 0,
|
||||
sourceTitleChangedId: 0,
|
||||
@ -280,7 +285,14 @@ var NotificationsBox = class {
|
||||
}
|
||||
|
||||
_countChanged(source, obj) {
|
||||
if (obj.detailed) {
|
||||
// A change in the number of notifications may change whether we show
|
||||
// details.
|
||||
let newDetailed = this._shouldShowDetails(source);
|
||||
let oldDetailed = obj.detailed;
|
||||
|
||||
obj.detailed = newDetailed;
|
||||
|
||||
if (obj.detailed || oldDetailed != newDetailed) {
|
||||
// A new notification was pushed, or a previous notification was destroyed.
|
||||
// Give up, and build the list again.
|
||||
|
||||
@ -312,10 +324,11 @@ var NotificationsBox = class {
|
||||
}
|
||||
|
||||
_detailedChanged(source, obj) {
|
||||
if (obj.detailed == source.policy.detailsInLockScreen)
|
||||
let newDetailed = this._shouldShowDetails(source);
|
||||
if (obj.detailed == newDetailed)
|
||||
return;
|
||||
|
||||
obj.detailed = source.policy.detailsInLockScreen;
|
||||
obj.detailed = newDetailed;
|
||||
|
||||
obj.sourceBox.destroy_all_children();
|
||||
obj.titleLabel = obj.countLabel = null;
|
||||
|
Reference in New Issue
Block a user