[gnome-shell/wip/fmuellner/notification-redux: 117/128] messageTray: Add buttons from Notification object
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/fmuellner/notification-redux: 117/128] messageTray: Add buttons from Notification object
- Date: Tue, 17 Feb 2015 11:29:30 +0000 (UTC)
commit 265e0ba52d992c7a26cf42bc99b2e68646204cb4
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Feb 17 03:11:50 2015 +0100
messageTray: Add buttons from Notification object
js/ui/messageTray.js | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 24f3192..c195fd9 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -499,8 +499,27 @@ const NotificationBanner = new Lang.Class({
this.parent(notification);
this.actor.add_style_class_name('notification-banner');
+ this.actor.connect('destroy', Lang.bind(this, this._onDestroyed));
this._buttonBox = null;
+
+ this.notification.actions.forEach(Lang.bind(this,
+ function(action) {
+ this.addAction(action.label, action.callback);
+ }));
+
+ this._activatedId = this.notification.connect('activated',
+ Lang.bind(this, function() {
+ // We hide all types of notifications once the user clicks on
+ // them because the common outcome of clicking should be the
+ // relevant window being brought forward and the user's
+ // attention switching to the window.
+ this.emit('done-displaying');
+ }));
+ },
+
+ _onDestroyed: function() {
+ this.notification.disconnect(this._activatedId);
},
addButton: function(button, callback) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]