mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-18 07:34:54 +00:00
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
1 changed files with 11 additions and 6 deletions
|
|
@ -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);
|
||||
})));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue