notificationdaemon: fix gtk protocol for newer glib
The new protocol uses a "priority" string instead of the "urgent" boolean.
This commit is contained in:
parent
e5be41b667
commit
dc94f7b9f5
@ -692,6 +692,12 @@ const FdoNotificationDaemonSource = new Lang.Class({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const PRIORITY_URGENCY_MAP = {
|
||||||
|
low: MessageTray.Urgency.LOW,
|
||||||
|
normal: MessageTray.Urgency.NORMAL,
|
||||||
|
high: MessageTray.Urgency.HIGH,
|
||||||
|
urgent: MessageTray.Urgency.CRITICAL
|
||||||
|
};
|
||||||
|
|
||||||
const GtkNotificationDaemonNotification = new Lang.Class({
|
const GtkNotificationDaemonNotification = new Lang.Class({
|
||||||
Name: 'GtkNotificationDaemonNotification',
|
Name: 'GtkNotificationDaemonNotification',
|
||||||
@ -705,12 +711,20 @@ const GtkNotificationDaemonNotification = new Lang.Class({
|
|||||||
"body": body,
|
"body": body,
|
||||||
"icon": gicon,
|
"icon": gicon,
|
||||||
"urgent": urgent,
|
"urgent": urgent,
|
||||||
|
"priority": priority,
|
||||||
"buttons": buttons,
|
"buttons": buttons,
|
||||||
"default-action": defaultAction,
|
"default-action": defaultAction,
|
||||||
"default-action-target": defaultActionTarget } = notification;
|
"default-action-target": defaultActionTarget } = notification;
|
||||||
|
|
||||||
this.setUrgency(urgent.unpack() ? MessageTray.Urgency.CRITICAL
|
if (priority) {
|
||||||
: MessageTray.Urgency.NORMAL);
|
let urgency = PRIORITY_URGENCY_MAP[priority.unpack()];
|
||||||
|
this.setUrgency(urgency != undefined ? urgency : MessageTray.Urgency.NORMAL);
|
||||||
|
} else if (urgent) {
|
||||||
|
this.setUrgency(urgent.unpack() ? MessageTray.Urgency.CRITICAL
|
||||||
|
: MessageTray.Urgency.NORMAL);
|
||||||
|
} else {
|
||||||
|
this.setUrgency(MessageTray.Urgency.NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
if (buttons) {
|
if (buttons) {
|
||||||
buttons.deep_unpack().forEach(Lang.bind(this, function(button) {
|
buttons.deep_unpack().forEach(Lang.bind(this, function(button) {
|
||||||
|
Loading…
Reference in New Issue
Block a user