* [PATCH] notifications: only register signals if possible
@ 2010-09-25 20:15 Julien Danjou
2010-09-25 21:58 ` Glenn Morris
0 siblings, 1 reply; 2+ messages in thread
From: Julien Danjou @ 2010-09-25 20:15 UTC (permalink / raw)
To: emacs-devel; +Cc: Julien Danjou
That avoids error when (require 'notifications) is called on system
without D-Bus.
Signed-off-by: Julien Danjou <julien@danjou.info>
---
lisp/ChangeLog | 5 +++++
lisp/notifications.el | 30 ++++++++++++++++--------------
2 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c8011ac..bfbb0de 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-25 Julien Danjou <julien@danjou.info>
+
+ * notifications.el: Call dbus-register-signal only if the function
+ is bound.
+
2010-09-25 Juanma Barranquero <lekktu@gmail.com>
* server.el (server-start): Revert part of 2010-08-08 change. Using
diff --git a/lisp/notifications.el b/lisp/notifications.el
index 68db58e..dc4904d 100644
--- a/lisp/notifications.el
+++ b/lisp/notifications.el
@@ -95,13 +95,14 @@
(funcall (cadr entry) id action)
(remove entry 'notifications-on-action-map))))
-(dbus-register-signal
- :session
- notifications-service
- notifications-path
- notifications-interface
- notifications-action-signal
- 'notifications-on-action-signal)
+(when (fboundp 'dbus-register-signal)
+ (dbus-register-signal
+ :session
+ notifications-service
+ notifications-path
+ notifications-interface
+ notifications-action-signal
+ 'notifications-on-action-signal))
(defun notifications-on-closed-signal (id reason)
"Dispatch signals to callback functions from `notifications-on-closed-map'."
@@ -111,13 +112,14 @@
id (cadr (assoc reason notifications-closed-reason)))
(remove entry 'notifications-on-close-map))))
-(dbus-register-signal
- :session
- notifications-service
- notifications-path
- notifications-interface
- notifications-closed-signal
- 'notifications-on-closed-signal)
+(when (fboundp 'dbus-register-signal)
+ (dbus-register-signal
+ :session
+ notifications-service
+ 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 protocol.
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] notifications: only register signals if possible
2010-09-25 20:15 [PATCH] notifications: only register signals if possible Julien Danjou
@ 2010-09-25 21:58 ` Glenn Morris
0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2010-09-25 21:58 UTC (permalink / raw)
To: Julien Danjou; +Cc: emacs-devel
Thanks; mindlessly applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-09-25 21:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-25 20:15 [PATCH] notifications: only register signals if possible Julien Danjou
2010-09-25 21:58 ` Glenn Morris
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).