Change delete-by-moving-to-trash so Lisp calls explicitly request trashing.
[bpt/emacs.git] / lisp / net / tramp-gvfs.el
index 569fca3..25dae77 100644 (file)
@@ -525,7 +525,7 @@ is no information where to trace the message.")
            newname)
          ok-if-already-exists keep-date preserve-uid-gid)))
     (when preserve-selinux-context
-      (setq args (append args (list preserve-uid-gid))))
+      (setq args (append args (list preserve-selinux-context))))
     (apply 'copy-file args)))
 
 (defun tramp-gvfs-handle-delete-directory (directory &optional recursive)
@@ -533,9 +533,9 @@ is no information where to trace the message.")
   (tramp-compat-delete-directory
    (tramp-gvfs-fuse-file-name directory) recursive))
 
-(defun tramp-gvfs-handle-delete-file (filename &optional force)
+(defun tramp-gvfs-handle-delete-file (filename &optional tramp)
   "Like `delete-file' for Tramp files."
-  (tramp-compat-delete-file (tramp-gvfs-fuse-file-name filename) force))
+  (tramp-compat-delete-file (tramp-gvfs-fuse-file-name filename) tramp))
 
 (defun tramp-gvfs-handle-directory-files
   (directory &optional full match nosort)
@@ -629,7 +629,8 @@ is no information where to trace the message.")
 
 (defun tramp-gvfs-handle-file-selinux-context (filename)
   "Like `file-selinux-context' for Tramp files."
-  (funcall 'file-selinux-context (tramp-gvfs-fuse-file-name filename)))
+  (tramp-compat-funcall
+   'file-selinux-context (tramp-gvfs-fuse-file-name filename)))
 
 (defun tramp-gvfs-handle-file-writable-p (filename)
   "Like `file-writable-p' for Tramp files."
@@ -741,7 +742,7 @@ is no information where to trace the message.")
                   "gvfs-save" tmpfile (tramp-get-buffer v) nil
                   (tramp-gvfs-url-file-name filename)))
               (signal (car err) (cdr err)))
-          (tramp-compat-delete-file tmpfile 'force)))))
+          (tramp-compat-delete-file tmpfile)))))
 
     ;; Set file modification time.
     (when (or (eq visit t) (stringp visit))
@@ -873,10 +874,12 @@ ADDRESS can have the form \"xx:xx:xx:xx:xx:xx\" or \"[xx:xx:xx:xx:xx:xx]\"."
            ;; there is only the question whether to accept an unknown
            ;; host signature.
            (with-temp-buffer
-             (insert message)
-             (pop-to-buffer (current-buffer))
-             (setq choice (if (yes-or-no-p (concat (car choices) " ")) 0 1))
-             (tramp-message v 6 "%d" choice))
+             ;; Preserve message for `progress-reporter'.
+             (with-temp-message ""
+               (insert message)
+               (pop-to-buffer (current-buffer))
+               (setq choice (if (yes-or-no-p (concat (car choices) " ")) 0 1))
+               (tramp-message v 6 "%d" choice)))
 
            ;; When the choice is "no", we set an empty
            ;; fuse-mountpoint in order to leave the timeout.
@@ -888,8 +891,8 @@ ADDRESS can have the form \"xx:xx:xx:xx:xx:xx\" or \"[xx:xx:xx:xx:xx:xx]\"."
             nil ;; no abort of D-Bus.
             choice))
 
-         ;; When QUIT is raised, we shall return this information to D-Bus.
-         (quit (list nil t 0))))))
+       ;; When QUIT is raised, we shall return this information to D-Bus.
+       (quit (list nil t 0))))))
 
 (defun tramp-gvfs-handler-mounted-unmounted (mount-info)
   "Signal handler for the \"org.gtk.vfs.MountTracker.mounted\" and
@@ -1066,65 +1069,58 @@ connection if a previous connection has died for some reason."
            (tramp-gvfs-object-path
             (tramp-make-tramp-file-name method user host ""))))
 
-      (if (zerop (length (tramp-file-name-user vec)))
-         (tramp-message
-          vec 3 "Opening connection for %s using %s..." host method)
-       (tramp-message
-        vec 3 "Opening connection for %s@%s using %s..." user host method))
-
-      ;; Enable auth-sorce and password-cache.
-      (tramp-set-connection-property vec "first-password-request" t)
-
-      ;; There will be a callback of "askPassword", when a password is
-      ;; needed.
-      (dbus-register-method
-       :session dbus-service-emacs object-path
-       tramp-gvfs-interface-mountoperation "askPassword"
-       'tramp-gvfs-handler-askpassword)
-
-      ;; There could be a callback of "askQuestion", when adding fingerprint.
-      (dbus-register-method
-       :session dbus-service-emacs object-path
-       tramp-gvfs-interface-mountoperation "askQuestion"
-       'tramp-gvfs-handler-askquestion)
-
-      ;; The call must be asynchronously, because of the "askPassword"
-      ;; or "askQuestion"callbacks.
-      (with-tramp-dbus-call-method vec nil
-       :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker
-       tramp-gvfs-interface-mounttracker "mountLocation"
-       `(:struct
-         ,(dbus-string-to-byte-array "/")
-         ,(tramp-gvfs-mount-spec vec))
-       (dbus-get-unique-name :session)
-       :object-path object-path)
-
-      ;; We must wait, until the mount is applied.  This will be
-      ;; indicated by the "mounted" signal, i.e. the "fuse-mountpoint"
-      ;; file property.
-      (with-timeout
-         (60
-          (if (zerop (length (tramp-file-name-user vec)))
+      (with-progress-reporter
+         vec 3
+         (if (zerop (length user))
+             (format "Opening connection for %s using %s" host method)
+           (format "Opening connection for %s@%s using %s" user host method))
+
+       ;; Enable auth-sorce and password-cache.
+       (tramp-set-connection-property vec "first-password-request" t)
+
+       ;; There will be a callback of "askPassword", when a password is
+       ;; needed.
+       (dbus-register-method
+        :session dbus-service-emacs object-path
+        tramp-gvfs-interface-mountoperation "askPassword"
+        'tramp-gvfs-handler-askpassword)
+
+       ;; There could be a callback of "askQuestion", when adding fingerprint.
+       (dbus-register-method
+        :session dbus-service-emacs object-path
+        tramp-gvfs-interface-mountoperation "askQuestion"
+        'tramp-gvfs-handler-askquestion)
+
+       ;; The call must be asynchronously, because of the "askPassword"
+       ;; or "askQuestion"callbacks.
+       (with-tramp-dbus-call-method vec nil
+         :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker
+         tramp-gvfs-interface-mounttracker "mountLocation"
+         `(:struct
+           ,(dbus-string-to-byte-array "/")
+           ,(tramp-gvfs-mount-spec vec))
+         (dbus-get-unique-name :session)
+         :object-path object-path)
+
+       ;; We must wait, until the mount is applied.  This will be
+       ;; indicated by the "mounted" signal, i.e. the "fuse-mountpoint"
+       ;; file property.
+       (with-timeout
+           (60
+            (if (zerop (length (tramp-file-name-user vec)))
+                (tramp-error
+                 vec 'file-error
+                 "Timeout reached mounting %s using %s" host method)
               (tramp-error
                vec 'file-error
-               "Timeout reached mounting %s using %s" host method)
-            (tramp-error
-             vec 'file-error
-             "Timeout reached mounting %s@%s using %s" user host method)))
-       (while (not (tramp-get-file-property vec "/" "fuse-mountpoint" nil))
-         (read-event nil nil 0.1)))
-
-      ;; We set the connection property "started" in order to put the
-      ;; remote location into the cache, which is helpful for further
-      ;; completion.
-      (tramp-set-connection-property vec "started" t)
-
-      (if (zerop (length (tramp-file-name-user vec)))
-         (tramp-message
-          vec 3 "Opening connection for %s using %s...done" host method)
-       (tramp-message
-        vec 3
-        "Opening connection for %s@%s using %s...done" user host method)))))
+               "Timeout reached mounting %s@%s using %s" user host method)))
+         (while (not (tramp-get-file-property vec "/" "fuse-mountpoint" nil))
+           (read-event nil nil 0.1)))
+
+       ;; We set the connection property "started" in order to put the
+       ;; remote location into the cache, which is helpful for further
+       ;; completion.
+       (tramp-set-connection-property vec "started" t)))))
 
 \f
 ;; D-Bus BLUEZ functions.