mirror of
https://codeberg.org/cage/tinmop/
synced 2025-03-13 11:30:04 +01:00
- [RPC] fixed server stopping;
- [GUI] notify RPC errors to the user using the GUI.
This commit is contained in:
parent
7b415e485a
commit
a973a8fbe1
@ -62,6 +62,16 @@
|
||||
(defun find-db-stream-url (url)
|
||||
(find-db-stream-if (lambda (a) (string= (server-stream-handle a) url))))
|
||||
|
||||
(defun notify-request-error (e)
|
||||
(gui-goodies:error-dialog gui:*tk*
|
||||
(format nil (_ "Comunication with backend failed: ~a") e)))
|
||||
|
||||
(defmacro with-notify-errors (&body body)
|
||||
`(handler-case
|
||||
(progn ,@body)
|
||||
(error (e)
|
||||
(notify-request-error e))))
|
||||
|
||||
(defmacro with-enqueue-request ((method-name id &rest args) &body on-error)
|
||||
`(ev:with-enqueued-process-and-unblock ()
|
||||
(handler-case
|
||||
@ -123,19 +133,9 @@
|
||||
(setf (fetching-thread stream-wrapper) stream-thread)
|
||||
(push-db-stream stream-wrapper))))))
|
||||
|
||||
(defun notify-request-error (e)
|
||||
(gui-goodies:error-dialog gui:*tk*
|
||||
(format nil (_ "Comunication with backend failed: ~a") e)))
|
||||
|
||||
(defmacro with-notify-errors (&body body)
|
||||
`(handler-case
|
||||
(progn ,@body)
|
||||
(error (e)
|
||||
(notify-request-error e))))
|
||||
|
||||
(defun initialize-menu (parent)
|
||||
(with-accessors ((main-window main-window)) parent
|
||||
(let* ((bar (gui:make-menubar))
|
||||
(let* ((bar (gui:make-menubar parent))
|
||||
(file (gui:make-menu bar (_ "File") :underline 0))
|
||||
(help (gui:make-menu bar (_ "Help") :underline 0)))
|
||||
(gui:make-menubutton file (_ "Quit") #'menu:quit :underline 0)
|
||||
|
@ -49,6 +49,9 @@
|
||||
(write-byte +command-delimiter+ *server-output-stream*)
|
||||
(finish-output *server-output-stream*))
|
||||
|
||||
(defun stop-server ()
|
||||
(setf *stop-server* t))
|
||||
|
||||
(defun start-server ()
|
||||
(init-gemini-window)
|
||||
(prepare-rpc
|
||||
|
@ -29,7 +29,7 @@
|
||||
(fs:clean-temporary-directories)
|
||||
(fs:clean-temporary-files)
|
||||
(db-utils:close-db)
|
||||
(setf *stop-server* t))
|
||||
(stop-server))
|
||||
|
||||
(defmacro prepare-rpc (&body body)
|
||||
`(let ((rpc:*function-db* '()))
|
||||
|
Loading…
x
Reference in New Issue
Block a user