1
0
Fork 0

- [GUI] bound 'delete' key to a routine that delete a gempub.

This commit is contained in:
cage 2024-09-20 16:01:56 +02:00
parent 42bbdfc6fb
commit f7cb9a1a20
1 changed files with 18 additions and 1 deletions

View File

@ -157,6 +157,23 @@
(gui:bind (gui:treeview (gui-goodies:tree table)) (gui:bind (gui:treeview (gui-goodies:tree table))
#$<<TreeviewSelect>>$ #$<<TreeviewSelect>>$
(open-gempub-clsr main-window table)) (open-gempub-clsr main-window table))
(gui:bind (gui:treeview (gui-goodies:tree table))
#$<Delete>$
(lambda (event)
(declare (ignore event))
(with-accessors ((tree gui-goodies:tree)) table
(a:when-let* ((selection (a:first-elt (gui:treeview-get-selection tree)))
(delete (gui:ask-yesno (_ "Are you sure? This operation is irreversible.")
:title (_ "Attention")
:parent main-window))
(id (gui:id selection))
(row (cev:enqueue-request-and-wait-results :gempub-file-id->row
1
ev:+standard-event-priority+
id)))
(fs:delete-file-if-exists (row-path row))
(gui-goodies:info-operation-completed main-window)))))
(gui:focus (gui:treeview (gui-goodies:tree table))) (gui:focus (gui:treeview (gui-goodies:tree table)))
(gui:transient toplevel master)))) (gui:transient toplevel master))))