Function: tramp-gvfs-handler-askquestion

tramp-gvfs-handler-askquestion is a byte-compiled function defined in tramp-gvfs.el.gz.

Signature

(tramp-gvfs-handler-askquestion MESSAGE CHOICES)

Documentation

Implementation for the "org.gtk.vfs.MountOperation.askQuestion" method.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-gvfs.el.gz
(defun tramp-gvfs-handler-askquestion (message choices)
  "Implementation for the \"org.gtk.vfs.MountOperation.askQuestion\" method."
  (save-window-excursion
    (let ((enable-recursive-minibuffers t)
	  (use-dialog-box (and use-dialog-box (null noninteractive)))
	  result)

      (with-parsed-tramp-file-name
	  (tramp-gvfs-file-name (dbus-event-path-name last-input-event)) nil
	(tramp-message v 6 "%S %S" message choices)

	(setq result
	      (condition-case nil
		  (list
		   t ;; handled.
		   nil ;; no abort of D-Bus.
		   ;; Preserve message for `progress-reporter'.
		   (with-temp-message ""
		     (if noninteractive
			 ;; Keep regression tests running.
			 (progn
			   (message "%s" message)
			   0)
		       (with-tramp-connection-property
			   (tramp-get-process v) message
			 ;; In theory, there can be several choices.
			 ;; Until now, there is only the question
			 ;; whether to accept an unknown host
			 ;; signature or certificate.
			 (with-temp-buffer
			   (insert message)
			   (goto-char (point-max))
			   (pop-to-buffer (current-buffer))
			   (if (yes-or-no-p
				(buffer-substring
				 (line-beginning-position) (point)))
			       0 1))))))

		;; When QUIT is raised, we shall return this
		;; information to D-Bus.
		(quit (list nil t 1))))

	(tramp-message v 6 "%s" result)

	;; When the choice is "no", we set a dummy fuse-mountpoint in
	;; order to leave the timeout.
	(unless (zerop (cl-caddr result))
	  (tramp-set-file-property v "/" "fuse-mountpoint" "/"))

	result))))