mirror of
https://github.com/pulb/mailnag.git
synced 2026-07-01 00:29:09 +02:00
libnotify plugin: explicitly put new mails on top (potentially fixes #57)
This commit is contained in:
@@ -181,7 +181,7 @@ class LibNotifyPlugin(Plugin):
|
||||
if config['notification_mode'] == NOTIFICATION_MODE_COUNT:
|
||||
self._notify_count(len(all_mails))
|
||||
elif config['notification_mode'] == NOTIFICATION_MODE_SUMMARY:
|
||||
self._notify_summary(all_mails)
|
||||
self._notify_summary(new_mails, all_mails)
|
||||
else:
|
||||
self._notify_single(new_mails)
|
||||
|
||||
@@ -190,10 +190,18 @@ class LibNotifyPlugin(Plugin):
|
||||
t.start()
|
||||
|
||||
|
||||
def _notify_summary(self, mails):
|
||||
def _notify_summary(self, new_mails, all_mails):
|
||||
summary = ""
|
||||
body = ""
|
||||
|
||||
# The mail list (all_mails) is sorted by date (mails with most recent
|
||||
# date on top). New mails with no date or older mails that come in
|
||||
# delayed won't be listed on top. So if a mail with no or an older date
|
||||
# arrives, it gives the impression that the top most mail (i.e. the mail
|
||||
# with the most recent date) is re-notified.
|
||||
# To fix that, simply put new mails on top explicitly.
|
||||
mails = new_mails + [m for m in all_mails if m not in new_mails]
|
||||
|
||||
if len(self._notifications) == 0:
|
||||
self._notifications['0'] = self._get_notification(" ", None, None) # empty string will emit a gtk warning
|
||||
|
||||
|
||||
Reference in New Issue
Block a user