[nautilus] files-view: Remove new empty folder name suggestion



commit 4d3a2978599ba0346f67777f0919673d0f08d864
Author: Alexandru Fazakas <alex fazakas97 yahoo com>
Date:   Mon Feb 19 17:33:27 2018 +0200

    files-view: Remove new empty folder name suggestion
    
    When we choose to create a new empty folder, while selecting one or more
    folders, Nautilus offers as suggestion the common filename prefix. In the case
    of one selected folder, the suggestion is the name of the folder.
    
    In this patch, we changed this so the common filename is displayed only in the
    "with selection" case.
    
    Fixes https://gitlab.gnome.org/GNOME/nautilus/issues/206

 src/nautilus-files-view.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index f4cc4a791..e445a6dac 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -2030,9 +2030,8 @@ static void
 nautilus_files_view_new_folder_dialog_new (NautilusFilesView *view,
                                            gboolean           with_selection)
 {
-    NautilusDirectory *containing_directory;
+    g_autoptr (NautilusDirectory) containing_directory = NULL;
     NautilusFilesViewPrivate *priv;
-    GList *selection;
     g_autofree char *uri = NULL;
     g_autofree char *common_prefix = NULL;
 
@@ -2046,8 +2045,13 @@ nautilus_files_view_new_folder_dialog_new (NautilusFilesView *view,
     uri = nautilus_files_view_get_backing_uri (view);
     containing_directory = nautilus_directory_get_by_uri (uri);
 
-    selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
-    common_prefix = nautilus_get_common_filename_prefix (selection, MIN_COMMON_FILENAME_PREFIX_LENGTH);
+    if (with_selection)
+    {
+        GList *selection;
+        selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
+        common_prefix = nautilus_get_common_filename_prefix (selection, MIN_COMMON_FILENAME_PREFIX_LENGTH);
+        nautilus_file_list_free (selection);
+    }
 
     priv->new_folder_controller =
         nautilus_new_folder_dialog_controller_new (nautilus_files_view_get_containing_window (view),
@@ -2063,9 +2067,6 @@ nautilus_files_view_new_folder_dialog_new (NautilusFilesView *view,
                       "cancelled",
                       (GCallback) new_folder_dialog_controller_on_cancelled,
                       view);
-
-    nautilus_file_list_free (selection);
-    nautilus_directory_unref (containing_directory);
 }
 
 typedef struct


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