[nautilus] files-view: fix “extract to” dialog in search



commit 351dc4147d08fbd6072a47cba7e8a553dad28082
Author: Ernestas Kulik <ernestask gnome org>
Date:   Wed Aug 9 14:16:42 2017 +0300

    files-view: fix “extract to” dialog in search
    
    Currently, the file chooser dialog points to the base directory of the
    archive when selecting the location for decompression. This poses a
    problem when searching, as the file chooser is unable to display the
    directory. This commit fixes that by showing the file chooser at the
    base directory of the search.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783090

 src/nautilus-files-view.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 10e4a0c..b3ea595 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -6453,7 +6453,24 @@ extract_files_to_chosen_location (NautilusFilesView *view,
     gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
     gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
 
-    uri = nautilus_directory_get_uri (priv->model);
+    /* The file chooser will not be able to display the search directory,
+     * so we need to get the base directory of the search if we are, in fact,
+     * in search.
+     */
+    if (nautilus_view_is_searching (NAUTILUS_VIEW (view)))
+    {
+        NautilusSearchDirectory *search_directory;
+        NautilusDirectory *directory;
+
+        search_directory = NAUTILUS_SEARCH_DIRECTORY (priv->model);
+        directory = nautilus_search_directory_get_base_model (search_directory);
+        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);
 
     data->view = view;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]