files-view: display search base for file chooser

Currently when the move to/copy to file chooser dialog is launched
during search, the dialog shows an error as the location is invalid.

Change this so that the base of the search is displayed in the dialog
when this dialog is launched while searching.

https://bugzilla.gnome.org/show_bug.cgi?id=778113
This commit is contained in:
Alexandru Pandelea 2017-03-20 01:11:02 +02:00
parent b9c40a0332
commit b57d5923d7

View file

@ -5949,6 +5949,7 @@ copy_or_move_selection (NautilusFilesView *view,
CopyCallbackData *copy_data;
GList *selection;
const gchar *title;
NautilusDirectory *directory;
priv = nautilus_files_view_get_instance_private (view);
@ -6000,7 +6001,17 @@ copy_or_move_selection (NautilusFilesView *view,
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
}
uri = nautilus_directory_get_uri (priv->model);
if (nautilus_view_is_searching (NAUTILUS_VIEW (view)))
{
directory = nautilus_search_directory_get_base_model (NAUTILUS_SEARCH_DIRECTORY (priv->model));
uri = nautilus_directory_get_uri (directory);
}
else
{
uri = nautilus_directory_get_uri (priv->model);
}
gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dialog), uri);
g_free (uri);
g_signal_connect (dialog, "current-folder-changed",