diff --git a/js/ui/calendar.js b/js/ui/calendar.js index 2ed812613..70252e2ec 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -946,8 +946,8 @@ const NotificationSection = new Lang.Class({ !Main.sessionMode.isGreeter; }, - _createTimeLabel: function() { - let label = Util.createTimeLabel(new Date()); + _createTimeLabel: function(datetime) { + let label = Util.createTimeLabel(datetime); label.style_class = 'event-time', label.x_align = Clutter.ActorAlign.END; return label; @@ -970,13 +970,13 @@ const NotificationSection = new Lang.Class({ _onNotificationAdded: function(source, notification) { let message = new NotificationMessage(notification); - message.setSecondaryActor(this._createTimeLabel()); + message.setSecondaryActor(this._createTimeLabel(notification.datetime)); let isUrgent = notification.urgency == MessageTray.Urgency.CRITICAL; let updatedId = notification.connect('updated', Lang.bind(this, function() { - message.setSecondaryActor(this._createTimeLabel()); + message.setSecondaryActor(this._createTimeLabel(notification.datetime)); this.moveMessage(message, isUrgent ? 0 : this._nUrgent, this.actor.mapped); })); let destroyId = notification.connect('destroy', Lang.bind(this, diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 4f1ab7fea..fe1b4d8e7 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -368,6 +368,7 @@ const Notification = new Lang.Class({ secondaryGIcon: null, bannerMarkup: false, clear: false, + datetime: null, soundName: null, soundFile: null }); @@ -375,6 +376,11 @@ const Notification = new Lang.Class({ this.bannerBodyText = banner; this.bannerBodyMarkup = params.bannerMarkup; + if (params.datetime) + this.datetime = params.datetime; + else + this.datetime = GLib.DateTime.new_now_local(); + if (params.gicon || params.clear) this.gicon = params.gicon;