[gnome-shell/gnome-3-12] notificationdaemon: fix gtk protocol for	newer glib
- From: Florian Müllner <fmuellner src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gnome-shell/gnome-3-12] notificationdaemon: fix gtk protocol for	newer glib
 
- Date: Fri,  7 Nov 2014 18:15:14 +0000 (UTC)
 
commit 68f5674e626e06a8f944b6438ad5d63d1ecda739
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Tue Jul 1 21:47:31 2014 +0200
    notificationdaemon: fix gtk protocol for newer glib
    
    The new protocol uses a "priority" string instead of the "urgent"
    boolean.
 js/ui/notificationDaemon.js |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 4610780..d26f3d1 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -691,6 +691,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({
     Name: 'GtkNotificationDaemonNotification',
@@ -704,12 +710,20 @@ const GtkNotificationDaemonNotification = new Lang.Class({
               "body": body,
               "icon": gicon,
               "urgent": urgent,
+              "priority": priority,
               "buttons": buttons,
               "default-action": defaultAction,
               "default-action-target": defaultActionTarget } = notification;
 
-        this.setUrgency(urgent.unpack() ? MessageTray.Urgency.CRITICAL
-                                        : MessageTray.Urgency.NORMAL);
+        if (priority) {
+            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) {
             buttons.deep_unpack().forEach(Lang.bind(this, function(button) {
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]