From 28dd203d02317e6f5da7d7655ab4a5db6a571e5f Mon Sep 17 00:00:00 2001 From: Alexandru Pandelea Date: Mon, 20 Mar 2017 01:11:02 +0200 Subject: 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 --- src/nautilus-files-view.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c index 0bb513ee6..a305ef873 100644 --- a/src/nautilus-files-view.c +++ b/src/nautilus-files-view.c @@ -5956,6 +5956,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); @@ -6007,7 +6008,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", -- cgit v1.2.1