1
0
Fork 0

- [kami] close the connection when closing the filesystem explorer window;

- fixed a prompt and an error message.
This commit is contained in:
cage 2022-01-23 12:53:08 +01:00
parent 7517688f03
commit 1d2d528d95
4 changed files with 14 additions and 7 deletions

View File

@ -94,10 +94,10 @@
to query Valid feature values are :size. Returns nil if Returns
nil if the path does not point to an actual file.")
(filesystem-close-connection-function
:initform (lambda (stream) (declare (ignore stream)))
:initform (constantly t)
:accessor filesystem-close-connection-function
:type function
:documentation "function with a signle parameter the connection stream to be closed."))
:documentation "function with no parameter to close the connection."))
(:documentation "A window that shows and allow interacting with a
hierarchical filesystem"))
@ -119,7 +119,9 @@
(filesystem-upload-function object)
(getf handlers-plist :filesystem-upload-function)
(filesystem-query-path-function object)
(getf handlers-plist :filesystem-query-path-function)))
(getf handlers-plist :filesystem-query-path-function)
(filesystem-close-connection-function object)
(getf handlers-plist :filesystem-close-connection-function)))
object)
(defmethod refresh-config :after ((object filesystem-tree-window))
@ -526,6 +528,10 @@
(upload-treenode window
downloaded-path
node-path)))))
(defun close-connection (window)
(funcall (filesystem-close-connection-function window)))
(defun init (root &optional (handlers-plist nil))
"Initialize the window"
(let* ((low-level-window (make-croatoan-window :border t))

View File

@ -171,8 +171,7 @@
:filesystem-download-function (download-node *stream* *root-fid*)
:filesystem-upload-function (upload-node *stream* *root-fid*)
:filesystem-query-path-function (query-path *stream* *root-fid*)
:filesystem-close-connection-function (lambda (stream)
(declare (ignore stream))
:filesystem-close-connection-function (lambda ()
(9p:close-client socket))))))
(defun iri->filesystem-window-handlers (kami-iri)

View File

@ -2049,6 +2049,7 @@
:mark-node
:open-node
:edit-node
:close-connection
:resync-rows-db
:init))

View File

@ -2421,7 +2421,7 @@ printed, on the main window."
(focus-to-filesystem-explorer-window))))
(defun kami-open-url-prompt ()
(_ "Open Kami url: "))
(_ "Open kami url: "))
(defun kami-open-url ()
(flet ((on-input-complete (url)
@ -2434,7 +2434,7 @@ printed, on the main window."
handlers)
(focus-to-filesystem-explorer-window))
(error-message (format nil
(_ "~s is not a valid gemini address")
(_ "~s is not a valid kami address")
url))))))))
(let ((prompt (kami-open-url-prompt)))
(ask-string-input #'on-input-complete
@ -2622,6 +2622,7 @@ printed, on the main window."
(windows:draw win))))
(defun file-explorer-close-window ()
(fstree:close-connection *filesystem-explorer-window*)
(close-window-and-return-to-message *filesystem-explorer-window*))
(defun file-explorer-open-node ()