From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Julien Danjou Newsgroups: gmane.emacs.devel Subject: [PATCH] Passes notification id as argument of on-action and on-close functions Date: Thu, 10 Jun 2010 10:43:04 +0200 Message-ID: <1276159384-3457-1-git-send-email-julien@danjou.info> References: <878w6nb8dr.fsf@gmx.de> NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1276160384 26716 80.91.229.12 (10 Jun 2010 08:59:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 10 Jun 2010 08:59:44 +0000 (UTC) Cc: Julien Danjou To: emacs-devel@gnu.org, Tassilo Horn , Stefan Monnier , Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 10 10:59:42 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OMdbx-0006V6-UM for ged-emacs-devel@m.gmane.org; Thu, 10 Jun 2010 10:59:42 +0200 Original-Received: from localhost ([127.0.0.1]:55111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OMdMD-0007vP-QZ for ged-emacs-devel@m.gmane.org; Thu, 10 Jun 2010 04:43:25 -0400 Original-Received: from [140.186.70.92] (port=54240 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OMdM5-0007vH-Gd for emacs-devel@gnu.org; Thu, 10 Jun 2010 04:43:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OMdLz-0000Jw-AI for emacs-devel@gnu.org; Thu, 10 Jun 2010 04:43:17 -0400 Original-Received: from prometheus.naquadah.org ([212.85.154.174]:54807 helo=mx1.naquadah.org) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OMdLz-0000JU-2Y for emacs-devel@gnu.org; Thu, 10 Jun 2010 04:43:11 -0400 Original-Received: by mx1.naquadah.org (Postfix, from userid 8) id 23D995C142; Thu, 10 Jun 2010 10:43:09 +0200 (CEST) Original-Received: from keller.adm.naquadah.org (chapai.naquadah.org [82.227.158.144]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.naquadah.org (Postfix) with ESMTPSA id 299B35C123; Thu, 10 Jun 2010 10:43:07 +0200 (CEST) Original-Received: from jd by keller.adm.naquadah.org with local (Exim 4.72) (envelope-from ) id 1OMdLu-0000uF-Hj; Thu, 10 Jun 2010 10:43:06 +0200 X-Mailer: git-send-email 1.7.1 In-Reply-To: <878w6nb8dr.fsf@gmx.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:125701 Archived-At: Signed-off-by: Julien Danjou --- lisp/ChangeLog | 6 ++++++ lisp/net/notifications.el | 16 +++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a21517b..07a36ce 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2010-06-10 Julien Danjou + + * net/notifications.el (notifications-on-action-signal) + (notifications-on-closed-signal): Pass notification id as first + argument to the callback functions. Add docstrings. + 2010-06-10 Glenn Morris * emacs-lisp/authors.el (authors-ignored-files) diff --git a/lisp/net/notifications.el b/lisp/net/notifications.el index ef246c7..4b619a4 100644 --- a/lisp/net/notifications.el +++ b/lisp/net/notifications.el @@ -86,9 +86,11 @@ "Mapping between notification and close callback functions.") (defun notifications-on-action-signal (id action) + "Dispatch notifications action signals to callback functions +from `notifications-on-action-map'." (let ((entry (assoc id notifications-on-action-map))) (when entry - (funcall (cadr entry) action) + (funcall (cadr entry) id action) (remove entry 'notifications-on-action-map)))) (dbus-register-signal @@ -100,9 +102,11 @@ 'notifications-on-action-signal) (defun notifications-on-closed-signal (id reason) + "Dispatch closed notification signals to callback functions +from `notifications-on-closed-map'." (let ((entry (assoc id notifications-on-close-map))) (when entry - (funcall (cadr entry) (cadr (assoc reason notifications-closed-reason))) + (funcall (cadr entry) id (cadr (assoc reason notifications-closed-reason))) (remove entry 'notifications-on-close-map)))) (dbus-register-signal @@ -155,11 +159,13 @@ Various PARAMS can be set: should point to. The \"y\" hint must also be specified. :y Specifies the Y location on the screen that the notification should point to. The \"x\" hint must also be specified. - :on-action Function to call when an action is invoked. The key of the - action is passed as argument to the function. + :on-action Function to call when an action is invoked. + The notification id and the key of the action are passed + as arguments to the function. :on-close Function to call when the notification has been closed by timeout or by the user. - The function receives the closing reason as argument: + The function receive the notification id and the closing + reason as arguments: - `expired' if the notification has expired - `dismissed' if the notification was dismissed by the user - `close-notification' if the notification was closed -- 1.7.1