;; In order to activate this package, you must add the following code
;; into your .emacs:
-
+;;
;; (require 'secrets)
+;; It can be checked afterwards, whether there is a daemon providing
+;; this interface:
+;;
+;; (featurep 'secrets 'enabled)
+
;; The atomic objects to be managed by the Secret Service API are
;; secret items, which are something an application wishes to store
;; securely. A good example is a password that an application needs
(setq secrets-collection-paths
(delete (car args) secrets-collection-paths)))))
-(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)
-
(defun secrets-get-collections ()
"Return the object paths of all available collections."
(setq secrets-collection-paths
:session secrets-service item-path
secrets-interface-item "Delete")))))
-;; We must reset all variables, when there is a new instance of the
-;; "org.freedesktop.secrets" service.
+(if (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 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 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 shall inform, whether the secret service is enabled on
+ ;; this machine.
+ (provide 'secrets '(enabled)))
-(provide 'secrets)
+ (provide 'secrets))
;;; TODO: