Skip to content

list-base: Set selection directly in select_first

Corey Berla requested to merge wip/corey/select_first into master

Prior to the gtk4 port (and the introduction of list-base, canvas view and list view set the selection directly in select_first through icon_set_selected and gtk_tree_selection_select_iter.

After the port to gtk4, list-base used the existing function nautilus_view_set_selection which seemed to work, except nautilus_files_view_set_selection only actually sets the selection when the view is not loading. In the meantime, it puts the selection is a pending_selection to be set when the loading is complete.

This causes problems for search because loading generally takes longer to complete in a search, and the user will have to wait until the search is complete for the item to be selected. As a matter of fact, the only time that select_first is used is during a search (which was the original intention of the function when introduced in 50711e28).

There's no need to add further complexity, beyond what the GtkSelectionModel already provides. Just as real_select_all simples calls gtk_selection_model_select_all, make real_select_first call gtk_selection_model_select_item.

Fixes: #2481 (closed)

Merge request reports