Function: dbus-unregister-service
dbus-unregister-service is a byte-compiled function defined in
dbus.el.gz.
Signature
(dbus-unregister-service BUS SERVICE)
Documentation
Unregister all objects related to SERVICE from D-Bus BUS.
BUS is either a Lisp keyword, :system or :session, or a string denoting the bus address. SERVICE must be a known service name.
The function returns a keyword, indicating the result of the operation. One of the following keywords is returned:
:released: We successfully released the service.
:non-existent: Service name does not exist on this bus.
:not-owner: We are neither the primary owner nor waiting in the
queue of this service.
When SERVICE is not a known name but a unique name, the function returns nil.
Source Code
;; Defined in /usr/src/emacs/lisp/net/dbus.el.gz
(defun dbus-unregister-service (bus service)
"Unregister all objects related to SERVICE from D-Bus BUS.
BUS is either a Lisp keyword, `:system' or `:session', or a
string denoting the bus address. SERVICE must be a known service
name.
The function returns a keyword, indicating the result of the
operation. One of the following keywords is returned:
`:released': We successfully released the service.
`:non-existent': Service name does not exist on this bus.
`:not-owner': We are neither the primary owner nor waiting in the
queue of this service.
When SERVICE is not a known name but a unique name, the function returns nil."
(maphash
(lambda (key value)
(unless (eq :serial (car key))
(dolist (elt value)
(ignore-errors
(when (and (equal bus (cadr key)) (string-equal service (cadr elt)))
(unless
(puthash key (delete elt value) dbus-registered-objects-table)
(remhash key dbus-registered-objects-table)))))))
dbus-registered-objects-table)
(unless (string-prefix-p ":" service)
(let ((reply (dbus-call-method
bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
"ReleaseName" service)))
(pcase reply
(1 :released)
(2 :non-existent)
(3 :not-owner)
(_ (signal
'dbus-error (list "Could not unregister service" service)))))))