feat: use rfd for native file dialogs

This commit is contained in:
uku 2025-05-12 11:24:49 +02:00
parent 94562b995a
commit 42a6e50349
Signed by: uku
SSH key fingerprint: SHA256:4P0aN6M8ajKukNi6aPOaX0LacanGYtlfjmN+m/sHY/o
3 changed files with 473 additions and 16 deletions

View file

@ -103,23 +103,14 @@ impl SimpleComponent for Tyrolienne {
file_picker_row.connect_activated(clone!(
#[strong]
sender,
#[strong]
root,
move |_| {
let file_dialog = gtk::FileDialog::new();
file_dialog.open(
Some(&root),
gio::Cancellable::NONE,
clone!(
#[strong]
sender,
move |file| {
if let Some(path) = file.ok().and_then(|f| f.path()) {
sender.input(Message::SetPath(path));
}
}
),
);
let file = rfd::FileDialog::new()
.add_filter("Video", &["mp4", "mkv", "webm"])
.pick_file();
if let Some(path) = file {
sender.input(Message::SetPath(path));
}
}
));