Telepathy: hide chat notifications when focusing the app

When the chat app is focused, we should hide all banners immediately.
A good way to do so, without tracking which app is focused, is
to look for messages that are acked when the banner is unexpanded,
which implies they were acked by some other telepathy client.

https://bugzilla.gnome.org/show_bug.cgi?id=746364
This commit is contained in:
Giovanni Campagna 2015-03-17 13:08:05 -07:00
parent 934ec3c3fe
commit d8926b96e2

View File

@ -577,6 +577,10 @@ const ChatSource = new Lang.Class({
this._pendingMessages.splice(idx, 1);
this.countUpdated();
}
if (this._pendingMessages.length == 0 &&
this._banner && !this._banner.expanded)
this._banner.hide();
},
_ackMessages: function() {
@ -830,6 +834,10 @@ const ChatNotificationBanner = new Lang.Class({
adjustment.value = adjustment.upper;
},
hide: function() {
this.emit('done-displaying');
},
_addMessage: function(message) {
let highlighter = new Calendar.URLHighlighter(message.body, true, true);
let body = highlighter.actor;