Hello everyone!
I’m a newbie to gtk4-rs (and rust itself) trying to figure out how to load gtk4-rs widgets via a Cambalache file. (I’m also a newbie to Cambalache :P, but I’m less intimidated by that since it seems similar enough to Glade, which itself seems to have tutorials I can follow online.)
I found out that if I want to be able to load GUIs using files with GTK 4 (specifically via the gtk4-rs bindings, in my case), I need to use certain functions to do so, but I’m not exactly sure how the surrounding code should be.
The introductory book to gtk4-rs doesn’t seem to cover that. I also checked the main.rs file of some FOSS projects online, but they didn’t seem to use the functionality I’m trying to use.
All I think I’ve narrowed it down to is that I need to use one of the following methods of the Builder struct.:
https ://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Builder.html#method.add_from_file
https ://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Builder.html#method.add_from_resource
https ://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Builder.html#method.add_from_string
https ://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Builder.html#method.add_objects_from_file
https ://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Builder.html#method.add_objects_from_resource
https ://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Builder.html#method.add_objects_from_string
https ://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Builder.html#method.from_file
https ://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Builder.html#method.from_string
So, could someone please show me one way this is done with a small, self-contained example?
Any input would be GREATLY appreciated!
P.S.
I put a space after https in the links because this website said a new user could only post up to two links, probably because it thinks I’m a spammer.