1
0
Fork 0

- [GUI] added button to subscribe to a gemlog from gemlog window.

This commit is contained in:
cage 2024-08-25 10:53:50 +02:00
parent 34d639e094
commit 29afea2b36
1 changed files with 24 additions and 2 deletions

View File

@ -110,6 +110,23 @@
(let ((new-rows (all-rows)))
(resync-rows gemlog-frame new-rows)))))
(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)))))
(defun open-gemlog-clsr (main-window treeview-gemlogs)
(lambda (e)
(declare (ignore e))
@ -181,6 +198,10 @@
(gui:with-toplevel (toplevel :master master :title (_ "Gemlogs"))
(let* ((table (make-instance 'gemlog-frame :master toplevel))
(buttons-frame (make-instance 'gui:frame :master toplevel))
(subscribe-button (make-instance 'gui:button
:master buttons-frame
:image icons:*document-add*
:command (subscribe-gemlog-clsr table)))
(unsubscribe-button (make-instance 'gui:button
:master buttons-frame
:image icons:*document-delete*
@ -194,8 +215,9 @@
(refresh-button (_ "refresh all subscription")))
(gui:grid table 0 0 :sticky :nwe)
(gui:grid buttons-frame 1 0 :sticky :s)
(gui:grid unsubscribe-button 0 0 :sticky :s)
(gui:grid refresh-button 0 1 :sticky :s)
(gui:grid subscribe-button 0 0 :sticky :s)
(gui:grid unsubscribe-button 0 1 :sticky :s)
(gui:grid refresh-button 0 2 :sticky :s)
(gui:bind (gui:treeview (gui-goodies:tree table))
#$<<TreeviewSelect>>$
(open-gemlog-clsr main-window table))