diff --git a/src/gui/client/gemlog-window.lisp b/src/gui/client/gemlog-window.lisp index b6adaf7..5bc1b00 100644 --- a/src/gui/client/gemlog-window.lisp +++ b/src/gui/client/gemlog-window.lisp @@ -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)) #$<>$ (open-gemlog-clsr main-window table))