Skip to content

overrides/Gtk: Make GTK4 widgets iteratable

Florian Müllner requested to merge fmuellner/gjs:iterable-widgets into master

GTK4 removed the Gtk.Container interface, and added API on Gtk.Widget to iterate over children instead. While that API is perfectly fine to use from javascript, implementing the iterable protocol allows for a more idiomatic use like

  for (let child of widget)
      doStuff(child);

and also provides a convenient replacement for the removed get_children() method:

  const children = [...widget];

Merge request reports