diff --git a/CHANGELOG.md b/CHANGELOG.md index a385b9ef..33255d0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Renamed `DialogState`'s: `Selected` -> `Picked`, `SelectedMultiple` -> `PickedMultiple` [#229](https://github.com/fluxxcode/egui-file-dialog/pull/229) - Renamed `active_entry` -> `selected_entry` [#229](https://github.com/fluxxcode/egui-file-dialog/pull/229) - Renamed `active_selected_entries` -> `selected_entries` [#229](https://github.com/fluxxcode/egui-file-dialog/pull/229) +- Removed result from `FileDialog::open` [#242](https://github.com/fluxxcode/egui-file-dialog/pull/242) #### Breaking changes due to new features and updated configuration - Added `file_system` to `FileDialogConfig` [#227](https://github.com/fluxxcode/egui-file-dialog/pull/227) diff --git a/examples/multiple_actions.rs b/examples/multiple_actions.rs index 71cb2573..c998459b 100644 --- a/examples/multiple_actions.rs +++ b/examples/multiple_actions.rs @@ -25,14 +25,12 @@ impl eframe::App for MyApp { fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { egui::CentralPanel::default().show(ctx, |ui| { if ui.button("Pick file a").clicked() { - let _ = self - .file_dialog + self.file_dialog .open(DialogMode::PickFile, true, Some("pick_a")); } if ui.button("Pick file b").clicked() { - let _ = self - .file_dialog + self.file_dialog .open(DialogMode::PickFile, true, Some("pick_b")); } diff --git a/src/file_dialog.rs b/src/file_dialog.rs index 41fd7d2f..e5eb1c10 100644 --- a/src/file_dialog.rs +++ b/src/file_dialog.rs @@ -10,7 +10,6 @@ use crate::modals::{FileDialogModal, ModalAction, ModalState, OverwriteFileModal use crate::{FileSystem, NativeFileSystem}; use egui::text::{CCursor, CCursorRange}; use std::fmt::Debug; -use std::io; use std::path::{Path, PathBuf}; use std::sync::Arc; @@ -310,12 +309,7 @@ impl FileDialog { /// } /// } /// ``` - pub fn open( - &mut self, - mode: DialogMode, - mut show_files: bool, - operation_id: Option<&str>, - ) -> io::Result<()> { + pub fn open(&mut self, mode: DialogMode, mut show_files: bool, operation_id: Option<&str>) { self.reset(); self.refresh(); @@ -348,9 +342,6 @@ impl FileDialog { .map_or_else(|| egui::Id::new(self.get_window_title()), |id| id); self.load_directory(&self.get_initial_directory()); - - // TODO: Dont return a result from this method - Ok(()) } /// Shortcut function to open the file dialog to prompt the user to pick a directory. @@ -361,7 +352,7 @@ impl FileDialog { /// /// The function ignores the result of the initial directory loading operation. pub fn pick_directory(&mut self) { - let _ = self.open(DialogMode::PickDirectory, false, None); + self.open(DialogMode::PickDirectory, false, None); } /// Shortcut function to open the file dialog to prompt the user to pick a file. @@ -370,7 +361,7 @@ impl FileDialog { /// /// The function ignores the result of the initial directory loading operation. pub fn pick_file(&mut self) { - let _ = self.open(DialogMode::PickFile, true, None); + self.open(DialogMode::PickFile, true, None); } /// Shortcut function to open the file dialog to prompt the user to pick multiple @@ -380,7 +371,7 @@ impl FileDialog { /// /// The function ignores the result of the initial directory loading operation. pub fn pick_multiple(&mut self) { - let _ = self.open(DialogMode::PickMultiple, true, None); + self.open(DialogMode::PickMultiple, true, None); } /// Shortcut function to open the file dialog to prompt the user to save a file. @@ -389,7 +380,7 @@ impl FileDialog { /// /// The function ignores the result of the initial directory loading operation. pub fn save_file(&mut self) { - let _ = self.open(DialogMode::SaveFile, true, None); + self.open(DialogMode::SaveFile, true, None); } /// The main update method that should be called every frame if the dialog is to be visible.