[baobab/wip/vala: 6/41] change percentage calculation



commit 2868f046f17def9a8fc01fd78f4f67b5402eff12
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Jan 5 11:42:01 2012 -0500

    change percentage calculation
    
    Each directory percentage is supposed to be the percent it occupies of
    its parent size -- not the total size.

 src/baobab-scanner.vala |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/baobab-scanner.vala b/src/baobab-scanner.vala
index 2f80230..8a4968c 100644
--- a/src/baobab-scanner.vala
+++ b/src/baobab-scanner.vala
@@ -139,7 +139,7 @@ namespace Baobab {
 			return results;
 		}
 
-		void add_percent (uint64 total_size, Gtk.TreeIter? parent = null) {
+		void add_percent (uint64 parent_size, Gtk.TreeIter? parent = null) {
 			Gtk.TreeIter iter;
 
 			if (iter_children (out iter, parent)) {
@@ -147,9 +147,9 @@ namespace Baobab {
 					uint64 size;
 					get (iter, Columns.SIZE, out size);
 					set (iter,
-					     Columns.PERCENT, 100 * ((double) size) / ((double) total_size),
+					     Columns.PERCENT, 100 * ((double) size) / ((double) parent_size),
 					     Columns.STATE,   State.DONE);
-					add_percent (total_size, iter);
+					add_percent (size, iter);
 				} while (iter_next (ref iter));
 			}
 		}



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