From 4e491b6f75a3655ce497cd8192585e03da96a435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 27 Feb 2017 00:15:29 +0100 Subject: [PATCH] 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 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js index 623a10fed..df1a43dbf 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);