summaryrefslogtreecommitdiff
path: root/libcaja-private/caja-file.c
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-01-27 16:23:13 +0100
committerStefano Karapetsas <[email protected]>2014-01-27 16:23:13 +0100
commit7fbadf79122f06e80dd52937bfec8dea36cc2581 (patch)
tree8c974568176e1644df7416b67a41b44c348ee2f7 /libcaja-private/caja-file.c
parentd21e8d13f08a3c6cc89bec5e49ee4f76749ac89a (diff)
downloadcaja-7fbadf79122f06e80dd52937bfec8dea36cc2581.tar.bz2
caja-7fbadf79122f06e80dd52937bfec8dea36cc2581.tar.xz
Add option to show file sizes with IEC units instead of SI units
Contains also a typo fix for the previous commit Closes #203 https://github.com/mate-desktop/caja/issues/203
Diffstat (limited to 'libcaja-private/caja-file.c')
-rw-r--r--libcaja-private/caja-file.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c
index fa00ac8c..3e642391 100644
--- a/libcaja-private/caja-file.c
+++ b/libcaja-private/caja-file.c
@@ -5957,7 +5957,10 @@ caja_file_get_size_as_string (CajaFile *file)
}
#if GLIB_CHECK_VERSION(2, 30, 0)
- return g_format_size(file->details->size);
+ if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
+ return g_format_size_full (file->details->size, G_FORMAT_SIZE_IEC_UNITS);
+ else
+ return g_format_size (file->details->size);
#else // Since 2.16
return g_format_size_for_display(file->details->size);
#endif
@@ -6002,7 +6005,10 @@ caja_file_get_size_as_string_with_real_size (CajaFile *file)
}
#if GLIB_CHECK_VERSION(2, 30, 0)
- formated = g_format_size(file->details->size);
+ if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
+ formated = g_format_size_full (file->details->size, G_FORMAT_SIZE_IEC_UNITS);
+ else
+ formated = g_format_size(file->details->size);
#else
formated = g_format_size_for_display(file->details->size);
#endif
@@ -6074,7 +6080,10 @@ caja_file_get_deep_count_as_string_internal (CajaFile *file,
if (report_size)
{
#if GLIB_CHECK_VERSION(2, 30, 0)
- return g_format_size(total_size);
+ if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
+ return g_format_size_full (total_size, G_FORMAT_SIZE_IEC_UNITS);
+ else
+ return g_format_size(total_size);
#else
return g_format_size_for_display(total_size);
#endif
@@ -6889,7 +6898,10 @@ caja_file_get_volume_free_space (CajaFile *file)
if (directory->details->free_space != (guint64) -1)
{
#if GLIB_CHECK_VERSION(2, 30, 0)
- res = g_format_size(directory->details->free_space);
+ if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
+ res = g_format_size_full (directory->details->free_space, G_FORMAT_SIZE_IEC_UNITS);
+ else
+ res = g_format_size(directory->details->free_space);
#else
res = g_format_size_for_display(directory->details->free_space);
#endif