Skip to content

Commit

Permalink
rework!: consistent api naming (fluxxcode#229)
Browse files Browse the repository at this point in the history
* Remove deprecated methods

* Rename DialogState's and DialogMode's

* Rename selection methods

* Fix rustfmt errors

* Fix doctests

* Update changelog
  • Loading branch information
fluxxcode authored Jan 4, 2025
1 parent 65f8fa3 commit 6bf9b74
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 248 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# egui-file-dialog changelog

## Unreleased
### 🚨 Breaking Changes

- Removed deprecated methods `FileDialog::select_directory`, `FileDialog::select_file`, `FileDialog::select_multiple`, `FileDialog::overwrite_config`, `FileDialog::selected`, `FileDialog::take_selected`, `FileDialog::take_selected_multiple` [#229](https://github.com/fluxxcode/egui-file-dialog/pull/229)
- Renamed `DialogMode`'s: `SelectFile` -> `PickFile`, `SelectDirectory` -> `PickDirectory`, `SelectMultiple` -> `PickMultiple` [#229](https://github.com/fluxxcode/egui-file-dialog/pull/229)
- 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)

## 2024-12-17 - v0.8.0 - egui update, custom right panel and more

### 🚨 Breaking Changes
Expand Down
8 changes: 4 additions & 4 deletions examples/custom_right_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,25 @@ impl eframe::App for MyApp {

self.file_dialog
.update_with_right_panel_ui(ctx, &mut |ui, dia| {
if dia.mode() == DialogMode::SelectMultiple {
if dia.mode() == DialogMode::PickMultiple {
ui.heading("Selected items");
ui.separator();
egui::ScrollArea::vertical()
.max_height(ui.available_height())
.show(ui, |ui| {
for item in dia.active_selected_entries() {
for item in dia.selected_entries() {
ui.small(format!("{item:#?}"));
ui.separator();
}
});
} else {
ui.heading("Active item");
ui.small(format!("{:#?}", dia.active_entry()));
ui.small(format!("{:#?}", dia.selected_entry()));
}
});

match self.file_dialog.mode() {
DialogMode::SelectMultiple => {
DialogMode::PickMultiple => {
if let Some(items) = self.file_dialog.take_picked_multiple() {
self.picked_items = Some(items);
}
Expand Down
4 changes: 2 additions & 2 deletions examples/multiple_actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ impl eframe::App for MyApp {
if ui.button("Pick file a").clicked() {
let _ = self
.file_dialog
.open(DialogMode::SelectFile, true, Some("pick_a"));
.open(DialogMode::PickFile, true, Some("pick_a"));
}

if ui.button("Pick file b").clicked() {
let _ = self
.file_dialog
.open(DialogMode::SelectFile, true, Some("pick_b"));
.open(DialogMode::PickFile, true, Some("pick_b"));
}

ui.label(format!("Pick file a: {:?}", self.picked_file_a));
Expand Down
6 changes: 3 additions & 3 deletions examples/sandbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ impl eframe::App for MyApp {

if let Some(path) = self.file_dialog.take_picked() {
match self.file_dialog.mode() {
DialogMode::SelectDirectory => self.picked_directory = Some(path),
DialogMode::SelectFile => self.picked_file = Some(path),
DialogMode::PickDirectory => self.picked_directory = Some(path),
DialogMode::PickFile => self.picked_file = Some(path),
DialogMode::SaveFile => self.saved_file = Some(path),
DialogMode::SelectMultiple => {}
DialogMode::PickMultiple => {}
}
}

Expand Down
Loading

0 comments on commit 6bf9b74

Please sign in to comment.