[gnome-shell] windowAttentionHandler: Fix updating on title changes



commit f967fd21f8f101dc9e6e3a8c3e660750fe08cb07
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Feb 28 17:12:20 2012 -0500

    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 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/windowAttentionHandler.js b/js/ui/windowAttentionHandler.js
index 3c946ad..e503de4 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);
+        })));
     }
 });
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]