Skip to content

Commit 2aff318

Browse files
committed
Match the GTK file filters with the new spec.
1 parent da8d151 commit 2aff318

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ You can find its changes [documented below](#060---2020-06-01).
1919

2020
### Fixed
2121

22+
- GTK: Directory selection now properly ignores file filters. ([#957] by [@xStrom])
23+
2224
### Visual
2325

2426
- `TextBox` stroke remains inside its `paint_rect`. ([#1007] by [@jneem])
@@ -295,6 +297,7 @@ Last release without a changelog :(
295297
[#951]: https://github.com/xi-editor/druid/pull/951
296298
[#953]: https://github.com/xi-editor/druid/pull/953
297299
[#954]: https://github.com/xi-editor/druid/pull/954
300+
[#957]: https://github.com/xi-editor/druid/pull/957
298301
[#959]: https://github.com/xi-editor/druid/pull/959
299302
[#961]: https://github.com/xi-editor/druid/pull/961
300303
[#963]: https://github.com/xi-editor/druid/pull/963

druid-shell/src/platform/gtk/dialog.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ pub(crate) fn get_file_dialog_path(
5353

5454
dialog.set_show_hidden(options.show_hidden);
5555

56-
dialog.set_select_multiple(options.multi_selection);
56+
if action != FileChooserAction::Save {
57+
dialog.set_select_multiple(options.multi_selection);
58+
}
5759

5860
// Don't set the filters when showing the folder selection dialog,
5961
// because then folder traversing won't work.
@@ -76,15 +78,9 @@ pub(crate) fn get_file_dialog_path(
7678
}
7779
}
7880

79-
if let Some(default_file_type) = &options.default_type {
80-
if options.allowed_types.is_some() && !found_default_filter {
81-
// It's ok to set a default file filter without providing a list of
82-
// allowed filters, but it's not ok (or at least, doesn't work in gtk)
83-
// to provide a default filter that isn't in the (present) list
84-
// of allowed filters.
85-
log::warn!("default file type not found in allowed types");
86-
} else if !found_default_filter {
87-
dialog.set_filter(&file_filter(default_file_type));
81+
if let Some(dt) = &options.default_type {
82+
if !found_default_filter {
83+
log::warn!("The default type {:?} is not present in allowed types.", dt);
8884
}
8985
}
9086
}

0 commit comments

Comments
 (0)