emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r107498: * notifications.el (notifica


From: Michael Albinus
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107498: * notifications.el (notifications-unique-name): New defvar.
Date: Sun, 04 Mar 2012 12:21:31 +0100
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107498
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Sun 2012-03-04 12:21:31 +0100
message:
  * notifications.el (notifications-unique-name): New defvar.
  (notifications-on-action-signal, notifications-on-closed-signal):
  Check for unique service name of incoming event.
  (top): Register for signals with wildcard service name.
  (notifications-notify): Remember daemon unique service name.
modified:
  lisp/ChangeLog
  lisp/notifications.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-03-04 06:55:06 +0000
+++ b/lisp/ChangeLog    2012-03-04 11:21:31 +0000
@@ -1,3 +1,11 @@
+2012-03-04  Michael Albinus  <address@hidden>
+
+       * notifications.el (notifications-unique-name): New defvar.
+       (notifications-on-action-signal, notifications-on-closed-signal):
+       Check for unique service name of incoming event.
+       (top): Register for signals with wildcard service name.
+       (notifications-notify): Remember daemon unique service name.
+
 2012-03-04  Chong Yidong  <address@hidden>
 
        * cus-start.el: Make x-select-enable-clipboard-manager

=== modified file 'lisp/notifications.el'
--- a/lisp/notifications.el     2012-02-07 09:06:19 +0000
+++ b/lisp/notifications.el     2012-03-04 11:21:31 +0000
@@ -91,17 +91,24 @@
 (defvar notifications-on-close-map nil
   "Mapping between notification and close callback functions.")
 
+(defvar notifications-unique-name ""
+  "Unique service name of notification daemon.
+This must be kept, because the notification daemon could be
+restarted, and the registered signals cannot be identified anymore.")
+
 (defun notifications-on-action-signal (id action)
   "Dispatch signals to callback functions from `notifications-on-action-map'."
   (let ((entry (assoc id notifications-on-action-map)))
-    (when entry
+    (when (and entry
+              (string-equal notifications-unique-name
+                            (dbus-event-service-name last-input-event)))
       (funcall (cadr entry) id action)
       (remove entry 'notifications-on-action-map))))
 
 (when (fboundp 'dbus-register-signal)
   (dbus-register-signal
    :session
-   notifications-service
+   nil
    notifications-path
    notifications-interface
    notifications-action-signal
@@ -113,7 +120,9 @@
   ;; make it optional, and assume `undefined' as default.
   (let ((entry (assoc id notifications-on-close-map))
        (reason (or reason 4)))
-    (when entry
+    (when (and entry
+              (string-equal notifications-unique-name
+                            (dbus-event-service-name last-input-event)))
       (funcall (cadr entry)
               id (cadr (assoc reason notifications-closed-reason)))
       (remove entry 'notifications-on-close-map))))
@@ -121,7 +130,7 @@
 (when (fboundp 'dbus-register-signal)
   (dbus-register-signal
    :session
-   notifications-service
+   nil
    notifications-path
    notifications-interface
    notifications-closed-signal
@@ -277,6 +286,10 @@
                             (or hints '(:array :signature "{sv}"))
                             :int32 (or timeout -1)))
 
+    ;; Remember daemon unique service name.
+    (setq notifications-unique-name
+         (dbus-get-name-owner :session notifications-service))
+
     ;; Register close/action callback function
     (let ((on-action (plist-get params :on-action))
           (on-close (plist-get params :on-close)))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]