emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/doc/misc/dbus.texi,v


From: Michael Albinus
Subject: [Emacs-diffs] Changes to emacs/doc/misc/dbus.texi,v
Date: Sun, 03 Aug 2008 17:14:15 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Michael Albinus <albinus>       08/08/03 17:14:15

Index: dbus.texi
===================================================================
RCS file: /sources/emacs/emacs/doc/misc/dbus.texi,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- dbus.texi   31 Jul 2008 18:49:25 -0000      1.22
+++ dbus.texi   3 Aug 2008 17:14:14 -0000       1.23
@@ -1219,9 +1219,9 @@
   "org.freedesktop.TextEditor" "OpenFile"
   'my-dbus-method-handler)
 
address@hidden ((:system "org.freedesktop.TextEditor" "OpenFile")
address@hidden ((:session "org.freedesktop.TextEditor" "OpenFile")
     ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"
-     my-method-handler))
+     my-dbus-method-handler))
 @end lisp
 
 If you invoke the method @samp{org.freedesktop.TextEditor.OpenFile}
@@ -1239,6 +1239,34 @@
 @print{} method return sender=:1.22 -> dest=:1.23 reply_serial=2
      boolean true
 @end example
+
+You can indicate an error by raising the Emacs signal
address@hidden  The handler above could be changed like this:
+
address@hidden
+(defun my-dbus-method-handler (&rest args)
+  (unless (and (= (length args) 1) (stringp (car args)))
+    (signal 'dbus-error (list (format "Wrong argument list: %S" args))))
+  (condition-case err
+      (find-file (car args))
+    (error (signal 'dbus-error (cdr err))))
+  t)
+
address@hidden my-dbus-method-handler
address@hidden lisp
+
+The test runs then
+
address@hidden
+# dbus-send --session --print-reply \
+    --dest="org.freedesktop.TextEditor" \
+    "/org/freedesktop/TextEditor" \
+    "org.freedesktop.TextEditor.OpenFile" \
+    string:"/etc/hosts" string:"/etc/passwd"
+
address@hidden Error org.freedesktop.DBus.Error.Failed:
+   Wrong argument list: ("/etc/hosts" "/etc/passwd")
address@hidden example
 @end defun
 
 




reply via email to

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