1
0
Fork 0

- [GUI] prevent rendering of lines in the queue when corresponding

stream has been canceled;
- [GUI] print an error when opening a non existent local path.
This commit is contained in:
cage 2023-03-11 14:12:30 +01:00
parent c90c7289d9
commit f882b1584f
1 changed files with 20 additions and 9 deletions

View File

@ -79,7 +79,8 @@
(with-accessors ((fetching-thread fetching-thread)) object
(abort-downloading object)
(when (bt:threadp fetching-thread)
(bt:join-thread fetching-thread))))
(bt:join-thread fetching-thread)))
object)
(defmethod stop-stream-thread ((object string))
(let ((stream-wrapper (find-db-stream-url object)))
@ -444,7 +445,9 @@
(clean-gemtext main-window)
(set-text-gemtext main-window lines)))))
((fs:directory-exists-p path)
(gui:choose-directory :initial-dir path :parent main-window :mustexist t))))
(gui:choose-directory :initial-dir path :parent main-window :mustexist t))
(t
(notify-request-error (format nil (_ "No such file or directory: ~a") path)))))
(defun open-iri (iri main-window use-cache)
(handler-case
@ -495,13 +498,21 @@
((gemini-client:header-success-p status-code)
(cond
((eq status +stream-status-streaming+)
(maybe-stop-steaming-stream-thread)
(clean-gemtext main-window)
(start-streaming-thread iri
:use-cache nil
:process-function (lambda (lines)
(collect-ir-lines iri main-window lines))
:status status))
(let ((stopped-stream (maybe-stop-steaming-stream-thread)))
(clean-gemtext main-window)
(start-streaming-thread iri
:use-cache nil
:process-function
(lambda (lines)
;; this test ensures that the
;; collecting events left on
;; the queue won't be actually
;; processed, just discarded
(when (and stopped-stream
(not (eq (status stopped-stream)
+stream-status-canceled+)))
(collect-ir-lines iri main-window lines)))
:status status)))
((eq status +stream-status-downloading+)
(when (not (find-db-stream-url iri))
(enqueue-request-notify-error :gemini-request 1 iri use-cache)))