1
0
Fork 0

- used 'load-gemini-url', when possible, to avoid duplication.

This commit is contained in:
cage 2021-03-27 09:33:55 +01:00
parent db34a2f958
commit 16c131e952
3 changed files with 13 additions and 16 deletions

View File

@ -731,11 +731,15 @@
(draw *gemini-streams-window*)
*gemini-streams-window*))
(defun load-gemini-url (url)
(defun load-gemini-url (url &key
(priority program-events:+standard-event-priority+)
(give-focus-to-message-window t))
"Load `url', that is a web resource or a local file. This function
can be used only when the event polling is enabled (e.g. from user
command) otherwise te actual code to get the resource will never be
executed."
(let* ((event (make-instance 'program-events:gemini-request-event
:give-focus-to-message-window give-focus-to-message-window
:priority priority
:url url)))
(program-events:push-event event)))

View File

@ -85,17 +85,14 @@
(gemini-viewer:request url :enqueue enqueue
:use-cached-file-if-exists t))
((null scheme)
(let* ((event (make-instance 'program-events:gemini-request-event
:url url
:give-focus-to-message-window nil)))
(program-events:push-event event)))
(gemini-viewer:load-gemini-url url
:give-focus-to-message-window nil))
(t
(let ((program (swconf:link-regex->program-to-use url)))
(if program
(os-utils:open-link-with-program program url)
(os-utils:xdg-open url)))))))
(defclass open-links-window ()
((links
:initform ()

View File

@ -1779,12 +1779,8 @@ open-message-link-window:open-message-link"
"Ask for a gemini address and try to load it"
(flet ((on-input-complete (url)
(if (gemini-parser:gemini-iri-p url)
(let* ((event (make-instance 'gemini-request-event
:priority
program-events:+maximum-event-priority+
:use-cached-file-if-exists t
:url url)))
(program-events:push-event event))
(gemini-viewer:load-gemini-url url
:priority program-events:+maximum-event-priority+)
(error-message (_ "This is not a valid gemini address")))))
(let ((prompt (gemini-open-url-prompt)))
(ask-string-input #'on-input-complete