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.
This commit is contained in:
parent
8d854d5f1a
commit
f967fd21f8
@ -14,6 +14,12 @@ const WindowAttentionHandler = new Lang.Class({
|
|||||||
global.display.connect('window-demands-attention', Lang.bind(this, this._onWindowDemandsAttention));
|
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) {
|
_onWindowDemandsAttention : function(display, window) {
|
||||||
// We don't want to show the notification when the window is already focused,
|
// We don't want to show the notification when the window is already focused,
|
||||||
// because this is rather pointless.
|
// because this is rather pointless.
|
||||||
@ -30,14 +36,13 @@ const WindowAttentionHandler = new Lang.Class({
|
|||||||
let source = new Source(app, window);
|
let source = new Source(app, window);
|
||||||
Main.messageTray.add(source);
|
Main.messageTray.add(source);
|
||||||
|
|
||||||
let banner = _("'%s' is ready").format(window.title);
|
let [title, banner] = this._getTitleAndBanner(app, window);
|
||||||
let title = app.get_name();
|
|
||||||
|
|
||||||
let notification = new MessageTray.Notification(source, title, banner);
|
let notification = new MessageTray.Notification(source, title, banner);
|
||||||
source.notify(notification);
|
source.notify(notification);
|
||||||
|
|
||||||
source.signalIDs.push(window.connect('notify::title',
|
source.signalIDs.push(window.connect('notify::title', Lang.bind(this, function() {
|
||||||
Lang.bind(this, function() {
|
let [title, banner] = this._getTitleAndBanner(app, window);
|
||||||
notification.update(title, banner);
|
notification.update(title, banner);
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user