mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-17 15:40:12 +00:00
filechooser: Don't automatically select a file
When the folder changes, do not select the first item in the list, so if the user enters a folder and then clicks the accept button, the current folder is returned instead of the selected one. To maintain consistency with the previous implementation, when a folder in the path bar is clicked the previously-entered folder is selected, and when the file chooser is in open file mode the first item is always selected. See #5438
This commit is contained in:
parent
471ebabd77
commit
5a5a36151a
@ -2571,7 +2571,11 @@ set_select_multiple (GtkFileChooserWidget *impl,
|
||||
if (select_multiple)
|
||||
impl->selection_model = GTK_SELECTION_MODEL (gtk_multi_selection_new (model));
|
||||
else
|
||||
impl->selection_model = GTK_SELECTION_MODEL (gtk_single_selection_new (model));
|
||||
{
|
||||
impl->selection_model = GTK_SELECTION_MODEL (gtk_single_selection_new (model));
|
||||
gtk_single_selection_set_can_unselect (GTK_SINGLE_SELECTION (impl->selection_model), TRUE);
|
||||
gtk_single_selection_set_autoselect (GTK_SINGLE_SELECTION (impl->selection_model), FALSE);
|
||||
}
|
||||
|
||||
g_signal_connect (impl->selection_model, "selection-changed",
|
||||
G_CALLBACK (list_selection_changed), impl);
|
||||
@ -7289,6 +7293,9 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl)
|
||||
G_CALLBACK (list_items_changed), impl);
|
||||
|
||||
gtk_single_selection_set_model (GTK_SINGLE_SELECTION (impl->selection_model), G_LIST_MODEL (impl->sort_model));
|
||||
gtk_single_selection_set_can_unselect (GTK_SINGLE_SELECTION (impl->selection_model), TRUE);
|
||||
gtk_single_selection_set_autoselect (GTK_SINGLE_SELECTION (impl->selection_model), FALSE);
|
||||
|
||||
gtk_sort_list_model_set_model (impl->sort_model, G_LIST_MODEL (impl->filter_model));
|
||||
|
||||
gtk_column_view_set_model (GTK_COLUMN_VIEW (impl->browse_files_column_view), impl->selection_model);
|
||||
|
Loading…
Reference in New Issue
Block a user