mirror of
https://codeberg.org/cage/tinmop/
synced 2025-02-21 08:50:51 +01:00
- [GUI] added command to reload a gemini stream from the streams window.
This commit is contained in:
parent
d7f36cc33d
commit
41b2f7a571
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
@ -3,3 +3,9 @@
|
||||
(define-constant +minimum-padding+ 2 :test #'=)
|
||||
|
||||
(define-constant +ps-file-dialog-filter+ '(("PostScript Files" "*.ps")) :test #'equalp)
|
||||
|
||||
(define-constant +stream-status-streaming+ :streaming :test #'eq)
|
||||
|
||||
(define-constant +stream-status-canceled+ :canceled :test #'eq)
|
||||
|
||||
(define-constant +stream-status-downloading+ :downloading :test #'eq)
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
(a:define-constant +document-add+ "fmw_document-add" :test #'string=)
|
||||
|
||||
(a:define-constant +document-accept+ "fmw_document-accept" :test #'string=)
|
||||
|
||||
(a:define-constant +folder+ "fmw_folder" :test #'string=)
|
||||
|
||||
(defparameter *search* nil)
|
||||
@ -36,6 +38,8 @@
|
||||
|
||||
(defparameter *document-add* nil)
|
||||
|
||||
(defparameter *document-accept* nil)
|
||||
|
||||
(defparameter *folder* nil)
|
||||
|
||||
(defun load-icon (filename)
|
||||
@ -56,4 +60,5 @@
|
||||
(setf *up* (load-icon +up+))
|
||||
(setf *document-delete* (load-icon +document-delete+))
|
||||
(setf *document-add* (load-icon +document-add+))
|
||||
(setf *document-accept* (load-icon +document-accept+))
|
||||
(setf *folder* (load-icon +folder+)))
|
||||
|
@ -2,12 +2,6 @@
|
||||
|
||||
(named-readtables:in-readtable nodgui.syntax:nodgui-syntax)
|
||||
|
||||
(a:define-constant +stream-status-streaming+ :streaming :test #'eq)
|
||||
|
||||
(a:define-constant +stream-status-canceled+ :canceled :test #'eq)
|
||||
|
||||
(a:define-constant +stream-status-downloading+ :downloading :test #'eq)
|
||||
|
||||
(defclass gemini-stream ()
|
||||
((server-stream-handle
|
||||
:initform nil
|
||||
@ -77,8 +71,9 @@
|
||||
|
||||
(defmethod stop-stream-thread ((object gemini-stream))
|
||||
(with-accessors ((fetching-thread fetching-thread)) object
|
||||
(abort-downloading object)
|
||||
(when (bt:threadp fetching-thread)
|
||||
(abort-downloading object)
|
||||
(when (and (bt:threadp fetching-thread)
|
||||
(bt:thread-alive-p fetching-thread))
|
||||
(bt:join-thread fetching-thread)))
|
||||
object)
|
||||
|
||||
@ -853,13 +848,14 @@
|
||||
(setf (gui:text (gemtext-widget main-window)) text))
|
||||
|
||||
(defun init-main-window ()
|
||||
(gui:with-nodgui (:title +program-name+)
|
||||
(icons:load-icons)
|
||||
(initialize-menu gui:*tk*)
|
||||
(setf gui-goodies:*toplevel* gui:*tk*)
|
||||
(setf gui-goodies:*gui-server* gui:*wish*)
|
||||
(client-events:start-events-loop)
|
||||
(let ((main-frame (make-instance 'main-frame)))
|
||||
(setf gui-goodies:*main-frame* main-frame)
|
||||
(gui:grid main-frame 0 0 :sticky :nswe)
|
||||
(gui-goodies:gui-resize-grid-all gui-goodies:*toplevel*))))
|
||||
(let ((gui:*debug-tk* nil))
|
||||
(gui:with-nodgui (:title +program-name+)
|
||||
(icons:load-icons)
|
||||
(initialize-menu gui:*tk*)
|
||||
(setf gui-goodies:*toplevel* gui:*tk*)
|
||||
(setf gui-goodies:*gui-server* gui:*wish*)
|
||||
(client-events:start-events-loop)
|
||||
(let ((main-frame (make-instance 'main-frame)))
|
||||
(setf gui-goodies:*main-frame* main-frame)
|
||||
(gui:grid main-frame 0 0 :sticky :nswe)
|
||||
(gui-goodies:gui-resize-grid-all gui-goodies:*toplevel*)))))
|
||||
|
@ -52,14 +52,23 @@
|
||||
(stream-client-wrapper (client-main-window::find-db-stream-url url)))
|
||||
(when (eq (client-main-window:status stream-client-wrapper)
|
||||
client-main-window:+stream-status-streaming+)
|
||||
(ev:with-enqueued-process-and-unblock ()
|
||||
(client-main-window:stop-steaming-stream-thread)))
|
||||
(ev:with-enqueued-process-and-unblock ()
|
||||
(client-main-window:stop-steaming-stream-thread)))
|
||||
(ev:with-enqueued-process-and-unblock ()
|
||||
(client-main-window:remove-db-stream stream-client-wrapper)
|
||||
(comm:make-request :gemini-remove-stream 1 url))
|
||||
(let ((new-rows (all-rows)))
|
||||
(resync-rows stream-frame new-rows)))))))
|
||||
|
||||
(defun revive-stream-clsr (stream-frame)
|
||||
(lambda ()
|
||||
(a:when-let* ((selections (gui:treeview-get-selection (gui-goodies:tree stream-frame)))
|
||||
(selection (first selections)))
|
||||
(let* ((url (gui:id selection))
|
||||
(new-rows (all-rows)))
|
||||
(resync-rows stream-frame new-rows)
|
||||
(client-main-window::open-iri url gui-goodies:*main-frame* t)))))
|
||||
|
||||
(defun init-window (master)
|
||||
(gui:with-modal-toplevel (toplevel :master master :title (_ "Streams"))
|
||||
(gui:transient toplevel master)
|
||||
@ -68,8 +77,14 @@
|
||||
(delete-button (make-instance 'gui:button
|
||||
:master buttons-frame
|
||||
:image icons:*document-delete*
|
||||
:command (delete-stream-clsr table))))
|
||||
(gui-goodies:attach-tooltips (delete-button (_ "delete selected stream")))
|
||||
:command (delete-stream-clsr table)))
|
||||
(revive-button (make-instance 'gui:button
|
||||
:master buttons-frame
|
||||
:image icons:*document-accept*
|
||||
:command (revive-stream-clsr table))))
|
||||
(gui-goodies:attach-tooltips (delete-button (_ "delete selected stream"))
|
||||
(delete-button (_ "show selected stream")))
|
||||
(gui:grid table 0 0 :sticky :nwe)
|
||||
(gui:grid buttons-frame 1 0 :sticky :s)
|
||||
(gui:grid delete-button 0 0 :sticky :s))))
|
||||
(gui:grid delete-button 0 0 :sticky :s)
|
||||
(gui:grid revive-button 0 1 :sticky :s))))
|
||||
|
@ -70,7 +70,10 @@
|
||||
:+gemini-file-extension+
|
||||
;; GUI
|
||||
:+minimum-padding+
|
||||
:+ps-file-dialog-filter+))
|
||||
:+ps-file-dialog-filter+
|
||||
:+stream-status-streaming+
|
||||
:+stream-status-canceled+
|
||||
:+stream-status-downloading+))
|
||||
|
||||
(defpackage :conditions
|
||||
(:use :cl
|
||||
@ -3321,6 +3324,7 @@
|
||||
:*up*
|
||||
:*document-delete*
|
||||
:*document-add*
|
||||
:*document-accept*
|
||||
:*folder*))
|
||||
|
||||
(defpackage :validation
|
||||
|
Loading…
x
Reference in New Issue
Block a user