[nautilus/wip/antoniof/local_vs_native_fixup: 77/90] file: Correctly check for remoteness for speed tradeoffs




commit b3a6ec8293c5f47ac2ef6583e1627bcb85fba020
Author: António Fernandes <antoniof gnome org>
Date:   Wed May 13 01:27:33 2020 +0100

    file: Correctly check for remoteness for speed tradeoffs
    
    When the thumbnailing and/or item counting preference is 'local-only',
    we need to know if a file is local or remote, and for this we use the
    nautilus_file_is_local() method.
    
    However, ever since the port from gnome-vfs to GIO, this method relies
    on g_file_is_native() instead of gnome_vfs_uri_is_local(), which are
    not the same thing. Quoting the GIO docs:
    
    > A native file is one expressed in the platform-native filename
    > format, e.g. "C:\Windows" or "/usr/bin/". This does not mean the
    > file is local, as it might be on a locally mounted remote filesystem.
    
    So, nautilus_file_is_local() is no longer telling us the truth. This
    means we may show thumbnails or item counts for natively-mounted remote
    locations when we are not supposed to.
    
    Instead, let's use the nautilus_file_is_remote() method, which relies
    on the G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE attribute (which was not
    implemented at the time of the GIO port).
    
    Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/1478

 src/nautilus-file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 243470432..a9047d3de 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -4798,7 +4798,7 @@ nautilus_file_should_show_thumbnail (NautilusFile *file)
         else
         {
             /* only local files */
-            return nautilus_file_is_local (file);
+            return !nautilus_file_is_remote (file);
         }
     }
 
@@ -5702,7 +5702,7 @@ get_speed_tradeoff_preference_for_file (NautilusFile               *file,
     else
     {
         /* only local files */
-        return nautilus_file_is_local (file);
+        return !nautilus_file_is_remote (file);
     }
 }
 


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