From f967fd21f8f101dc9e6e3a8c3e660750fe08cb07 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Tue, 28 Feb 2012 17:12:20 -0500 Subject: [PATCH] windowAttentionHandler: Fix updating on title changes We were supposed to be updating the notification's title when the window title changes, but we didn't actually bother to re-format the title and body, effectively leaving the notification unchanged. --- js/ui/windowAttentionHandler.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/js/ui/windowAttentionHandler.js b/js/ui/windowAttentionHandler.js index 3c946ad2b..e503de46b 100644 --- a/js/ui/windowAttentionHandler.js +++ b/js/ui/windowAttentionHandler.js @@ -14,6 +14,12 @@ const WindowAttentionHandler = new Lang.Class({ global.display.connect('window-demands-attention', Lang.bind(this, this._onWindowDemandsAttention)); }, + _getTitleAndBanner: function(app, window) { + let title = app.get_name(); + let banner = _("'%s' is ready").format(window.get_title()); + return [title, banner] + }, + _onWindowDemandsAttention : function(display, window) { // We don't want to show the notification when the window is already focused, // because this is rather pointless. @@ -30,16 +36,15 @@ const WindowAttentionHandler = new Lang.Class({ let source = new Source(app, window); Main.messageTray.add(source); - let banner = _("'%s' is ready").format(window.title); - let title = app.get_name(); + let [title, banner] = this._getTitleAndBanner(app, window); let notification = new MessageTray.Notification(source, title, banner); source.notify(notification); - source.signalIDs.push(window.connect('notify::title', - Lang.bind(this, function() { - notification.update(title, banner); - }))); + source.signalIDs.push(window.connect('notify::title', Lang.bind(this, function() { + let [title, banner] = this._getTitleAndBanner(app, window); + notification.update(title, banner); + }))); } });