gnus-notification.el: Add mark as read
authorrasmus <x200s@pank.eu>
Sat, 7 Mar 2015 17:12:41 +0000 (18:12 +0100)
committerAdam Sjøgren <asjo@koldfront.dk>
Sat, 7 Mar 2015 21:52:15 +0000 (22:52 +0100)
* gnus-notifications.el (gnus-notifications-action): Allow mark as read.
  (gnus-notifications-notify): Show uption to mark as read.

lisp/ChangeLog
lisp/gnus-notifications.el

index e6330be..c92b5a1 100644 (file)
@@ -2,6 +2,8 @@
 
        * gnus-notifications.el (gnus-notifications-action): Raise window
        frame.
+       (gnus-notifications-action): Allow mark as read.
+       (gnus-notifications-notify): Show uption to mark as read.
 
 2015-02-25  Adam Sjøgren  <asjo@koldfront.dk>
 
index 1ed344e..7f8fd9e 100644 (file)
@@ -75,13 +75,19 @@ not get notifications."
   "Map notifications ids to messages.")
 
 (defun gnus-notifications-action (id key)
-  (when (string= key "read")
-    (let ((group-article (assoc id gnus-notifications-id-to-msg)))
-      (when group-article
-        (let ((group (cadr group-article))
-              (article (nth 2 group-article)))
-          (gnus-fetch-group group (list article))
-          (when (window-system) (x-focus-frame (selected-frame))))))))
+  (let ((group-article (assoc id gnus-notifications-id-to-msg)))
+    (when group-article
+      (let ((group (cadr group-article))
+            (article (nth 2 group-article)))
+        (cond ((string= key "read")
+               (gnus-fetch-group group (list article))
+               (when (window-system) (x-focus-frame (selected-frame))))
+              ((string= key "mark-read")
+               (gnus-update-read-articles
+                group
+                (delq article (gnus-list-of-unread-articles group)))
+               ;; gnus-group-refresh-group
+               (gnus-group-update-group group)))))))
 
 (defun gnus-notifications-notify (from subject photo-file)
   "Send a notification about a new mail.
@@ -91,7 +97,7 @@ Return a notification id if any, or t on success."
        'notifications-notify
        :title from
        :body subject
-       :actions '("read" "Read")
+       :actions '("read" "Read" "mark-read" "Mark As Read")
        :on-action 'gnus-notifications-action
        :app-icon (gnus-funcall-no-warning
                   'image-search-load-path "gnus/gnus.png")