[baobab] Use always URIs for excluded locations



commit 8849933423b233bb0ac0d09bee7a8b5f1272b007
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Wed Jul 1 19:07:11 2020 +0200

    Use always URIs for excluded locations
    
    Converting to GFile makes the comparison unreliable for network locations
    because the GFile reconstructed from the URI has NULL path.

 src/baobab-application.vala | 7 +++----
 src/baobab-scanner.vala     | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/baobab-application.vala b/src/baobab-application.vala
index 32238ec..9df2bcf 100644
--- a/src/baobab-application.vala
+++ b/src/baobab-application.vala
@@ -66,13 +66,12 @@ namespace Baobab {
             return (Application) GLib.Application.get_default ();
         }
 
-        public GenericSet<File> get_excluded_locations () {
-            var excluded_locations = new GenericSet<File> (File.hash, File.equal);
+        public GenericSet<string> get_excluded_locations () {
+            var excluded_locations = new GenericSet<string> (str_hash, str_equal);
 
             var prefs_settings = new Settings ("org.gnome.baobab.preferences");
             foreach (var uri in prefs_settings.get_strv ("excluded-uris")) {
-                var file = File.new_for_uri (uri);
-                excluded_locations.add (file);
+                excluded_locations.add (uri);
             }
 
             return excluded_locations;
diff --git a/src/baobab-scanner.vala b/src/baobab-scanner.vala
index ae19774..9f8f57a 100644
--- a/src/baobab-scanner.vala
+++ b/src/baobab-scanner.vala
@@ -115,7 +115,7 @@ namespace Baobab {
         uint process_result_idle = 0;
 
         GenericSet<HardLink> hardlinks;
-        GenericSet<File> excluded_locations;
+        GenericSet<string> excluded_locations;
         uint32 unix_device = 0;
 
         bool successful = false;
@@ -264,7 +264,7 @@ namespace Baobab {
             var results_array = new ResultsArray ();
 
             var current_unix_device = info.get_attribute_uint32 (FileAttribute.UNIX_DEVICE);
-            if (directory in excluded_locations ||
+            if (directory.get_uri () in excluded_locations ||
                 (ScanFlags.EXCLUDE_MOUNTS in scan_flags && current_unix_device != unix_device)) {
                 return null;
             }


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