How to close all the visible window at once


I’m working on a GTK3 desktop application in C++. I’m building a multiwindow application. Is there a way to close all the window at once in GTK3?

One way is to maintain the List of windows ourselves, is there any other way to solve this?

If you’re using GtkApplication then the application instance already maintains the list of windows; you can use gtk_application_get_windows() to retrieve that list and iterate over it to close all the windows.

Thank you, this was helpful