summaryrefslogtreecommitdiff
path: root/src/file-manager/fm-properties-window.c
diff options
context:
space:
mode:
authorFelipe Barriga Richards <[email protected]>2017-04-01 23:12:25 -0300
committerraveit65 <[email protected]>2017-05-25 08:28:30 +0200
commitb28445b3d2c42a7d2dbac97983d007e4ab58684d (patch)
tree3e654155d6deb53e40378e060eb972c9c957fec0 /src/file-manager/fm-properties-window.c
parent79fadd6ab9e93e46b5308bc6d3838ed93f225f98 (diff)
downloadcaja-b28445b3d2c42a7d2dbac97983d007e4ab58684d.tar.bz2
caja-b28445b3d2c42a7d2dbac97983d007e4ab58684d.tar.xz
added feature: present the size on disk of files as we present the size of the file.
Diffstat (limited to 'src/file-manager/fm-properties-window.c')
-rw-r--r--src/file-manager/fm-properties-window.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c
index 94664b21..90ea68cd 100644
--- a/src/file-manager/fm-properties-window.c
+++ b/src/file-manager/fm-properties-window.c
@@ -128,6 +128,7 @@ struct FMPropertiesWindowDetails {
guint total_count;
goffset total_size;
+ goffset total_size_on_disk;
guint long_operation_underway;
@@ -2203,11 +2204,13 @@ directory_contents_value_field_update (FMPropertiesWindow *window)
guint total_count;
guint unreadable_directory_count;
goffset total_size;
+ goffset total_size_on_disk;
gboolean used_two_lines;
CajaFile *file;
GList *l;
guint file_unreadable;
goffset file_size;
+ goffset file_size_on_disk;
g_assert (FM_IS_PROPERTIES_WINDOW (window));
@@ -2215,6 +2218,7 @@ directory_contents_value_field_update (FMPropertiesWindow *window)
file_status = CAJA_REQUEST_NOT_STARTED;
total_count = window->details->total_count;
total_size = window->details->total_size;
+ total_size_on_disk = window->details->total_size_on_disk;
unreadable_directory_count = FALSE;
for (l = window->details->target_files; l; l = l->next) {
@@ -2231,9 +2235,11 @@ directory_contents_value_field_update (FMPropertiesWindow *window)
&file_count,
&file_unreadable,
&file_size,
+ &file_size_on_disk,
TRUE);
total_count += (file_count + directory_count);
total_size += file_size;
+ total_size_on_disk += file_size_on_disk;
if (file_unreadable) {
unreadable_directory_count = TRUE;
@@ -2245,6 +2251,7 @@ directory_contents_value_field_update (FMPropertiesWindow *window)
} else {
++total_count;
total_size += caja_file_get_size (file);
+ total_size_on_disk += caja_file_get_size_on_disk (file);
}
}
@@ -2275,17 +2282,22 @@ directory_contents_value_field_update (FMPropertiesWindow *window)
}
} else {
char *size_str;
+ char *size_on_disk_str;
- if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
+ if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) {
size_str = g_format_size_full (total_size, G_FORMAT_SIZE_IEC_UNITS);
- else
- size_str = g_format_size(total_size);
+ size_on_disk_str = g_format_size_full (total_size_on_disk, G_FORMAT_SIZE_IEC_UNITS);
+ } else {
+ size_str = g_format_size (total_size);
+ size_on_disk_str = g_format_size (total_size_on_disk);
+ }
- text = g_strdup_printf (ngettext("%'d item, with size %s",
- "%'d items, totalling %s",
+ text = g_strdup_printf (ngettext("%'d item, with size %s (%s on disk)",
+ "%'d items, totalling %s (%s on disk)",
total_count),
- total_count, size_str);
+ total_count, size_str, size_on_disk_str);
g_free (size_str);
+ g_free (size_on_disk_str);
if (unreadable_directory_count != 0) {
temp = text;
@@ -3265,6 +3277,10 @@ create_basic_page (FMPropertiesWindow *window)
"size_detail",
INCONSISTENT_STATE_STRING,
FALSE);
+ append_title_value_pair (window, grid, _("Size on Disk:"),
+ "size_on_disk_detail",
+ INCONSISTENT_STATE_STRING,
+ FALSE);
}
append_blank_row (grid);