gtk-rs / gtk4-rs

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

New and with_type methods as in gtk-rs-core #1384

Open ranfdev opened 1 year ago

ranfdev commented 1 year ago

In general, we should provide typed methods when possible and with_type variants.

Example: Widget::ancestor(widget, type) (which currently returns a Option<Widget>) could become Widget::ancestor::<gtk::Label>(widget) and directly return a typed Option<Label>.

bilelmoussaoui commented 1 year ago

Would be nice to gather a list of methods that could make use of such changes.

jf2048 commented 1 year ago

I counted these:

gdk4::ContentFormats::for_type gdk4::ContentFormats::contains_type gdk4::ContentFormatsBuilder::add_type gdk4::ContentProviderExtManual::value gtk4::DropTarget::new gtk4::WidgetExt::ancestor

bilelmoussaoui commented 1 year ago

More can be found in https://github.com/search?q=repo%3Agtk-rs%2Fgtk4-rs%20%20glib%3A%3Atypes%3A%3AType&type=code