diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index b045894b8..378dff028 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -59,6 +59,7 @@ function Source(id, createIcon) { Source.prototype = { _init: function(id, createIcon) { this.id = id; + this.text = null; if (createIcon) this.createIcon = createIcon; }, @@ -70,7 +71,8 @@ Source.prototype = { }, notify: function(text) { - Main.messageTray.showNotification(new Notification(this.createIcon(ICON_SIZE), text)); + this.text = text; + this.emit('notify'); }, clicked: function() { @@ -145,6 +147,8 @@ MessageTray.prototype = { this._icons[source.id] = iconBox; this._sources[source.id] = source; + source.connect('notify', Lang.bind(this, this._onNotify)); + iconBox.connect('button-release-event', Lang.bind(this, function () { source.clicked(); @@ -169,6 +173,11 @@ MessageTray.prototype = { return this._sources[id]; }, + _onNotify: function(source) { + let notification = new Notification(source.createIcon(ICON_SIZE), source.text); + this.showNotification(notification); + }, + _onMessageTrayEntered: function() { // Don't hide the message tray after a timeout if the user has moved the mouse over it. // We might have a timeout in place if the user moved the mouse away from the message tray for a very short period of time