unlockDialog: Use just the counter to format notifications
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/872
This commit is contained in:
parent
15692b618a
commit
cfce9550a4
@ -67,11 +67,8 @@ var NotificationsBox = GObject.registerClass({
|
|||||||
this.visible = this._notificationBox.visible;
|
this.visible = this._notificationBox.visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
_makeNotificationCountText(count, isChat) {
|
_makeNotificationCountText(count) {
|
||||||
if (isChat)
|
return "%d".format(count);
|
||||||
return ngettext("%d new message", "%d new messages", count).format(count);
|
|
||||||
else
|
|
||||||
return ngettext("%d new notification", "%d new notifications", count).format(count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_makeNotificationSource(source, box) {
|
_makeNotificationSource(source, box) {
|
||||||
@ -86,8 +83,10 @@ var NotificationsBox = GObject.registerClass({
|
|||||||
textBox.add(title);
|
textBox.add(title);
|
||||||
|
|
||||||
let count = source.unseenCount;
|
let count = source.unseenCount;
|
||||||
let countLabel = new St.Label({ text: this._makeNotificationCountText(count, source.isChat),
|
let countLabel = new St.Label({
|
||||||
style_class: 'unlock-dialog-notification-count-text' });
|
text: this._makeNotificationCountText(count),
|
||||||
|
style_class: 'unlock-dialog-notification-count-text',
|
||||||
|
});
|
||||||
textBox.add(countLabel);
|
textBox.add(countLabel);
|
||||||
|
|
||||||
box.visible = count != 0;
|
box.visible = count != 0;
|
||||||
@ -227,7 +226,7 @@ var NotificationsBox = GObject.registerClass({
|
|||||||
this._showSource(source, obj, obj.sourceBox);
|
this._showSource(source, obj, obj.sourceBox);
|
||||||
} else {
|
} else {
|
||||||
let count = source.unseenCount;
|
let count = source.unseenCount;
|
||||||
obj.countLabel.text = this._makeNotificationCountText(count, source.isChat);
|
obj.countLabel.text = this._makeNotificationCountText(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.sourceBox.visible = obj.visible && (source.unseenCount > 0);
|
obj.sourceBox.visible = obj.visible && (source.unseenCount > 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user