'Making a clickable box in GTK4

How can I make a gtk4::Box clickable in gtk_rs?

In GTK3 it seems that using an EventBox was the way to achieve this, however in GTK4:

Stop using GtkEventBox

GtkEventBox is no longer needed and has been removed.

All widgets receive all events.

https://docs.gtk.org/gtk4/migrating-3to4.html#stop-using-gtkeventbox

So it seems that click handlers should now be attached to widgets directly. However I can't find any clear documentation or examples on how to do this.

If someone could give me an example of attaching a click listener to a gtk4::Box it would be much appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source