Closed pbor closed 3 months ago
I know a gir rework is ongoing, so I am not sure if refactoring PRs makes sense.
The reason for this is to tackle https://github.com/gtk-rs/gtk-rs-core/issues/975 by adding a new generate_default = false
flag to Gir.toml, but before adding it I figured I would submit the refactoring
gtk3 fails because it has
impl Default for RadioButton {
fn default() -> Self {
Self::new()
}
}
which is now generated... on the one hand I guess it is a good thing we can drop manual code, on the other it is not clear to me why this was not happening before :)
Would be nice to land this. But it needs PRs in at least 2 out of gtk-rs-core/gstreamer-rs/gtk4-rs with the resulting changes.
I looked at this again, and I do not think the PR is correct: the old code generated the fallback Object::new()
constructor only if new
was found (and was not hidden etc).
To make it correct we would have to remove the "0 args" check in the generic code, but that would defeat the point of centralizing this logic.
Move the detection of a default constructor function in the analysis. Move the logic about using Object::new into object.