Gtk-rs gtk4::FileChooserNative tutorial

Hey Guys,
can someone tell me how to use the FileChooserNative. I didn’t managed to get the informations from the C tutorial.
Now my code looks like this

 let open_dialog = FileChooserNative::new(
        Some("choose your File"),

Thank You

What’s the problem you’re running into? The video player example from the gtk4-rs repository is making use of it, if that helps.

1 Like

Thank you for your quick response. I’m quite a newbie to gtk and I don’t know how to connect to this signal or to get the response on another way.

See here in the example or here in the docs.

Note that you have to keep the dialog alive somehow until the response has happened as it’s a native dialog and not a proper GTK window (which are kept alive by GTK).

Now it works! Thank you!

    open_button.connect_clicked(move |button| {
        open_dialog.connect_response(move |d, response| {
            if response == ResponseType::Accept {...}
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.