It appears that the way to close a Gtk4 library is by closing all the windows. The gir based bindings only allow the closing of a single window.
https://docs.gtk.org/glib/type_func.List.foreach.html seems to be the way to go.
I want to pass to it the list of application windows and call the window-close function. Please critique my very naive attempt. Assuming my gtk4 functions are correct, how do I do the following in cffi?
(cffi:define-foreign-library libglib)
(cffi:use-foreign-library libglib)
(cffi:defcfun "g_list_foreach" :void
(list :pointer)
(func :pointer)
(user-data :pointer))
(cffi:foreign-funcall "g_list_foreach"
:pointer (gtk4:application-windows app)
:pointer #'gtk4:window-close
:pointer nil)
I built my app using https://github.com/bohonghuang/cl-gtk4 and added glib bindings to my fork. However, git introspection does not provide the way to do what I need.
possible solution
(loop for aw = (gtk4:application-active-window app)
until (null aw)
do (gtk4:window-close aw))