From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.help Subject: Re: notifications-notify resets idle-time Date: Tue, 06 Mar 2012 11:34:08 +0100 Message-ID: <87wr6yvx0f.fsf@gmx.de> References: <874nuy5okw.fsf@micropit.couberia.bzh> <87wr7tr8um.fsf@gmx.de> <87obt5siph.fsf@micropit.couberia.bzh> <87wr7t5ys8.fsf@gmx.de> <87hayxsfbo.fsf@micropit.couberia.bzh> <87sjih2wdo.fsf@gmx.de> <87mx8p5nqa.fsf@micropit.couberia.bzh> <87obt5mgc8.fsf@gmx.de> <87fweh5gw4.fsf@micropit.couberia.bzh> <87fwegv2c1.fsf@gmx.de> <877gzs5mw1.fsf@micropit.couberia.bzh> <87bop4uut0.fsf@gmx.de> <87lio7okjw.fsf@micropit.couberia.bzh> <87sjif21m2.fsf@gmx.de> <874nuvi1bl.fsf@micropit.couberia.bzh> <87lio7j6g3.fsf@gmx.de> <87ehtyhh8d.fsf@micropit.couberia.bzh> <87hayuk7jn.fsf@gmx.de> <87pqdie396.fsf@micropit.couberia.bzh> <87k43pycii.fsf@gmx.de> <87fwdogiv5.fsf@micropit.couberia.bzh> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1331030102 28120 80.91.229.3 (6 Mar 2012 10:35:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 6 Mar 2012 10:35:02 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Peter =?utf-8?Q?M=C3=BCnster?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 06 11:35:01 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S4rjP-0003iX-S4 for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Mar 2012 11:35:00 +0100 Original-Received: from localhost ([::1]:40113 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4rjP-0003ju-5O for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Mar 2012 05:34:59 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4rjG-0003jf-Ir for help-gnu-emacs@gnu.org; Tue, 06 Mar 2012 05:34:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S4rio-0008KK-T8 for help-gnu-emacs@gnu.org; Tue, 06 Mar 2012 05:34:50 -0500 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:44932) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1S4rio-0008Ib-Jo for help-gnu-emacs@gnu.org; Tue, 06 Mar 2012 05:34:22 -0500 Original-Received: (qmail invoked by alias); 06 Mar 2012 10:34:17 -0000 Original-Received: from p57BB9696.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.150.150] by mail.gmx.net (mp037) with SMTP; 06 Mar 2012 11:34:17 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX19EyW5Q3GhEsUkXT4nZBR853YHgT1tzeBqe2qv3at Zkuyu1DnRKlZp9 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 213.165.64.23 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:83952 Archived-At: Peter M=C3=BCnster writes: Hi Peter, > It seems, that I rather need dbus-unregister-object, because I only want > to unregister the closed-signal, not the action-signal. So I patched > notifications.el: I have generalized your patch. It is not needed anymore to call `dbus-unregister-object' in your code. Could you, please, check whether it fits your needs? Note that this patch is based on notifications.el as I have committed to the trunk two days ago, --8<---------------cut here---------------start------------->8--- *** /home/albinus/src/emacs/lisp/notifications.el.~107516~ 2012-03-06 11:18= :32.000000000 +0100 --- /home/albinus/src/emacs/lisp/notifications.el 2012-03-06 11:18:32.00000= 0000 +0100 *************** *** 88,112 **** (defvar notifications-on-action-map nil "Mapping between notification and action callback functions.") (defvar notifications-on-close-map nil "Mapping between notification and close callback functions.") (defun notifications-on-action-signal (id action) "Dispatch signals to callback functions from `notifications-on-action-m= ap'." (let* ((unique-name (dbus-event-service-name last-input-event)) (entry (assoc (cons unique-name id) notifications-on-action-map))) (when entry (funcall (cadr entry) id action) ! (remove entry notifications-on-action-map)))) ! ! (when (fboundp 'dbus-register-signal) ! (dbus-register-signal ! :session ! nil ! notifications-path ! notifications-interface ! notifications-action-signal ! 'notifications-on-action-signal)) (defun notifications-on-closed-signal (id &optional reason) "Dispatch signals to callback functions from `notifications-on-closed-m= ap'." --- 88,113 ---- (defvar notifications-on-action-map nil "Mapping between notification and action callback functions.") + (defvar notifications-on-action-object nil + "Object for registered on-action signal.") + (defvar notifications-on-close-map nil "Mapping between notification and close callback functions.") + (defvar notifications-on-close-object nil + "Object for registered on-close signal.") + (defun notifications-on-action-signal (id action) "Dispatch signals to callback functions from `notifications-on-action-m= ap'." (let* ((unique-name (dbus-event-service-name last-input-event)) (entry (assoc (cons unique-name id) notifications-on-action-map))) (when entry (funcall (cadr entry) id action) ! (when (and (not (setq notifications-on-action-map ! (remove entry notifications-on-action-map))) ! notifications-on-action-object) ! (dbus-unregister-object notifications-on-action-object) ! (setq notifications-on-action-object nil))))) (defun notifications-on-closed-signal (id &optional reason) "Dispatch signals to callback functions from `notifications-on-closed-m= ap'." *************** *** 118,133 **** (when entry (funcall (cadr entry) id (cadr (assoc reason notifications-closed-reason))) ! (remove entry notifications-on-close-map)))) ! ! (when (fboundp 'dbus-register-signal) ! (dbus-register-signal ! :session ! nil ! notifications-path ! notifications-interface ! notifications-closed-signal ! 'notifications-on-closed-signal)) (defun notifications-notify (&rest params) "Send notification via D-Bus using the Freedesktop notification protoco= l. --- 119,129 ---- (when entry (funcall (cadr entry) id (cadr (assoc reason notifications-closed-reason))) ! (when (and (not (setq notifications-on-close-map ! (remove entry notifications-on-close-map))) ! notifications-on-close-object) ! (dbus-unregister-object notifications-on-close-object) ! (setq notifications-on-close-object nil))))) (defun notifications-notify (&rest params) "Send notification via D-Bus using the Freedesktop notification protoco= l. *************** *** 287,296 **** (unique-name (dbus-get-name-owner :session notifications-service))) (when on-action (add-to-list 'notifications-on-action-map ! (list (cons unique-name id) on-action))) (when on-close (add-to-list 'notifications-on-close-map ! (list (cons unique-name id) on-close)))) ;; Return notification id id)) --- 283,311 ---- (unique-name (dbus-get-name-owner :session notifications-service))) (when on-action (add-to-list 'notifications-on-action-map ! (list (cons unique-name id) on-action)) ! (unless notifications-on-action-object ! (setq notifications-on-action-object ! (dbus-register-signal ! :session ! nil ! notifications-path ! notifications-interface ! notifications-action-signal ! 'notifications-on-action-signal)))) ! (when on-close (add-to-list 'notifications-on-close-map ! (list (cons unique-name id) on-close)) ! (unless notifications-on-close-object ! (setq notifications-on-close-object ! (dbus-register-signal ! :session ! nil ! notifications-path ! notifications-interface ! notifications-closed-signal ! 'notifications-on-closed-signal))))) ;; Return notification id id)) --8<---------------cut here---------------end--------------->8--- If that works for you, I would be willing to commit it to the trunk, still for Emacs 24.1. We could close then also bug#10807. Best regards, Michael.