simplify prefs getChildrenOf

GTK4 widgets are iterable.
This commit is contained in:
abakkk 2021-04-26 12:00:16 +02:00
parent 25e1f27ac9
commit 92b8bddb6b
1 changed files with 3 additions and 12 deletions

View File

@ -65,19 +65,10 @@ const setAccessibleDescription = function(widget, description) {
}; };
const getChildrenOf = function(widget) { const getChildrenOf = function(widget) {
if (IS_GTK3) { if (IS_GTK3)
return widget.get_children(); return widget.get_children();
} else { else
let listModel = widget.observe_children(); return [...widget];
let i = 0;
let children = [];
let child;
while (!!(child = listModel.get_item(i))) {
children.push(child);
i++;
}
return children;
}
}; };
function init() { function init() {