1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2024-12-18 23:22:52 +01:00

- [GUI] added contextual menu to gemtext widget;

- [GUI] added command to collect all the links of a page in the tour.
This commit is contained in:
cage 2024-05-31 12:56:52 +02:00
parent 92e30d37b3
commit 39886718cc
2 changed files with 40 additions and 14 deletions

View File

@ -2595,23 +2595,19 @@ msgstr "Criterio di ricerca: "
msgid "Default"
msgstr "Default"
#: src/message-rendering-utils.lisp:354
msgid "Multiple choices allowed"
msgstr "Sono ammesse scelte multiple"
#~ msgid "Multiple choices allowed"
#~ msgstr "Sono ammesse scelte multiple"
#: src/message-rendering-utils.lisp:355
msgid "A single choice allowed"
msgstr "È ammessa una sola scelta"
#~ msgid "A single choice allowed"
#~ msgstr "È ammessa una sola scelta"
#: src/message-rendering-utils.lisp:357
msgid "The poll has expired"
msgstr "Il sondaggio è scaduto"
#~ msgid "The poll has expired"
#~ msgstr "Il sondaggio è scaduto"
#: src/message-rendering-utils.lisp:358
msgid "NB: results not shown as the poll has not expired"
msgstr ""
"NB: I risultati non sono mostrati dato che il sondaggio non è ancora "
"terminato."
#~ msgid "NB: results not shown as the poll has not expired"
#~ msgstr ""
#~ "NB: I risultati non sono mostrati dato che il sondaggio non è ancora "
#~ "terminato."
#~ msgid "Subject:"
#~ msgstr "Oggetto del messaggio: "

View File

@ -580,6 +580,26 @@ local file paths."
link-name
link-value)))))
(defun contextual-menu-gemtext-widget (main-window)
(labels ((add-to-tour-callback ()
(let ((links (collect-link-lines main-window)))
(loop for line in links
for link-value = (ir-href line) then (ir-href line)
for link-name = (or (ir-line line)
(ir-href line))
then (or (ir-line line)
(ir-href line))
when (gemini-client:absolute-gemini-url-p link-value)
do
(enqueue-add-link-to-tour link-value link-name)))))
(lambda (e)
(declare (ignore e))
(let* ((popup-menu (gui:make-menu nil (_"gemtext window menu")))
(x (gui:screen-mouse-x))
(y (gui:screen-mouse-y)))
(gui:make-menubutton popup-menu (_ "Add all links to tour") #'add-to-tour-callback)
(gui:popup popup-menu x y)))))
(defun contextual-menu-link-clrs (link-name link-value main-window)
(labels ((add-to-tour-callback ()
(enqueue-add-link-to-tour link-value link-name))
@ -987,6 +1007,13 @@ local file paths."
(strcat iri "/")
iri)))
(defun collect-link-lines (main-window)
(with-accessors ((ir-lines ir-lines)) main-window
(loop for line across ir-lines
when (eq (format-keyword (ir-type line))
:a)
collect line)))
(defun collect-source-lines-clsr (main-window)
(lambda (stream-wrapper lines)
;; this test ensures that the
@ -1476,6 +1503,9 @@ local file paths."
(gui:bind toc-listbox
#$<<ListboxSelect>>$
(toc-callback-clsr main-window))
(gui:bind (gui:inner-text gemtext-widget)
#$<3>$
(contextual-menu-gemtext-widget main-window))
(setf (gui:command go-button) (open-iri-clsr main-window t))
(setf (gui:command reload-button) (reload-iri-clsr main-window))
(setf (gui:command back-button) (back-iri-clsr main-window))