summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/caja-file-management-properties.c1
-rw-r--r--src/file-manager/fm-icon-view.c7
-rw-r--r--src/file-manager/fm-list-view.c1
-rw-r--r--src/file-manager/fm-properties-window.c28
4 files changed, 31 insertions, 6 deletions
diff --git a/src/caja-file-management-properties.c b/src/caja-file-management-properties.c
index 5dc2251d..e7051284 100644
--- a/src/caja-file-management-properties.c
+++ b/src/caja-file-management-properties.c
@@ -99,6 +99,7 @@ static const char * const sort_order_values[] =
"name",
"directory",
"size",
+ "size_on_disk",
"type",
"mtime",
"atime",
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c
index 5e206b24..dab35561 100644
--- a/src/file-manager/fm-icon-view.c
+++ b/src/file-manager/fm-icon-view.c
@@ -136,6 +136,13 @@ static const SortCriterion sort_criteria[] =
N_("Keep icons sorted by size in rows")
},
{
+ CAJA_FILE_SORT_BY_SIZE_ON_DISK,
+ "size_on_disk",
+ "Sort by Size on Disk",
+ N_("by Size on Disk"),
+ N_("Keep icons sorted by disk usage in rows")
+ },
+ {
CAJA_FILE_SORT_BY_TYPE,
"type",
"Sort by Type",
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index 4021bf2e..bb62db8b 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -183,6 +183,7 @@ get_default_sort_order (CajaFile *file, gboolean *reversed)
"name",
"uri",
"size",
+ "size_on_disk",
"type",
"date_modified",
"date_accessed",
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);