I’m really stuck here trying to find an example of how to use Gtk FileDialog in Rust.
All I’m trying to implement is a simple File/Open action.
The documentation for GtkFileDialog, says use gtk_file_dialog_open
and gtk_file_dialog_open_finish
, but there appears to be no implementation of gtk_file_dialog_open_finish
in the Rust bindings.
If I just use a simple call back such as
let closure = | result: Result<File, _>| {
match result {
Ok(file) => {
if let Some(path) = file.path() {
let s = path.to_str();
if let Some(s) = s {
&buffer.clear();
&buffer.push_str(s);
}
};
}
_ => {}
};
};
The compiler naturally objects because may outlive borrowed value `buffer`
type stuff, which is true.
Is there some example anywhere of how to actually do this. I assume it needs some magical async stuff, but that sort of conflicts with Gtk not actually being thread safe.