feat: use rfd for native file dialogs
This commit is contained in:
parent
94562b995a
commit
42a6e50349
3 changed files with 473 additions and 16 deletions
23
src/main.rs
23
src/main.rs
|
@ -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));
|
||||
}
|
||||
}
|
||||
));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue