1
0
Fork 0

- [GUI] ensured deadline conditions is respected by gemlog subscribing procedures.

This commit is contained in:
cage 2024-09-04 17:47:16 +02:00
parent 4947289eab
commit 165bb30688
4 changed files with 29 additions and 21 deletions

View File

@ -110,22 +110,28 @@
(let ((new-rows (all-rows)))
(resync-rows gemlog-frame new-rows)))))
(defun subscribe-gemlog-or-notify-error (iri)
(handler-case
(progn
(comm:make-request :gemini-gemlog-subscribe 1 iri)
t)
(error (e)
(gui-goodies:notify-request-error e)
nil)))
(defun subscribe-gemlog-clsr (gemlog-frame)
(lambda ()
(handler-case
(let* ((iri (trim-blanks (gui-mw:text-input-dialog gemlog-frame
(_ "Info request")
(_ "Please, type the gemlog's address")
:text "gemini://")))
(subscription-ok (comm:make-request :gemini-gemlog-subscribe 1 iri)))
(if subscription-ok
(let ((new-rows (all-rows)))
(resync-rows gemlog-frame new-rows))
(gui-goodies:notify-request-error (format nil
(_ "Unable to subscribe to ~s")
iri))))
(error (e)
(gui-goodies:notify-request-error e)))))
(let* ((iri (trim-blanks (gui-mw:text-input-dialog gemlog-frame
(_ "Info request")
(_ "Please, type the gemlog's address")
:text "gemini://")))
(subscription-ok (subscribe-gemlog-or-notify-error iri)))
(if subscription-ok
(let ((new-rows (all-rows)))
(resync-rows gemlog-frame new-rows))
(gui-goodies:notify-request-error (format nil
(_ "Unable to subscribe to ~s")
iri))))))
(defun open-gemlog-clsr (main-window treeview-gemlogs)
(lambda (e)

View File

@ -676,10 +676,8 @@ local file paths."
(slurp-iri main-window link-value)))))
(fs:copy-a-file input-file output-file :overwrite t)))
(subscribe-as-gemlog ()
(let ((subscription-ok (comm:make-request :gemini-gemlog-subscribe
1
link-value)))
(if subscription-ok
(let ((subscribed (client-gemlog-window:subscribe-gemlog-or-notify-error link-value)))
(if subscribed
(gui-goodies:info-operation-completed main-window)
(gui-goodies:notify-request-error (format nil
(_ "Unable to subscribe to ~s")
@ -1495,8 +1493,8 @@ local file paths."
(progn
(comm:make-request :gemini-gemlog-unsubscribe 1 iri)
(set-subscribe-button-unsubscribed main-window))
(let ((subscription-ok (comm:make-request :gemini-gemlog-subscribe 1 iri)))
(if subscription-ok
(let ((subscribed (client-gemlog-window:subscribe-gemlog-or-notify-error iri)))
(if subscribed
(set-subscribe-button-subscribed main-window)
(gui-goodies:notify-request-error (format nil
(_ "Unable to subscribe to ~s")

View File

@ -416,7 +416,7 @@
(defun maybe-log-message (m)
(declare (ignorable m))
#+debug-json-rpc
(misc:dbg m))
(misc:dbg "~a" m))
(defun elaborate-single-request (request)
(flet ((make-rpc-error (e id &optional (data nil))
@ -457,6 +457,9 @@
(make-response elaborated id :error-object nil)))
(json-rpc-error (e)
(make-rpc-error e id request))
(condition (c)
(maybe-log-message (format nil "jsonrpc request signalled a condition: ~a" c))
(make-failed-function-error c id request))
(error (e)
(maybe-log-message (format nil "jsonrpc request failed: ~a" e))
(make-failed-function-error e id request))))

View File

@ -3728,6 +3728,7 @@
(:gui-shapes :nodgui.shapes)
(:menu :client-menu-command))
(:export
:subscribe-gemlog-or-notify-error
:init-window))
(defpackage :client-search-frame