[geary/mjog/user-plugins: 25/26] Plugin.DesktopNotification: Update notifications



commit 196343807ccc3147f316c7ca966c2bece4f4c64a
Author: Michael Gratton <mike vee net>
Date:   Wed Mar 11 12:23:18 2020 +1100

    Plugin.DesktopNotification: Update notifications
    
    Update notification text since it's cross-account, and hide
    notifications on new mail being retired.

 .../desktop-notifications.vala                     | 26 +++++++++++++---------
 1 file changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/src/client/plugin/desktop-notifications/desktop-notifications.vala 
b/src/client/plugin/desktop-notifications/desktop-notifications.vala
index 4f533795..add646f7 100644
--- a/src/client/plugin/desktop-notifications/desktop-notifications.vala
+++ b/src/client/plugin/desktop-notifications/desktop-notifications.vala
@@ -50,6 +50,7 @@ public class Plugin.DesktopNotifications :
         this.email = yield this.notifications.get_email();
 
         this.notifications.new_messages_arrived.connect(on_new_messages_arrived);
+        this.notifications.new_messages_retired.connect(on_new_messages_retired);
 
         FolderStore folders = yield this.notifications.get_folders();
         folders.folders_available.connect(
@@ -104,15 +105,14 @@ public class Plugin.DesktopNotifications :
                 /// Notification body when a message as been received
                 /// and other unread messages have not been
                 /// seen. First string substitution is the message
-                /// subject, second is the number of unseen messages,
-                /// third is the name of the email account.
-                "%s\n(%d other new message for %s)",
-                "%s\n(%d other new messages for %s)",
+                /// subject and the second is the number of unseen
+                /// messages
+                "%s\n(%d other new message)",
+                "%s\n(%d other new messages)",
                 total - 1
             ).printf(
                 body,
-                total - 1,
-                folder.account.display_name
+                total - 1
             );
         }
 
@@ -136,7 +136,8 @@ public class Plugin.DesktopNotifications :
                 /// above with the number of new messages that have
                 /// arrived, number substitution is the total number
                 /// of unseen messages.
-                "%s, %d new message total", "%s, %d new messages total",
+                "%s, %d new message total",
+                "%s, %d new messages total",
                 total
             ).printf(body, total);
         }
@@ -246,10 +247,9 @@ public class Plugin.DesktopNotifications :
     private inline string to_notitication_title(Account account, int count) {
         return ngettext(
             /// Notification title when new messages have been
-            /// received. String substitution is the name of the email
-            /// account.
-            "New message for %s", "New messages for %s", count
-        ).printf(account.display_name);
+            /// received
+            "New message", "New messages", count
+        );
     }
 
     private void on_new_messages_arrived(Folder folder,
@@ -258,4 +258,8 @@ public class Plugin.DesktopNotifications :
         this.handle_new_messages.begin(folder, total, added);
     }
 
+    private void on_new_messages_retired(Folder folder, int total) {
+        clear_arrived_notification();
+    }
+
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]