From d507278f67afe78bff90a9fb005d72dd3dbd7f2a Mon Sep 17 00:00:00 2001 From: cage Date: Sat, 21 Sep 2024 11:26:45 +0200 Subject: [PATCH] - [gui] disabled gempub menu if there is no support for zip files (zip/unzip executables not found); - [gui] added to history also local paths. --- src/gui/client/main-window.lisp | 13 ++++++++++++- src/gui/server/main-window-server-side.lisp | 4 ++++ src/gui/server/public-api-gemini-stream.lisp | 4 ++-- src/gui/server/public-api.lisp | 3 +++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/gui/client/main-window.lisp b/src/gui/client/main-window.lisp index 8177b06..4b96388 100644 --- a/src/gui/client/main-window.lisp +++ b/src/gui/client/main-window.lisp @@ -247,7 +247,7 @@ (tour (gui:make-menu bar (_ "Tour"))) (bookmarks (gui:make-menu bar (_ "Bookmarks"))) (gemlogs (gui:make-menu bar (_ "Gemlogs"))) - (gempub (gui:make-menu bar (_ "Books"))) + #+gempub-support (gempub (gui:make-menu bar (_ "Books"))) (help (gui:make-menu bar (_ "Help")))) (gui:make-menubutton tools (_ "Certificates") @@ -265,6 +265,7 @@ (_ "View source") (menu:show-page-source-clsr main-window) :accelerator (client-configuration:get-keybinding :view-source)) + #+gempub-support (gui:make-menubutton gempub (_ "Search gempub library") (menu:search-gempub-library-clsr main-window) @@ -273,6 +274,7 @@ (gui:make-menubutton gempub (_ "Make gempub file") (menu:make-gempub-clsr main-window)) + #+gempub-support (gui:make-menubutton gempub (_ "Import gempub file") (menu:install-gempub-clsr main-window)) @@ -1030,6 +1032,7 @@ local file paths." ev:+standard-event-priority+ path))) (ev:with-enqueued-process-and-unblock () + (comm:make-request :gemini-push-url-to-history 1 path) (clear-gemtext main-window) (collect-ir-lines path gui-goodies:*main-frame* parsed-lines) (render-toc main-window path))) @@ -1038,9 +1041,17 @@ local file paths." 1 ev:+standard-event-priority+ path))) + (cev:enqueue-request-and-wait-results :gemini-push-url-to-history + 1 + ev:+standard-event-priority+ + path) (render-monospaced-text main-window lines)) (client-os-utils:open-resource-with-external-program main-window path)))) ((fs:directory-exists-p path) + (cev:enqueue-request-and-wait-results :gemini-push-url-to-history + 1 + ev:+standard-event-priority+ + path) (open-local-path (gui:get-open-file :initial-dir path :parent main-window) main-window)) diff --git a/src/gui/server/main-window-server-side.lisp b/src/gui/server/main-window-server-side.lisp index 354e337..ebee526 100644 --- a/src/gui/server/main-window-server-side.lisp +++ b/src/gui/server/main-window-server-side.lisp @@ -82,5 +82,9 @@ (defun gemini-pop-url-from-history () (gw:pop-url-from-history *gemini-window*)) +(defun gemini-push-url-to-history (iri) + (gw:push-url-to-history *gemini-window* iri) + t) + (defun iri-to-parent-path (iri) (iri:iri-to-parent-path iri)) diff --git a/src/gui/server/public-api-gemini-stream.lisp b/src/gui/server/public-api-gemini-stream.lisp index d297bc9..065dd5f 100644 --- a/src/gui/server/public-api-gemini-stream.lisp +++ b/src/gui/server/public-api-gemini-stream.lisp @@ -136,7 +136,7 @@ (cond ((gemini-client:gemini-file-stream-p meta) (debug-gemini-gui "response is a gemini document stream") - (gemini-viewer:push-url-to-history *gemini-window* actual-iri) + (gemini-push-url-to-history actual-iri) (make-text-based-stream t) (make-gemini-response (gemini-client:code gemini-client:+success+) (gemini-client:description gemini-client:+success+) @@ -280,7 +280,7 @@ (if cached-stream (progn (debug-gemini-gui "caching found for ~a" actual-iri) - (gemini-viewer:push-url-to-history *gemini-window* actual-iri) + (gemini-push-url-to-history actual-iri) (make-gemini-response (gw:status-code cached-stream) (gw:status-code-description cached-stream) (gw:meta cached-stream) diff --git a/src/gui/server/public-api.lisp b/src/gui/server/public-api.lisp index 657b41f..f4e9450 100644 --- a/src/gui/server/public-api.lisp +++ b/src/gui/server/public-api.lisp @@ -78,6 +78,9 @@ "iri" 0) (gen-rpc "gemini-current-url" 'gemini-current-url) (gen-rpc "gemini-pop-url-from-history" 'gemini-pop-url-from-history) + (gen-rpc "gemini-push-url-to-history" + 'gemini-push-url-to-history + "iri" 0) (gen-rpc "gemini-save-url-db-history" 'gemini-save-url-db-history "iri" 0)