GNOME Bugzilla – Bug 610494
messagetray "obsolete" icons should go away
Last modified: 2010-02-23 17:58:02 UTC
When showing an icon in the messagetray (ex: notification from xchat) and the user opens the app/window (xchat) by himself the icon no longer serves a purpose and should not be displayed.
Created attachment 154346 [details] [review] Remove source icon when a corresponding window is activated Note that this patch only works for applications which have at least one open window at the time when the source is added to the summary. This may not be the case for applications in the notification area (e.g. Rhythmbox).
Comment on attachment 154346 [details] [review] Remove source icon when a corresponding window is activated You don't need to do all the work with tracking windows directly; just connect to 'changed::focus-app' on the ShellWindowTracker. However, you should only connect once, for the whole NotificationDaemon, rather than having each source connect separately. Then the NotificationDaemon can remove the correct source, as needed. This will be simpler after bug 607375 is committed. > Note that this patch only works for applications which have at least one open > window at the time when the source is added to the summary. This may not be the > case for applications in the notification area (e.g. Rhythmbox). They're going to be handled specially at some point anyway.
Created attachment 154459 [details] [review] Remove source icon when a corresponding window is activated (In reply to comment #2) > However, you should only connect once, for the whole NotificationDaemon, > rather than having each source connect separately. OK, done. > Then the NotificationDaemon can remove the correct source, as needed. Here's the tricky part - NotificationDaemon does not keep track of the sources it adds, so we either have to add that, do the focus tracking in MessageTray instead, or allow removing sources by app. I went with the latter, but there should be no problem in changing to either of the other options.
Comment on attachment 154459 [details] [review] Remove source icon when a corresponding window is activated >+ if (this._sources[source].app == app) { >+ this.removeSource(this._sources[source]); >+ return; remove the "return"; although the NotificationDaemon only uses a single source per app, other tray users might behave differently, and the name "removeSourceByApp" doesn't suggest "only the first one".
Attachment 154459 [details] pushed as 4d43424 - Remove source icon when a corresponding window is activated