[baobab/reroot-view: 33/35] Report progress also for item number



commit cce55f10035fb8147c7b12300456703b9ff9a880
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Fri Jun 26 16:17:42 2020 +0200

    Report progress also for item number

 src/baobab-folder-display.vala | 6 ++++--
 src/baobab-scanner.vala        | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/baobab-folder-display.vala b/src/baobab-folder-display.vala
index 974e43c..e9131be 100644
--- a/src/baobab-folder-display.vala
+++ b/src/baobab-folder-display.vala
@@ -58,9 +58,11 @@ namespace Baobab {
 
                 location_progress_handler = location_.progress.connect (() => {
                     Gtk.TreeIter iter;
-                    list_store.set (iter, Scanner.Columns.SIZE, location_.scanner.total_size);
+                    list_store.get_iter_first (out iter);
+                    list_store.set (iter,
+                            Scanner.Columns.SIZE, location_.scanner.total_size,
+                            Scanner.Columns.ELEMENTS, location_.scanner.total_elements);
                 });
-
             }
 
             get {
diff --git a/src/baobab-scanner.vala b/src/baobab-scanner.vala
index 1c3d07c..ae19774 100644
--- a/src/baobab-scanner.vala
+++ b/src/baobab-scanner.vala
@@ -55,6 +55,7 @@ namespace Baobab {
 
         // Used for progress reporting, should be updated whenever a new Results object is created
         public uint64 total_size { get; private set; }
+        public int total_elements { get; private set; }
 
         public int max_depth { get; protected set; }
 
@@ -247,6 +248,7 @@ namespace Baobab {
 
                         var child_results = new Results (child_info, results);
                         total_size += child_results.size;
+                        total_elements++;
                         results.update_with_child (child_results);
                         results_array.results += (owned) child_results;
                         break;
@@ -269,6 +271,7 @@ namespace Baobab {
 
             var results = new Results (info, parent);
             total_size += results.size;
+            total_elements++;
 
             try {
                 add_children (directory, results, results_array);
@@ -417,6 +420,7 @@ namespace Baobab {
             cancellable.reset ();
             scan_error = null;
             total_size = 0;
+            total_elements = 0;
         }
 
         public void scan (bool force) {


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