Mercurial > emacs
annotate lisp/net/dbus.el @ 91472:93fcec3a4fd7
(charprop-CMD): Chdir in Emacs rather than in Makefile.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 02 Feb 2008 17:55:39 +0000 |
parents | b560a1744534 |
children | 7ddf7059d131 |
rev | line source |
---|---|
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1 ;;; -*- no-byte-compile: t; -*- |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2 ;;; dbus.el --- Elisp bindings for D-Bus. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3 |
87537
84ece2f8e012
* net/dbus.el (dbus-name-owner-changed-handler): Use
Magnus Henoch <mange@freemail.hu>
parents:
87492
diff
changeset
|
4 ;; Copyright (C) 2007, 2008 Free Software Foundation, Inc. |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
6 ;; Author: Michael Albinus <michael.albinus@gmx.de> |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
7 ;; Keywords: comm, hardware |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
8 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
10 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software; you can redistribute it and/or modify |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
13 ;; the Free Software Foundation; either version 3, or (at your option) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
14 ;; any later version. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
15 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
20 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
22 ;; along with GNU Emacs; see the file COPYING. If not, see |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
23 ;; <http://www.gnu.org/licenses/>. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
24 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
25 ;;; Commentary: |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
26 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
27 ;; This package provides language bindings for the D-Bus API. D-Bus |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
28 ;; is a message bus system, a simple way for applications to talk to |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
29 ;; one another. See <http://dbus.freedesktop.org/> for details. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
30 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
31 ;; Low-level language bindings are implemented in src/dbusbind.c. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
32 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
33 ;;; Code: |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
34 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
35 (require 'xml) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
36 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
37 (defconst dbus-service-dbus "org.freedesktop.DBus" |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
38 "The bus name used to talk to the bus itself.") |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
39 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
40 (defconst dbus-path-dbus "/org/freedesktop/DBus" |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
41 "The object path used to talk to the bus itself.") |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
42 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
43 (defconst dbus-interface-dbus "org.freedesktop.DBus" |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
44 "The interface exported by the object with `dbus-service-dbus' and `dbus-path-dbus'.") |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
45 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
46 (defconst dbus-interface-introspectable "org.freedesktop.DBus.Introspectable" |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
47 "The interface supported by introspectable objects.") |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
48 |
87885
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
49 (defmacro dbus-ignore-errors (&rest body) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
50 "Execute BODY; signal D-Bus error when `dbus-debug' is non-nil. |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
51 Otherwise, return result of last form in BODY, or all other errors." |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
52 `(condition-case err |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
53 (progn ,@body) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
54 (dbus-error (when dbus-debug (signal (car err) (cdr err)))))) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
55 |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
56 (put 'dbus-ignore-errors 'lisp-indent-function 0) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
57 (put 'dbus-ignore-errors 'edebug-form-spec '(form symbolp body)) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
58 (font-lock-add-keywords 'emacs-lisp-mode '("\\<dbus-ignore-errors\\>")) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
59 |
87050
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
60 |
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
61 ;;; Hash table of registered functions. |
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
62 |
87176
d5feab53f4f8
* net/dbus.el (dbus-hash-table=): Remove function. We cannot
Michael Albinus <michael.albinus@gmx.de>
parents:
87159
diff
changeset
|
63 ;; We create it here. So we have a simple test in dbusbind.c, whether |
d5feab53f4f8
* net/dbus.el (dbus-hash-table=): Remove function. We cannot
Michael Albinus <michael.albinus@gmx.de>
parents:
87159
diff
changeset
|
64 ;; the Lisp code has been loaded. |
d5feab53f4f8
* net/dbus.el (dbus-hash-table=): Remove function. We cannot
Michael Albinus <michael.albinus@gmx.de>
parents:
87159
diff
changeset
|
65 (setq dbus-registered-functions-table (make-hash-table :test 'equal)) |
87050
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
66 |
87159
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
67 (defun dbus-list-hash-table () |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
68 "Returns all registered member registrations to D-Bus. |
87159
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
69 The return value is a list, with elements of kind (KEY . VALUE). |
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
70 See `dbus-registered-functions-table' for a description of the |
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
71 hash table." |
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
72 (let (result) |
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
73 (maphash |
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
74 '(lambda (key value) (add-to-list 'result (cons key value) 'append)) |
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
75 dbus-registered-functions-table) |
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
76 result)) |
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
77 |
87885
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
78 (defun dbus-unregister-object (object) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
79 "Unregister OBJECT from D-Bus. |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
80 OBJECT must be the result of a preceding `dbus-register-method' |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
81 or `dbus-register-signal' call. It returns t if OBJECT has been |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
82 unregistered, nil otherwise." |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
83 ;; Check parameter. |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
84 (unless (and (consp object) (not (null (car object))) (consp (cdr object))) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
85 (signal 'wrong-type-argument (list 'D-Bus object))) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
86 |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
87 ;; Find the corresponding entry in the hash table. |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
88 (let* ((key (car object)) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
89 (value (gethash key dbus-registered-functions-table))) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
90 ;; Loop over the registered functions. |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
91 (while (consp value) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
92 ;; (car value) has the structure (UNAME SERVICE PATH HANDLER). |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
93 ;; (cdr object) has the structure ((SERVICE PATH HANDLER) ...). |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
94 (if (not (equal (cdr (car value)) (car (cdr object)))) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
95 (setq value (cdr value)) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
96 ;; Compute new hash value. If it is empty, remove it from |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
97 ;; hash table. |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
98 (unless |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
99 (puthash |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
100 key |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
101 (delete (car value) (gethash key dbus-registered-functions-table)) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
102 dbus-registered-functions-table) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
103 (remhash key dbus-registered-functions-table)) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
104 (setq value t))) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
105 value)) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
106 |
87492
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
107 (defun dbus-name-owner-changed-handler (&rest args) |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
108 "Reapplies all member registrations to D-Bus. |
87159
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
109 This handler is applied when a \"NameOwnerChanged\" signal has |
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
110 arrived. SERVICE is the object name for which the name owner has |
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
111 been changed. OLD-OWNER is the previous owner of SERVICE, or the |
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
112 empty string if SERVICE was not owned yet. NEW-OWNER is the new |
87492
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
113 owner of SERVICE, or the empty string if SERVICE looses any name owner. |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
114 |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
115 usage: (dbus-name-owner-changed-handler service old-owner new-owner)" |
87159
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
116 (save-match-data |
87492
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
117 ;; Check the arguments. We should silently ignore it when they |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
118 ;; are wrong. |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
119 (if (and (= (length args) 3) |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
120 (stringp (car args)) |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
121 (stringp (cadr args)) |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
122 (stringp (caddr args))) |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
123 (let ((service (car args)) |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
124 (old-owner (cadr args)) |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
125 (new-owner (caddr args))) |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
126 ;; Check whether SERVICE is a known name. |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
127 (when (not (string-match "^:" service)) |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
128 (maphash |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
129 '(lambda (key value) |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
130 (dolist (elt value) |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
131 ;; key has the structure (BUS INTERFACE MEMBER). |
87492
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
132 ;; elt has the structure (UNAME SERVICE PATH HANDLER). |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
133 (when (string-equal old-owner (car elt)) |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
134 ;; Remove old key, and add new entry with changed name. |
87537
84ece2f8e012
* net/dbus.el (dbus-name-owner-changed-handler): Use
Magnus Henoch <mange@freemail.hu>
parents:
87492
diff
changeset
|
135 (dbus-unregister-object (list key (cdr elt))) |
87492
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
136 ;; Maybe we could arrange the lists a little bit better |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
137 ;; that we don't need to extract every single element? |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
138 (dbus-register-signal |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
139 ;; BUS SERVICE PATH |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
140 (nth 0 key) (nth 1 elt) (nth 2 elt) |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
141 ;; INTERFACE MEMBER HANDLER |
87492
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
142 (nth 1 key) (nth 2 key) (nth 3 elt))))) |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
143 (copy-hash-table dbus-registered-functions-table)))) |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
144 ;; The error is reported only in debug mode. |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
145 (when dbus-debug |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
146 (signal |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
147 'dbus-error |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
148 (cons |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
149 (format "Wrong arguments of %s.NameOwnerChanged" dbus-interface-dbus) |
bb538e56f976
* net/dbus.el (dbus-name-owner-changed-handler): Make the function
Michael Albinus <michael.albinus@gmx.de>
parents:
87308
diff
changeset
|
150 args)))))) |
87159
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
151 |
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
152 ;; Register the handler. |
87885
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
153 (dbus-ignore-errors |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
154 (dbus-register-signal |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
155 :system dbus-service-dbus dbus-path-dbus dbus-interface-dbus |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
156 "NameOwnerChanged" 'dbus-name-owner-changed-handler) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
157 (dbus-register-signal |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
158 :session dbus-service-dbus dbus-path-dbus dbus-interface-dbus |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
159 "NameOwnerChanged" 'dbus-name-owner-changed-handler)) |
87159
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
160 |
87050
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
161 |
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
162 ;;; D-Bus events. |
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
163 |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
164 (defun dbus-check-event (event) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
165 "Checks whether EVENT is a well formed D-Bus event. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
166 EVENT is a list which starts with symbol `dbus-event': |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
167 |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
168 (dbus-event BUS SERIAL SERVICE PATH INTERFACE MEMBER HANDLER &rest ARGS) |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
169 |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
170 BUS identifies the D-Bus the message is coming from. It is |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
171 either the symbol `:system' or the symbol `:session'. SERIAL is |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
172 the serial number of the received D-Bus message if it is a method |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
173 call, or nil. SERVICE and PATH are the unique name and the |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
174 object path of the D-Bus object emitting the message. INTERFACE |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
175 and MEMBER denote the message which has been sent. HANDLER is |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
176 the function which has been registered for this message. ARGS |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
177 are the arguments passed to HANDLER, when it is called during |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
178 event handling in `dbus-handle-event'. |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
179 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
180 This function raises a `dbus-error' signal in case the event is |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
181 not well formed." |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
182 (when dbus-debug (message "DBus-Event %s" event)) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
183 (unless (and (listp event) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
184 (eq (car event) 'dbus-event) |
87050
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
185 ;; Bus symbol. |
87159
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
186 (symbolp (nth 1 event)) |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
187 ;; Serial. |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
188 (or (natnump (nth 2 event)) (null (nth 2 event))) |
87050
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
189 ;; Service. |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
190 (stringp (nth 3 event)) |
87159
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
191 ;; Object path. |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
192 (stringp (nth 4 event)) |
87159
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
193 ;; Interface. |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
194 (stringp (nth 5 event)) |
87159
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
195 ;; Member. |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
196 (stringp (nth 6 event)) |
87159
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
197 ;; Handler. |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
198 (functionp (nth 7 event))) |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
199 (signal 'dbus-error (list "Not a valid D-Bus event" event)))) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
200 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
201 ;;;###autoload |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
202 (defun dbus-handle-event (event) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
203 "Handle events from the D-Bus. |
87050
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
204 EVENT is a D-Bus event, see `dbus-check-event'. HANDLER, being |
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
205 part of the event, is called with arguments ARGS." |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
206 (interactive "e") |
87050
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
207 ;; We don't want to raise an error, because this function is called |
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
208 ;; in the event handling loop. |
87885
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
209 (dbus-ignore-errors |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
210 (let (result) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
211 (dbus-check-event event) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
212 (setq result (apply (nth 7 event) (nthcdr 8 event))) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
213 (unless (consp result) (setq result (cons result nil))) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
214 ;; Return a message when serial is not nil. |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
215 (when (not (null (nth 2 event))) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
216 (apply 'dbus-method-return-internal |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
217 (nth 1 event) (nth 2 event) (nth 3 event) result))))) |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
218 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
219 (defun dbus-event-bus-name (event) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
220 "Return the bus name the event is coming from. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
221 The result is either the symbol `:system' or the symbol `:session'. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
222 EVENT is a D-Bus event, see `dbus-check-event'. This function |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
223 raises a `dbus-error' signal in case the event is not well |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
224 formed." |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
225 (dbus-check-event event) |
87159
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
226 (nth 1 event)) |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
227 |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
228 (defun dbus-event-serial-number (event) |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
229 "Return the serial number of the corresponding D-Bus message. |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
230 The result is a number in case the D-Bus message is a method |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
231 call, or nil for all other mesage types. The serial number is |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
232 needed for generating a reply message. EVENT is a D-Bus event, |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
233 see `dbus-check-event'. This function raises a `dbus-error' |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
234 signal in case the event is not well formed." |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
235 (dbus-check-event event) |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
236 (nth 2 event)) |
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
237 |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
238 (defun dbus-event-service-name (event) |
87050
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
239 "Return the name of the D-Bus object the event is coming from. |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
240 The result is a string. EVENT is a D-Bus event, see `dbus-check-event'. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
241 This function raises a `dbus-error' signal in case the event is |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
242 not well formed." |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
243 (dbus-check-event event) |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
244 (nth 3 event)) |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
245 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
246 (defun dbus-event-path-name (event) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
247 "Return the object path of the D-Bus object the event is coming from. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
248 The result is a string. EVENT is a D-Bus event, see `dbus-check-event'. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
249 This function raises a `dbus-error' signal in case the event is |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
250 not well formed." |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
251 (dbus-check-event event) |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
252 (nth 4 event)) |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
253 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
254 (defun dbus-event-interface-name (event) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
255 "Return the interface name of the D-Bus object the event is coming from. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
256 The result is a string. EVENT is a D-Bus event, see `dbus-check-event'. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
257 This function raises a `dbus-error' signal in case the event is |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
258 not well formed." |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
259 (dbus-check-event event) |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
260 (nth 5 event)) |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
261 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
262 (defun dbus-event-member-name (event) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
263 "Return the member name the event is coming from. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
264 It is either a signal name or a method name. The result is is a |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
265 string. EVENT is a D-Bus event, see `dbus-check-event'. This |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
266 function raises a `dbus-error' signal in case the event is not |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
267 well formed." |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
268 (dbus-check-event event) |
87586
9554989ee375
* net/dbus.el (dbus-list-hash-table)
Michael Albinus <michael.albinus@gmx.de>
parents:
87537
diff
changeset
|
269 (nth 6 event)) |
87050
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
270 |
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
271 |
7d80e0f3d8f8
* net/dbus.el (dbus-hash-table=): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
86941
diff
changeset
|
272 ;;; D-Bus registered names. |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
273 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
274 (defun dbus-list-activatable-names () |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
275 "Return the D-Bus service names which can be activated as list. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
276 The result is a list of strings, which is nil when there are no |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
277 activatable service names at all." |
87885
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
278 (dbus-ignore-errors |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
279 (dbus-call-method |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
280 :system dbus-service-dbus |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
281 dbus-path-dbus dbus-interface-dbus "ListActivatableNames"))) |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
282 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
283 (defun dbus-list-names (bus) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
284 "Return the service names registered at D-Bus BUS. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
285 The result is a list of strings, which is nil when there are no |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
286 registered service names at all. Well known names are strings like |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
287 \"org.freedesktop.DBus\". Names starting with \":\" are unique names |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
288 for services." |
87885
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
289 (dbus-ignore-errors |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
290 (dbus-call-method |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
291 bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus "ListNames"))) |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
292 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
293 (defun dbus-list-known-names (bus) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
294 "Retrieve all services which correspond to a known name in BUS. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
295 A service has a known name if it doesn't start with \":\"." |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
296 (let (result) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
297 (dolist (name (dbus-list-names bus) result) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
298 (unless (string-equal ":" (substring name 0 1)) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
299 (add-to-list 'result name 'append))))) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
300 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
301 (defun dbus-list-queued-owners (bus service) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
302 "Return the unique names registered at D-Bus BUS and queued for SERVICE. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
303 The result is a list of strings, or nil when there are no queued name |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
304 owners service names at all." |
87885
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
305 (dbus-ignore-errors |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
306 (dbus-call-method |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
307 bus dbus-service-dbus dbus-path-dbus |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
308 dbus-interface-dbus "ListQueuedOwners" service))) |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
309 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
310 (defun dbus-get-name-owner (bus service) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
311 "Return the name owner of SERVICE registered at D-Bus BUS. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
312 The result is either a string, or nil if there is no name owner." |
87885
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
313 (dbus-ignore-errors |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
314 (dbus-call-method |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
315 bus dbus-service-dbus dbus-path-dbus |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
316 dbus-interface-dbus "GetNameOwner" service))) |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
317 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
318 (defun dbus-introspect (bus service path) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
319 "Return the introspection data of SERVICE in D-Bus BUS at object path PATH. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
320 The data are in XML format. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
321 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
322 Example: |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
323 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
324 \(dbus-introspect |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
325 :system \"org.freedesktop.Hal\" |
87159
bcf59f3d73d7
* net/dbus.el (dbus-hash-table=): Fix for new hash table key
Michael Albinus <michael.albinus@gmx.de>
parents:
87093
diff
changeset
|
326 \"/org/freedesktop/Hal/devices/computer\")" |
87885
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
327 (dbus-ignore-errors |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
328 (dbus-call-method |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
329 bus service path dbus-interface-introspectable "Introspect"))) |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
330 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
331 (if nil ;; Must be reworked. Shall we offer D-Bus signatures at all? |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
332 (defun dbus-get-signatures (bus interface signal) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
333 "Retrieve SIGNAL's type signatures from D-Bus. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
334 The result is a list of SIGNAL's type signatures. Example: |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
335 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
336 \(\"s\" \"b\" \"ai\"\) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
337 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
338 This list represents 3 parameters of SIGNAL. The first parameter |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
339 is of type string, the second parameter is of type boolean, and |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
340 the third parameter is of type array of integer. |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
341 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
342 If INTERFACE or SIGNAL do not exist, or if they do not support |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
343 the D-Bus method org.freedesktop.DBus.Introspectable.Introspect, |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
344 the function returns nil." |
87885
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
345 (dbus-ignore-errors |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
346 (let ((introspect-xml |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
347 (with-temp-buffer |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
348 (insert (dbus-introspect bus interface)) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
349 (xml-parse-region (point-min) (point-max)))) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
350 node interfaces signals args result) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
351 ;; Get the root node. |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
352 (setq node (xml-node-name introspect-xml)) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
353 ;; Get all interfaces. |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
354 (setq interfaces (xml-get-children node 'interface)) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
355 (while interfaces |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
356 (when (string-equal (xml-get-attribute (car interfaces) 'name) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
357 interface) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
358 ;; That's the requested interface. Check for signals. |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
359 (setq signals (xml-get-children (car interfaces) 'signal)) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
360 (while signals |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
361 (when (string-equal (xml-get-attribute (car signals) 'name) signal) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
362 ;; The signal we are looking for. |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
363 (setq args (xml-get-children (car signals) 'arg)) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
364 (while args |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
365 (unless (xml-get-attribute (car args) 'type) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
366 ;; This shouldn't happen, let's escape. |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
367 (signal 'dbus-error nil)) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
368 ;; We append the signature. |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
369 (setq |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
370 result (append result |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
371 (list (xml-get-attribute (car args) 'type)))) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
372 (setq args (cdr args))) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
373 (setq signals nil)) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
374 (setq signals (cdr signals))) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
375 (setq interfaces nil)) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
376 (setq interfaces (cdr interfaces))) |
b560a1744534
* net/dbus.el (dbus-ignore-errors): New macro.
Michael Albinus <michael.albinus@gmx.de>
parents:
87586
diff
changeset
|
377 result))) |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
378 ) ;; (if nil ... |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
379 |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
380 (provide 'dbus) |
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
381 |
87053 | 382 ;; arch-tag: a47caf84-9162-4811-90cc-5d388e37b9bd |
86941
cbc23e728425
* net/dbus.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
383 ;;; dbus.el ends here |