How to use `file_dialog.filenames()` in GTK 4 (rust)?

Hi,
Recently I wanted to change file_chooser.filenames() in GTK 3 to GTK 4 version which simply return Vec<PathBuf>.
Looks that something like

            let list_model = file_chooser.files().unwrap();
            let item = list_model.item(0).unwrap();

should work(item is Object of GLocalFile type) but I don’t know what to do later with it. How can I get path string from this Object?

The list model returned by filenames() contain implementations of the gio.File interface. If you want a file system path out of a gio.File you want to use gio.File.path().

1 Like

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