Skip to content

Commit

Permalink
Match the GTK file filters with the new spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
xStrom committed Jun 6, 2020
1 parent da8d151 commit 2aff318
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ You can find its changes [documented below](#060---2020-06-01).

### Fixed

- GTK: Directory selection now properly ignores file filters. ([#957] by [@xStrom])

### Visual

- `TextBox` stroke remains inside its `paint_rect`. ([#1007] by [@jneem])
Expand Down Expand Up @@ -295,6 +297,7 @@ Last release without a changelog :(
[#951]: https://github.com/xi-editor/druid/pull/951
[#953]: https://github.com/xi-editor/druid/pull/953
[#954]: https://github.com/xi-editor/druid/pull/954
[#957]: https://github.com/xi-editor/druid/pull/957
[#959]: https://github.com/xi-editor/druid/pull/959
[#961]: https://github.com/xi-editor/druid/pull/961
[#963]: https://github.com/xi-editor/druid/pull/963
Expand Down
16 changes: 6 additions & 10 deletions druid-shell/src/platform/gtk/dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ pub(crate) fn get_file_dialog_path(

dialog.set_show_hidden(options.show_hidden);

dialog.set_select_multiple(options.multi_selection);
if action != FileChooserAction::Save {
dialog.set_select_multiple(options.multi_selection);
}

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

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

0 comments on commit 2aff318

Please sign in to comment.