[baobab/wip/vala: 27/39] Use the STANDARD_ALLOCATED_SIZE file attribute.



commit 2b16a7cfa63fa34b7fbf301985ef58f0e3954178
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Jan 7 14:12:07 2012 +0100

    Use the STANDARD_ALLOCATED_SIZE file attribute.

 src/baobab-scanner.vala          |    2 +-
 src/baobab-sync-scanner.vala     |   16 ++++++----------
 src/baobab-threaded-scanner.vala |   16 ++++++----------
 3 files changed, 13 insertions(+), 21 deletions(-)
---
diff --git a/src/baobab-scanner.vala b/src/baobab-scanner.vala
index 06c7f3f..22a379b 100644
--- a/src/baobab-scanner.vala
+++ b/src/baobab-scanner.vala
@@ -37,7 +37,7 @@ namespace Baobab {
 			FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME + "," +
 			FILE_ATTRIBUTE_STANDARD_TYPE + "," +
 			FILE_ATTRIBUTE_STANDARD_SIZE +  "," +
-			FILE_ATTRIBUTE_UNIX_BLOCKS + "," +
+			FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE +  "," +
 			FILE_ATTRIBUTE_UNIX_NLINK + "," +
 			FILE_ATTRIBUTE_UNIX_INODE + "," +
 			FILE_ATTRIBUTE_UNIX_DEVICE + "," +
diff --git a/src/baobab-sync-scanner.vala b/src/baobab-sync-scanner.vala
index 2a37ece..fc0fb6e 100644
--- a/src/baobab-sync-scanner.vala
+++ b/src/baobab-sync-scanner.vala
@@ -23,14 +23,10 @@ namespace Baobab {
 			     Columns.DISPLAY_NAME, display_name,
 			     Columns.PARSE_NAME,   parse_name);
 
-			if (info.has_attribute (FILE_ATTRIBUTE_STANDARD_SIZE)) {
-				results.size = info.get_size ();
+			results.size = info.get_size ();
+			if (info.has_attribute (FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE)) {
+				results.alloc_size = info.get_attribute_uint64 (FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE);
 			}
-
-			if (info.has_attribute (FILE_ATTRIBUTE_UNIX_BLOCKS)) {
-				results.alloc_size = 512 * info.get_attribute_uint64 (FILE_ATTRIBUTE_UNIX_BLOCKS);
-			}
-
 			results.elements = 1;
 
 			try {
@@ -66,10 +62,10 @@ namespace Baobab {
 								}
 							}
 
-							if (child_info.has_attribute (FILE_ATTRIBUTE_UNIX_BLOCKS)) {
-								results.alloc_size += 512 * child_info.get_attribute_uint64 (FILE_ATTRIBUTE_UNIX_BLOCKS);
-							}
 							results.size += child_info.get_size ();
+							if (child_info.has_attribute (FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE)) {
+								results.alloc_size += child_info.get_attribute_uint64 (FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE);
+							}
 							results.elements++;
 							break;
 
diff --git a/src/baobab-threaded-scanner.vala b/src/baobab-threaded-scanner.vala
index a5b05b2..58e668a 100644
--- a/src/baobab-threaded-scanner.vala
+++ b/src/baobab-threaded-scanner.vala
@@ -76,14 +76,10 @@ namespace Baobab {
 			results.parse_name = directory.get_parse_name ();
 			results.parent = parent;
 
-			if (info.has_attribute (FILE_ATTRIBUTE_STANDARD_SIZE)) {
-				results.size = info.get_size ();
+			results.size = info.get_size ();
+			if (info.has_attribute (FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE)) {
+				results.alloc_size = info.get_attribute_uint64 (FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE);
 			}
-
-			if (info.has_attribute (FILE_ATTRIBUTE_UNIX_BLOCKS)) {
-				results.alloc_size = 512 * info.get_attribute_uint64 (FILE_ATTRIBUTE_UNIX_BLOCKS);
-			}
-
 			results.elements = 1;
 
 			try {
@@ -122,10 +118,10 @@ namespace Baobab {
 								}
 							}
 
-							if (child_info.has_attribute (FILE_ATTRIBUTE_UNIX_BLOCKS)) {
-								results.alloc_size += 512 * child_info.get_attribute_uint64 (FILE_ATTRIBUTE_UNIX_BLOCKS);
-							}
 							results.size += child_info.get_size ();
+							if (child_info.has_attribute (FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE)) {
+								results.alloc_size += child_info.get_attribute_uint64 (FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE);
+							}
 							results.elements++;
 							break;
 



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