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 May 29, 2020
1 parent 9b0dc4d commit b3dcda9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ This means that druid no longer requires cairo on macOS and uses Core Graphics i
- GTK: Support disabled menu items. ([#897] by [@jneem])
- X11: Support individual window closing. ([#900] by [@xStrom])
- X11: Support `Application::quit`. ([#900] by [@xStrom])
- GTK: Support file filters in open/save dialogs. ([#903] by [@jneem])
- GTK: Support file filters in open/save dialogs. ([#903] by [@jneem], [#957] by [@xStrom])
- GTK: Support DPI values other than 96. ([#904] by [@xStrom])
- Windows: Removed flashes of white background at the edge of the window when resizing. ([#915] by [@xStrom])
- Windows: Reduced chance of white flash when opening a new window. ([#916] by [@xStrom])
Expand Down Expand Up @@ -231,6 +231,7 @@ This means that druid no longer requires cairo on macOS and uses Core Graphics i
[#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 b3dcda9

Please sign in to comment.