diff options
| author | Michael Albinus | 2023-03-29 20:22:04 +0200 |
|---|---|---|
| committer | Michael Albinus | 2023-03-29 20:22:04 +0200 |
| commit | bfa3500c3c6e4df58978e84753718cd5358c06fb (patch) | |
| tree | 8a7de00cfd21ace85289a43b5a99087902eb3471 | |
| parent | e324060369f7b729ca66a45fd10f15e780f754ca (diff) | |
| download | emacs-bfa3500c3c6e4df58978e84753718cd5358c06fb.tar.gz emacs-bfa3500c3c6e4df58978e84753718cd5358c06fb.zip | |
Rework zeroconf integration into tramp-gvfs.el
* lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Do not check for
:system bus.
(tramp-gvfs-mounttypes): New defconst.
(tramp-gvfs-maybe-open-connection): Use it.
(top): Call zeroconf only when :system bus is available.
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 95 |
1 files changed, 49 insertions, 46 deletions
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index f925d2f3da5..d44fd55b225 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -119,8 +119,6 @@ | |||
| 119 | (defconst tramp-gvfs-enabled | 119 | (defconst tramp-gvfs-enabled |
| 120 | (ignore-errors | 120 | (ignore-errors |
| 121 | (and (featurep 'dbusbind) | 121 | (and (featurep 'dbusbind) |
| 122 | (autoload 'zeroconf-init "zeroconf") | ||
| 123 | (tramp-compat-funcall 'dbus-get-unique-name :system) | ||
| 124 | (tramp-compat-funcall 'dbus-get-unique-name :session) | 122 | (tramp-compat-funcall 'dbus-get-unique-name :session) |
| 125 | (or (tramp-process-running-p "gvfs-fuse-daemon") | 123 | (or (tramp-process-running-p "gvfs-fuse-daemon") |
| 126 | (tramp-process-running-p "gvfsd-fuse")))) | 124 | (tramp-process-running-p "gvfsd-fuse")))) |
| @@ -224,6 +222,13 @@ It has been changed in GVFS 1.14.") | |||
| 224 | "The name of the \"listMountTypes\" method. | 222 | "The name of the \"listMountTypes\" method. |
| 225 | It has been changed in GVFS 1.14.") | 223 | It has been changed in GVFS 1.14.") |
| 226 | 224 | ||
| 225 | (defconst tramp-gvfs-mounttypes | ||
| 226 | (and tramp-gvfs-enabled | ||
| 227 | (dbus-call-method | ||
| 228 | :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker | ||
| 229 | tramp-gvfs-interface-mounttracker tramp-gvfs-listmounttypes)) | ||
| 230 | "The list of supported mount types of the mount tracking interface.") | ||
| 231 | |||
| 227 | (defconst tramp-gvfs-listmounts | 232 | (defconst tramp-gvfs-listmounts |
| 228 | (if (member "ListMounts" tramp-gvfs-methods-mounttracker) | 233 | (if (member "ListMounts" tramp-gvfs-methods-mounttracker) |
| 229 | "ListMounts" | 234 | "ListMounts" |
| @@ -2188,11 +2193,7 @@ connection if a previous connection has died for some reason." | |||
| 2188 | ("afp". "afp-volume") | 2193 | ("afp". "afp-volume") |
| 2189 | ("gdrive" . "google-drive"))) | 2194 | ("gdrive" . "google-drive"))) |
| 2190 | method) | 2195 | method) |
| 2191 | (with-tramp-dbus-call-method vec t | 2196 | tramp-gvfs-mounttypes) |
| 2192 | :session tramp-gvfs-service-daemon | ||
| 2193 | tramp-gvfs-path-mounttracker | ||
| 2194 | tramp-gvfs-interface-mounttracker | ||
| 2195 | tramp-gvfs-listmounttypes)) | ||
| 2196 | (tramp-error vec 'file-error "Method `%s' not supported by GVFS" method))) | 2197 | (tramp-error vec 'file-error "Method `%s' not supported by GVFS" method))) |
| 2197 | 2198 | ||
| 2198 | ;; For password handling, we need a process bound to the connection | 2199 | ;; For password handling, we need a process bound to the connection |
| @@ -2538,43 +2539,45 @@ This uses \"avahi-browse\" in case D-Bus is not enabled in Avahi." | |||
| 2538 | ;; Suppress D-Bus error messages and Tramp traces. | 2539 | ;; Suppress D-Bus error messages and Tramp traces. |
| 2539 | (let ((tramp-verbose 0) | 2540 | (let ((tramp-verbose 0) |
| 2540 | tramp-gvfs-dbus-event-vector fun) | 2541 | tramp-gvfs-dbus-event-vector fun) |
| 2541 | ;; Add completion functions for services announced by DNS-SD. | 2542 | (when (and (autoload 'zeroconf-init "zeroconf") |
| 2542 | ;; See <http://www.dns-sd.org/ServiceTypes.html> for valid service types. | 2543 | (tramp-compat-funcall 'dbus-get-unique-name :system)) |
| 2543 | (zeroconf-init tramp-gvfs-zeroconf-domain) | 2544 | ;; Add completion functions for services announced by DNS-SD. |
| 2544 | (when (setq fun (or (and (zeroconf-list-service-types) | 2545 | ;; See <http://www.dns-sd.org/ServiceTypes.html> for valid service types. |
| 2545 | #'tramp-zeroconf-parse-device-names) | 2546 | (zeroconf-init tramp-gvfs-zeroconf-domain) |
| 2546 | (and (executable-find "avahi-browse") | 2547 | (when (setq fun (or (and (zeroconf-list-service-types) |
| 2547 | #'tramp-gvfs-parse-device-names))) | 2548 | #'tramp-zeroconf-parse-device-names) |
| 2548 | (when (member "afp" tramp-gvfs-methods) | 2549 | (and (executable-find "avahi-browse") |
| 2549 | (tramp-set-completion-function | 2550 | #'tramp-gvfs-parse-device-names))) |
| 2550 | "afp" `((,fun "_afpovertcp._tcp")))) | 2551 | (when (member "afp" tramp-gvfs-methods) |
| 2551 | (when (member "dav" tramp-gvfs-methods) | 2552 | (tramp-set-completion-function |
| 2552 | (tramp-set-completion-function | 2553 | "afp" `((,fun "_afpovertcp._tcp")))) |
| 2553 | "dav" `((,fun "_webdav._tcp") | 2554 | (when (member "dav" tramp-gvfs-methods) |
| 2554 | (,fun "_webdavs._tcp")))) | 2555 | (tramp-set-completion-function |
| 2555 | (when (member "davs" tramp-gvfs-methods) | 2556 | "dav" `((,fun "_webdav._tcp") |
| 2556 | (tramp-set-completion-function | 2557 | (,fun "_webdavs._tcp")))) |
| 2557 | "davs" `((,fun "_webdav._tcp") | 2558 | (when (member "davs" tramp-gvfs-methods) |
| 2558 | (,fun "_webdavs._tcp")))) | 2559 | (tramp-set-completion-function |
| 2559 | (when (member "ftp" tramp-gvfs-methods) | 2560 | "davs" `((,fun "_webdav._tcp") |
| 2560 | (tramp-set-completion-function | 2561 | (,fun "_webdavs._tcp")))) |
| 2561 | "ftp" `((,fun "_ftp._tcp")))) | 2562 | (when (member "ftp" tramp-gvfs-methods) |
| 2562 | (when (member "http" tramp-gvfs-methods) | 2563 | (tramp-set-completion-function |
| 2563 | (tramp-set-completion-function | 2564 | "ftp" `((,fun "_ftp._tcp")))) |
| 2564 | "http" `((,fun "_http._tcp") | 2565 | (when (member "http" tramp-gvfs-methods) |
| 2565 | (,fun "_https._tcp")))) | 2566 | (tramp-set-completion-function |
| 2566 | (when (member "https" tramp-gvfs-methods) | 2567 | "http" `((,fun "_http._tcp") |
| 2567 | (tramp-set-completion-function | 2568 | (,fun "_https._tcp")))) |
| 2568 | "https" `((,fun "_http._tcp") | 2569 | (when (member "https" tramp-gvfs-methods) |
| 2569 | (,fun "_https._tcp")))) | 2570 | (tramp-set-completion-function |
| 2570 | (when (member "sftp" tramp-gvfs-methods) | 2571 | "https" `((,fun "_http._tcp") |
| 2571 | (tramp-set-completion-function | 2572 | (,fun "_https._tcp")))) |
| 2572 | "sftp" `((,fun "_sftp-ssh._tcp") | 2573 | (when (member "sftp" tramp-gvfs-methods) |
| 2573 | (,fun "_ssh._tcp") | 2574 | (tramp-set-completion-function |
| 2574 | (,fun "_workstation._tcp")))) | 2575 | "sftp" `((,fun "_sftp-ssh._tcp") |
| 2575 | (when (member "smb" tramp-gvfs-methods) | 2576 | (,fun "_ssh._tcp") |
| 2576 | (tramp-set-completion-function | 2577 | (,fun "_workstation._tcp")))) |
| 2577 | "smb" `((,fun "_smb._tcp"))))) | 2578 | (when (member "smb" tramp-gvfs-methods) |
| 2579 | (tramp-set-completion-function | ||
| 2580 | "smb" `((,fun "_smb._tcp")))))) | ||
| 2578 | 2581 | ||
| 2579 | ;; Add completion functions for GNOME Online Accounts. | 2582 | ;; Add completion functions for GNOME Online Accounts. |
| 2580 | (tramp-get-goa-accounts nil) | 2583 | (tramp-get-goa-accounts nil) |
| @@ -2604,9 +2607,9 @@ This uses \"avahi-browse\" in case D-Bus is not enabled in Avahi." | |||
| 2604 | ;; * Host name completion for existing mount points (afp-server, | 2607 | ;; * Host name completion for existing mount points (afp-server, |
| 2605 | ;; smb-server) or via smb-network or network. | 2608 | ;; smb-server) or via smb-network or network. |
| 2606 | ;; | 2609 | ;; |
| 2610 | ;; * What's up with the other types in `tramp-gvfs-mounttypes'? | ||
| 2611 | ;; | ||
| 2607 | ;; * Check, how two shares of the same SMB server can be mounted in | 2612 | ;; * Check, how two shares of the same SMB server can be mounted in |
| 2608 | ;; parallel. | 2613 | ;; parallel. |
| 2609 | ;; | ||
| 2610 | ;; * What's up with ftps dns-sd afc admin computer? | ||
| 2611 | 2614 | ||
| 2612 | ;;; tramp-gvfs.el ends here | 2615 | ;;; tramp-gvfs.el ends here |