gtk-rs / gtk4-rs

Rust bindings of GTK 4
https://gtk-rs.org/gtk4-rs/
MIT License
1.89k stars 174 forks source link

GtkLabel/GktEntry nullability checks #30

Closed bilelmoussaoui closed 4 years ago

bilelmoussaoui commented 4 years ago

Some functions can't return a nullable like GtkEntry::get_text(), we should check those and fix the Gir.toml accordingly.

sdroege commented 4 years ago

See also https://github.com/gtk-rs/gir/pull/970

sdroege commented 4 years ago

Also there were various PRs to gtk3 to fix those. Before starting to work on this you probably want to go through the gtk3 PRs and sync whatever still makes sense :)

sophie-h commented 4 years ago

I'm planning to bring gtk4 into the state that we can 'trust' the upstream nullable annotations. (Very first fixes are merged.)

However, the current version of this repo is not build with the gir version that supports trusting the nullable annotations. Can someone maybe check the code after updating the git submodules?

sdroege commented 4 years ago

Updating gir here should be fine and not cause any problems

sophie-h commented 4 years ago

@bilelmoussaoui GtkEntry::get_text() seems to be gone? But entry.get_buffer().get_text() should work without Options.

Will add a first PR after #31 is merged.

bilelmoussaoui commented 4 years ago

@bilelmoussaoui GtkEntry::get_text() seems to be gone? But entry.get_buffer().get_text() should work without Options.

Will add a first PR after #31 is merged.

My bad, I should have checked the API before creating the issue. But you have got the idea, it's mostly to ensure we are okay null-ability checks wise.

sdroege commented 4 years ago

However, the current version of this repo is not build with the gir version that supports trusting the nullable annotations.

That probably should wait until the gir-files are updated to GTK 3.99.3 or even newer as there are quite a few nullability fixes since the version we currently have.

bilelmoussaoui commented 4 years ago

I will try to get #34 ready as soon as possible so we can update the bindings & move things forward

sophie-h commented 4 years ago

My gtk4 fixes are all post 3.99.3. So, newer would be good.

Afterwards I will mark for every object if it needs upstream fixing, has a committed upstream fix or add trust_return_value_nullability if the result is okay.

bilelmoussaoui commented 4 years ago

@sophie-h the bindings were update to 3.99.3, feel free to submit your patches now :+1:

sophie-h commented 4 years ago

First fixes are in. I guess that's #68 now?

sdroege commented 4 years ago

Yeah let's continue discussions there