Skip to content

Commit b3dcda9

Browse files
committed
Match the GTK file filters with the new spec.
1 parent 9b0dc4d commit b3dcda9

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ This means that druid no longer requires cairo on macOS and uses Core Graphics i
103103
- GTK: Support disabled menu items. ([#897] by [@jneem])
104104
- X11: Support individual window closing. ([#900] by [@xStrom])
105105
- X11: Support `Application::quit`. ([#900] by [@xStrom])
106-
- GTK: Support file filters in open/save dialogs. ([#903] by [@jneem])
106+
- GTK: Support file filters in open/save dialogs. ([#903] by [@jneem], [#957] by [@xStrom])
107107
- GTK: Support DPI values other than 96. ([#904] by [@xStrom])
108108
- Windows: Removed flashes of white background at the edge of the window when resizing. ([#915] by [@xStrom])
109109
- Windows: Reduced chance of white flash when opening a new window. ([#916] by [@xStrom])
@@ -231,6 +231,7 @@ This means that druid no longer requires cairo on macOS and uses Core Graphics i
231231
[#951]: https://github.com/xi-editor/druid/pull/951
232232
[#953]: https://github.com/xi-editor/druid/pull/953
233233
[#954]: https://github.com/xi-editor/druid/pull/954
234+
[#957]: https://github.com/xi-editor/druid/pull/957
234235
[#959]: https://github.com/xi-editor/druid/pull/959
235236
[#961]: https://github.com/xi-editor/druid/pull/961
236237
[#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)