[gnome-shell] notificationDaemon: Include timestamp in serialized notifications



commit 4e491b6f75a3655ce497cd8192585e03da96a435
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Feb 27 00:15:29 2017 +0100

    notificationDaemon: Include timestamp in serialized notifications
    
    GNotifications are persistent until dismissed or withdrawn, including
    across restarts. As we show the time a notification was received in the
    calendar, we need to include that information when serializing the
    notification in order to be correct.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775799

 js/ui/notificationDaemon.js |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 623a10f..df1a43d 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -600,7 +600,8 @@ const GtkNotificationDaemonNotification = new Lang.Class({
               "priority": priority,
               "buttons": buttons,
               "default-action": defaultAction,
-              "default-action-target": defaultActionTarget } = notification;
+              "default-action-target": defaultActionTarget,
+              "timestamp": time } = notification;
 
         if (priority) {
             let urgency = PRIORITY_URGENCY_MAP[priority.unpack()];
@@ -623,7 +624,8 @@ const GtkNotificationDaemonNotification = new Lang.Class({
         this._defaultActionTarget = defaultActionTarget;
 
         this.update(title.unpack(), body ? body.unpack() : null,
-                    { gicon: gicon ? Gio.icon_deserialize(gicon) : null });
+                    { gicon: gicon ? Gio.icon_deserialize(gicon) : null,
+                      datetime : time ? GLib.DateTime.new_from_unix_local(time.unpack()) : null });
     },
 
     _activateAction: function(namespacedActionId, target) {
@@ -864,6 +866,9 @@ const GtkNotificationDaemon = new Lang.Class({
             return;
         }
 
+        let timestamp = GLib.DateTime.new_now_local().to_unix();
+        notification['timestamp'] = new GLib.Variant('x', timestamp);
+
         source.addNotification(notificationId, notification, true);
 
         invocation.return_value(null);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]