Closed fluxxcode closed 6 months ago
Implemented persistent storage with FileDialog::storage_mut to save and load the pinned folders.
FileDialog::storage_mut
This requires the new persistence feature, which implements serde::Serialize and serde::Deserialize for the objects to be saved.
persistence
serde::Serialize
serde::Deserialize
Example:
struct MyApp { file_dialog: FileDialog, } impl MyApp { pub fn new(cc: &eframe::CreationContext) -> Self { let mut file_dialog = FileDialog::new(); // Load the file dialog storage if let Some(storage) = cc.storage { *file_dialog.storage_mut() = eframe::get_value(storage, "file_dialog_storage").unwrap_or_default() } Self { file_dialog, } } } impl eframe::App for MyApp { fn save(&mut self, storage: &mut dyn eframe::Storage) { // Save the file dialog storage eframe::set_value(storage, "file_dialog_storage", self.file_dialog.storage_mut()); }
Ref: https://github.com/fluxxcode/egui-file-dialog/issues/42
Implemented persistent storage with
FileDialog::storage_mut
to save and load the pinned folders.This requires the new
persistence
feature, which implementsserde::Serialize
andserde::Deserialize
for the objects to be saved.Example:
Ref: https://github.com/fluxxcode/egui-file-dialog/issues/42