AaronErhardt / AaronErhardt.github.io

My personal blog
https://aaronerhardt.github.io
3 stars 4 forks source link

add chapter 'Returned widget' #59

Closed tronta closed 2 years ago

tronta commented 2 years ago

First draft of an additional chapter to describe the returned widget feature of the macro.

What do you think? Probably an own example would be better… Do you have an example for an optional widget? Did you implement that? I forgot.

AaronErhardt commented 2 years ago

Thanks! Looks good.

Actually, there might not be any optional widgets anymore because gtk-rs decided to trust the nullability guarantees of C implementations. In other words, they will trust the C code that it catches null pointers and therefore the bindings can replace Option<T> with T. For us this means no optional returned widgets AFAIK. The syntax still exists and should be documented, but it will be enough to just leave a note, that Option<Widget> can be handled by -> ? { ... }

You can also see the change from the latest update of the libadwaita dependency: https://github.com/AaronErhardt/Relm4/commit/5674e1f5c0abc6afa4ea58b303dbae6db56bc90d#diff-f54b40e447a67dab371dd5913ec90fe6daac60a5558891c738a942f93461a1d0R94-R104

tronta commented 2 years ago

Do you know, what's the difference between set_label and set_title?

tronta commented 2 years ago

btw I stole the screenshot from the Adwaita Demo app, that's why I did not change it's content…

AaronErhardt commented 2 years ago

Perfect, thanks again!