NotificationDaemon: don't notify for resident notifications when application is focused

The applications have to have a way of keeping resident notifications
updated without unnecessarily notifying the user with the information
the user is already seeing in the application window.

https://bugzilla.gnome.org/show_bug.cgi?id=630847
This commit is contained in:
Neha Doijode 2011-03-22 02:56:04 +05:30 committed by Marina Zhurakhinskaya
parent d1ffd3cf35
commit 8798ec653d

View File

@ -346,7 +346,7 @@ NotificationDaemon.prototype = {
notification.setTransient(hints['transient'] == true); notification.setTransient(hints['transient'] == true);
let sourceIconActor = source.useNotificationIcon ? this._iconForNotificationData(icon, hints, source.ICON_SIZE) : null; let sourceIconActor = source.useNotificationIcon ? this._iconForNotificationData(icon, hints, source.ICON_SIZE) : null;
source.notify(notification, sourceIconActor); source.processNotification(notification, sourceIconActor);
}, },
CloseNotification: function(id) { CloseNotification: function(id) {
@ -445,12 +445,17 @@ Source.prototype = {
this._trayIcon = null; this._trayIcon = null;
}, },
notify: function(notification, icon) { processNotification: function(notification, icon) {
if (!this.app) if (!this.app)
this._setApp(); this._setApp();
if (!this.app && icon) if (!this.app && icon)
this._setSummaryIcon(icon); this._setSummaryIcon(icon);
MessageTray.Source.prototype.notify.call(this, notification);
let tracker = Shell.WindowTracker.get_default();
if (notification.resident && this.app && tracker.focus_app == this.app)
this.pushNotification(notification);
else
this.notify(notification);
}, },
handleSummaryClick: function() { handleSummaryClick: function() {