From a3c1c09cc122b0bf94ec1e365a13b02f300f06c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 19 Feb 2015 13:45:31 +0100 Subject: [PATCH] messageTray: Record actions added to notifications Both the screen shield and the notification section in the message list create their own UI for notifications rather than using the notification actor itself. Currently there is no clean way for such representations to include notification actions - we will need this as we will soon use a separate actor for banners as well, so keep track of actions added via addAction(). --- js/ui/messageTray.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 96fa917b8..a9ee24f06 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -495,6 +495,7 @@ const Notification = new Lang.Class({ this._soundName = null; this._soundFile = null; this._soundPlayed = false; + this.actions = []; this.actor = new St.Button({ accessible_role: Atk.Role.NOTIFICATION }); this.actor.add_style_class_name('notification-unexpanded'); @@ -594,6 +595,7 @@ const Notification = new Lang.Class({ this._actionArea.destroy(); this._actionArea = null; this._buttonBox = null; + this.actions = []; } if (!this._scrollArea && !this._actionArea) this._table.remove_style_class_name('multi-line-notification'); @@ -818,6 +820,7 @@ const Notification = new Lang.Class({ // action buttons will appear in a single row at the bottom of // the notification. addAction: function(label, callback) { + this.actions.push({ label: label, callback: callback }); let button = new St.Button({ style_class: 'notification-button', label: label, can_focus: true });