mirror of https://codeberg.org/cage/tinmop/
- [GUI] bound 'delete' key to a routine that delete a gempub.
This commit is contained in:
parent
42bbdfc6fb
commit
f7cb9a1a20
|
@ -153,10 +153,27 @@
|
||||||
(let* ((table (make-instance 'gempub-frame
|
(let* ((table (make-instance 'gempub-frame
|
||||||
:master toplevel
|
:master toplevel
|
||||||
:rows query-results)))
|
:rows query-results)))
|
||||||
(gui:grid table 0 0 :sticky :nwe)
|
(gui:grid table 0 0 :sticky :nwe)
|
||||||
(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))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue