diff options
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/net/notifications.el | 15 |
2 files changed, 17 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c5b72d2d173..035902e1021 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2010-06-10 Julien Danjou <julien@danjou.info> | ||
| 2 | |||
| 3 | * net/notifications.el (notifications-on-action-signal) | ||
| 4 | (notifications-on-closed-signal): Pass notification id as first | ||
| 5 | argument to the callback functions. Add docstrings. | ||
| 6 | (notifications-notify): Fix docstring. | ||
| 7 | |||
| 1 | 2010-06-10 Glenn Morris <rgm@gnu.org> | 8 | 2010-06-10 Glenn Morris <rgm@gnu.org> |
| 2 | 9 | ||
| 3 | * emacs-lisp/authors.el (authors-ignored-files) | 10 | * emacs-lisp/authors.el (authors-ignored-files) |
diff --git a/lisp/net/notifications.el b/lisp/net/notifications.el index ef246c7408e..beb63a6311b 100644 --- a/lisp/net/notifications.el +++ b/lisp/net/notifications.el | |||
| @@ -86,9 +86,10 @@ | |||
| 86 | "Mapping between notification and close callback functions.") | 86 | "Mapping between notification and close callback functions.") |
| 87 | 87 | ||
| 88 | (defun notifications-on-action-signal (id action) | 88 | (defun notifications-on-action-signal (id action) |
| 89 | "Dispatch signals to callback functions from `notifications-on-action-map'." | ||
| 89 | (let ((entry (assoc id notifications-on-action-map))) | 90 | (let ((entry (assoc id notifications-on-action-map))) |
| 90 | (when entry | 91 | (when entry |
| 91 | (funcall (cadr entry) action) | 92 | (funcall (cadr entry) id action) |
| 92 | (remove entry 'notifications-on-action-map)))) | 93 | (remove entry 'notifications-on-action-map)))) |
| 93 | 94 | ||
| 94 | (dbus-register-signal | 95 | (dbus-register-signal |
| @@ -100,9 +101,11 @@ | |||
| 100 | 'notifications-on-action-signal) | 101 | 'notifications-on-action-signal) |
| 101 | 102 | ||
| 102 | (defun notifications-on-closed-signal (id reason) | 103 | (defun notifications-on-closed-signal (id reason) |
| 104 | "Dispatch signals to callback functions from `notifications-on-closed-map'." | ||
| 103 | (let ((entry (assoc id notifications-on-close-map))) | 105 | (let ((entry (assoc id notifications-on-close-map))) |
| 104 | (when entry | 106 | (when entry |
| 105 | (funcall (cadr entry) (cadr (assoc reason notifications-closed-reason))) | 107 | (funcall (cadr entry) |
| 108 | id (cadr (assoc reason notifications-closed-reason))) | ||
| 106 | (remove entry 'notifications-on-close-map)))) | 109 | (remove entry 'notifications-on-close-map)))) |
| 107 | 110 | ||
| 108 | (dbus-register-signal | 111 | (dbus-register-signal |
| @@ -155,11 +158,13 @@ Various PARAMS can be set: | |||
| 155 | should point to. The \"y\" hint must also be specified. | 158 | should point to. The \"y\" hint must also be specified. |
| 156 | :y Specifies the Y location on the screen that the notification | 159 | :y Specifies the Y location on the screen that the notification |
| 157 | should point to. The \"x\" hint must also be specified. | 160 | should point to. The \"x\" hint must also be specified. |
| 158 | :on-action Function to call when an action is invoked. The key of the | 161 | :on-action Function to call when an action is invoked. |
| 159 | action is passed as argument to the function. | 162 | The notification id and the key of the action are passed |
| 163 | as arguments to the function. | ||
| 160 | :on-close Function to call when the notification has been closed | 164 | :on-close Function to call when the notification has been closed |
| 161 | by timeout or by the user. | 165 | by timeout or by the user. |
| 162 | The function receives the closing reason as argument: | 166 | The function receive the notification id and the closing |
| 167 | reason as arguments: | ||
| 163 | - `expired' if the notification has expired | 168 | - `expired' if the notification has expired |
| 164 | - `dismissed' if the notification was dismissed by the user | 169 | - `dismissed' if the notification was dismissed by the user |
| 165 | - `close-notification' if the notification was closed | 170 | - `close-notification' if the notification was closed |