[nautilus/wip/antoniof/local_vs_native_fixup: 157/157] file, directory: Drop obsolete is_local() methods




commit 0ef58574db756b0dd275b6669dbcb2968ae48e60
Author: António Fernandes <antoniof gnome org>
Date:   Mon May 11 12:57:42 2020 +0100

    file,directory: Drop obsolete is_local() methods
    
    They are plain wrappers for g_file_is_native(), and, after the previous
    commits, there are only two usages, which are found in:
    
    * window-slot.c, introduced in b3a4eabf01a57b860ea95155f608f33fd08cce27
    * files-view.c, introduced in f98d2edb0a71c58127e23a05d58bd12842b57132
    
    In both cases, we can just call g_file_is_native() directly. This way,
    we can drop the chronically-misinterpretted is_local() methods, whose
    various interpretations are now covered by specific checking methods:
    
    * g_file_is_native()
    * nautilus_file_has_local_path()
    * !nautilus_file_is_remote()

 src/nautilus-directory.c   | 13 -------------
 src/nautilus-directory.h   |  2 --
 src/nautilus-file.c        | 13 ++++---------
 src/nautilus-file.h        |  2 --
 src/nautilus-window-slot.c |  2 +-
 5 files changed, 5 insertions(+), 27 deletions(-)
---
diff --git a/src/nautilus-directory.c b/src/nautilus-directory.c
index 89d3756b4..527b6bf93 100644
--- a/src/nautilus-directory.c
+++ b/src/nautilus-directory.c
@@ -774,19 +774,6 @@ nautilus_directory_new (GFile *location)
  * Returns: %TRUE if a local path is known to be obtainable for all files in
  *          this directory. Otherwise, %FALSE.
  */
-gboolean
-nautilus_directory_is_local (NautilusDirectory *directory)
-{
-    g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), FALSE);
-
-    if (directory->details->location == NULL)
-    {
-        return TRUE;
-    }
-
-    return g_file_is_native (directory->details->location);
-}
-
 gboolean
 nautilus_directory_is_local_or_fuse (NautilusDirectory *directory)
 {
diff --git a/src/nautilus-directory.h b/src/nautilus-directory.h
index 774514b1d..70317a30e 100644
--- a/src/nautilus-directory.h
+++ b/src/nautilus-directory.h
@@ -222,8 +222,6 @@ GList *            nautilus_directory_match_pattern            (NautilusDirector
  */
 gboolean           nautilus_directory_are_all_files_seen       (NautilusDirectory         *directory);
 
-/* Return true if the directory is local. */
-gboolean           nautilus_directory_is_local                 (NautilusDirectory         *directory);
 gboolean           nautilus_directory_is_local_or_fuse         (NautilusDirectory         *directory);
 
 gboolean           nautilus_directory_is_in_trash              (NautilusDirectory         *directory);
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 737e64762..58dc59b64 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -2361,14 +2361,6 @@ nautilus_file_compare_location (NautilusFile *file_1,
     return (gint) res;
 }
 
-gboolean
-nautilus_file_is_local (NautilusFile *file)
-{
-    g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
-
-    return nautilus_directory_is_local (file->details->directory);
-}
-
 /**
  * nautilus_file_has_local_path:
  *
@@ -5988,10 +5980,13 @@ nautilus_file_can_get_permissions (NautilusFile *file)
 gboolean
 nautilus_file_can_set_permissions (NautilusFile *file)
 {
+    g_autoptr (GFile) location = NULL;
     uid_t user_id;
 
+    location = nautilus_file_get_location (file);
+
     if (file->details->uid != -1 &&
-        nautilus_file_is_local (file))
+        g_file_is_native (location))
     {
         /* Check the user. */
         user_id = geteuid ();
diff --git a/src/nautilus-file.h b/src/nautilus-file.h
index 7168a453e..0cd55dc6a 100644
--- a/src/nautilus-file.h
+++ b/src/nautilus-file.h
@@ -419,8 +419,6 @@ char *                  nautilus_file_get_string_attribute_with_default_q (Nauti
 gboolean                nautilus_file_matches_uri                       (NautilusFile                   
*file,
                                                                         const char                     *uri);
 
-/* Is the file local? */
-gboolean                nautilus_file_is_local                          (NautilusFile                   
*file);
 gboolean                nautilus_file_has_local_path                    (NautilusFile                   
*file);
 
 /* Comparing two file objects for sorting */
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index b5ff00008..6ba32cf03 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -1362,7 +1362,7 @@ check_force_reload (GFile                      *location,
     }
     else
     {
-        force_reload = !nautilus_directory_is_local (directory);
+        force_reload = !g_file_is_native (location);
     }
 
     /* We need to invalidate file attributes as well due to how mounting works


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