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
|
@ -675,8 +675,8 @@
|
|||
(defmethod refresh-config :after ((object gemini-streams-window))
|
||||
(open-attach-window:refresh-view-links-window-config object
|
||||
swconf:+key-open-gemini-stream-window+)
|
||||
(let* ((win-w (truncate (* (win-width specials:*main-window*) 3/4)))
|
||||
(win-h (truncate (* (win-height specials:*main-window*) 3/4)))
|
||||
(let* ((win-w (truncate (* (win-width specials:*main-window*) 3/4)))
|
||||
(win-h (truncate (* (win-height specials:*main-window*) 3/4)))
|
||||
(x (truncate (- (/ (win-width specials:*main-window*) 2)
|
||||
(/ win-w 2))))
|
||||
(y (truncate (- (/ (win-height specials:*main-window*) 2)
|
||||
|
@ -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
|
||||
:url url)))
|
||||
:give-focus-to-message-window give-focus-to-message-window
|
||||
:priority priority
|
||||
:url url)))
|
||||
(program-events:push-event event)))
|
||||
|
|
|
@ -82,20 +82,17 @@
|
|||
(db:gemlog-mark-as-seen url)
|
||||
(gemini-viewer:ensure-just-one-stream-rendering)
|
||||
(program-events:push-event event))
|
||||
(gemini-viewer:request url :enqueue enqueue
|
||||
(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