[nautilus/merge-requests/10] directory: Treat as empty if no file is to be shown



commit e79512a96e087aa80cf2b01d2727f90f10c020f7
Author: António Fernandes <antoniojpfernandes+gitlab gnome org gmail com>
Date:   Thu Oct 19 22:25:32 2017 +0000

    directory: Treat as empty if no file is to be shown
    
    Directory is reported as not empty if it has files, even if all of them
    are hidden and not shown.
    
    As nautilus_list_model relies on this information to label expanded
    subdirectories as empty, the dummy row is stuck on "loading..." if
    subdirectory contains only hidden files and they are not to be shown.
    
    Instead, a directory should be reported as not empty only if we any of
    its files are to be shown.
    
    Fixes https://gitlab.gnome.org/GNOME/nautilus/issues/39

 src/nautilus-directory.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-directory.c b/src/nautilus-directory.c
index ad3bb03..8231853 100644
--- a/src/nautilus-directory.c
+++ b/src/nautilus-directory.c
@@ -81,7 +81,17 @@ real_are_all_files_seen (NautilusDirectory *directory)
 static gboolean
 real_is_not_empty (NautilusDirectory *directory)
 {
-    return directory->details->file_list != NULL;
+    gboolean show_hidden_files;
+    gboolean empty;
+    GList *files;
+
+    show_hidden_files = g_settings_get_boolean (gtk_filechooser_preferences,
+                                                NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
+    files = nautilus_file_list_filter_hidden (directory->details->file_list, show_hidden_files);
+    empty = (files == NULL);
+    nautilus_file_list_unref (files);
+
+    return !empty;
 }
 
 static gboolean


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