mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 10:27:41 +00:00
* net/secrets.el (secrets-enabled): New variable. Use it instead
of a subfeature.
This commit is contained in:
parent
7c75524e72
commit
ae84eb9775
2 changed files with 36 additions and 31 deletions
|
|
@ -1,3 +1,8 @@
|
|||
2010-03-16 Michael Albinus <michael.albinus@gmx.de>
|
||||
|
||||
* net/secrets.el (secrets-enabled): New variable. Use it instead
|
||||
of a subfeature.
|
||||
|
||||
2010-03-15 Michael Albinus <michael.albinus@gmx.de>
|
||||
|
||||
* net/secrets.el (top): Register the D-Bus signals only when the
|
||||
|
|
|
|||
|
|
@ -34,11 +34,9 @@
|
|||
;; into your .emacs:
|
||||
;;
|
||||
;; (require 'secrets)
|
||||
|
||||
;; It can be checked afterwards, whether there is a daemon providing
|
||||
;; this interface:
|
||||
;;
|
||||
;; (featurep 'secrets 'enabled)
|
||||
;; Afterwards, the variable `secrets-enabled' is non-nil when there is
|
||||
;; a daemon providing this interface.
|
||||
|
||||
;; The atomic objects to be managed by the Secret Service API are
|
||||
;; secret items, which are something an application wishes to store
|
||||
|
|
@ -150,6 +148,9 @@
|
|||
|
||||
(require 'dbus)
|
||||
|
||||
(defvar secrets-enabled nil
|
||||
"Whether there is a daemon offering the Secret Service API."
|
||||
|
||||
(defvar secrets-debug t
|
||||
"Write debug messages")
|
||||
|
||||
|
|
@ -664,38 +665,37 @@ If there is no such item, or the item doesn't own this attribute, return nil."
|
|||
:session secrets-service item-path
|
||||
secrets-interface-item "Delete")))))
|
||||
|
||||
(if (dbus-ping :session secrets-service 100)
|
||||
(when (dbus-ping :session secrets-service 100)
|
||||
|
||||
(progn
|
||||
;; We must reset all variables, when there is a new instance of
|
||||
;; the "org.freedesktop.secrets" service.
|
||||
(dbus-register-signal
|
||||
:session dbus-service-dbus dbus-path-dbus
|
||||
dbus-interface-dbus "NameOwnerChanged"
|
||||
(lambda (&rest args)
|
||||
(when secrets-debug (message "Secret Service has changed: %S" args))
|
||||
(setq secrets-session-path secrets-empty-path
|
||||
secrets-prompt-signal nil
|
||||
secrets-collection-paths nil))
|
||||
secrets-service)
|
||||
;; We must reset all variables, when there is a new instance of the
|
||||
;; "org.freedesktop.secrets" service.
|
||||
(dbus-register-signal
|
||||
:session dbus-service-dbus dbus-path-dbus
|
||||
dbus-interface-dbus "NameOwnerChanged"
|
||||
(lambda (&rest args)
|
||||
(when secrets-debug (message "Secret Service has changed: %S" args))
|
||||
(setq secrets-session-path secrets-empty-path
|
||||
secrets-prompt-signal nil
|
||||
secrets-collection-paths nil))
|
||||
secrets-service)
|
||||
|
||||
;; We want to refresh our cache, when there is a change in
|
||||
;; collections.
|
||||
(dbus-register-signal
|
||||
:session secrets-service secrets-path
|
||||
secrets-interface-service "CollectionCreated"
|
||||
'secrets-collection-handler)
|
||||
;; We want to refresh our cache, when there is a change in
|
||||
;; collections.
|
||||
(dbus-register-signal
|
||||
:session secrets-service secrets-path
|
||||
secrets-interface-service "CollectionCreated"
|
||||
'secrets-collection-handler)
|
||||
|
||||
(dbus-register-signal
|
||||
:session secrets-service secrets-path
|
||||
secrets-interface-service "CollectionDeleted"
|
||||
'secrets-collection-handler)
|
||||
(dbus-register-signal
|
||||
:session secrets-service secrets-path
|
||||
secrets-interface-service "CollectionDeleted"
|
||||
'secrets-collection-handler)
|
||||
|
||||
;; We shall inform, whether the secret service is enabled on
|
||||
;; this machine.
|
||||
(provide 'secrets '(enabled)))
|
||||
;; We shall inform, whether the secret service is enabled on this
|
||||
;; machine.
|
||||
(setq secrets-enabled t)))
|
||||
|
||||
(provide 'secrets))
|
||||
(provide 'secrets)
|
||||
|
||||
;;; TODO:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue