Multiple “New Message” desktop notifications
I noticed that Balsa usually displays more then one You have received … new messages. desktop notification when more than one watched mailbox contains new messages, e.g. if they have been distributed by
procmail. Expected would be one notification, where the count is updated for each mailbox whilst Balsa is inactive.
This behavior is apparently a race condition caused by the Freedesktop
GNotification implementation. Updating (or removing) a notification still being displayed requires the numerical ID assigned by the notification daemon (
xfce4-notifyd in my case), transmitted in the replay from it. As
g_application_send_notification() just sends the request, and processes the reply asynchronously, the ID of the previous notification may still be unknown if the notification update occurs earlier than this reply has arrived. As a result, a new notification is created, even if it has the same identifier, resulting in the aforementioned effect.
Possible solution: use a timeout to “collect” notifications, and to ensure a sufficiently long delay between multiple calls to
g_application_send_notification() with the same identifier.