mirror of https://codeberg.org/cage/tinmop/
- used 'load-gemini-url', when possible, to avoid duplication.
This commit is contained in:
parent
db34a2f958
commit
16c131e952
|
@ -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)))
|
||||
|
|
|
@ -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 ()
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue