summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcaja-private/caja-file-operations.c5
-rw-r--r--libcaja-private/caja-file.c20
-rw-r--r--libcaja-private/caja-global-preferences.h1
-rw-r--r--libcaja-private/org.mate.caja.gschema.xml.in5
-rw-r--r--src/file-manager/fm-directory-view.c7
-rw-r--r--src/file-manager/fm-properties-window.c18
6 files changed, 45 insertions, 11 deletions
diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c
index 99fbe89f..04ee81ab 100644
--- a/libcaja-private/caja-file-operations.c
+++ b/libcaja-private/caja-file-operations.c
@@ -852,7 +852,10 @@ custom_size_to_string (char *format, va_list va)
size = va_arg (va, goffset);
#if GLIB_CHECK_VERSION(2, 30, 0)
- return g_format_size(size);
+ if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
+ return g_format_size_full (size, G_FORMAT_SIZE_IEC_UNITS);
+ else
+ return g_format_size(size);
#else
return g_format_size_for_display(size);
#endif
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
diff --git a/libcaja-private/caja-global-preferences.h b/libcaja-private/caja-global-preferences.h
index 85fbe75f..ee76abb8 100644
--- a/libcaja-private/caja-global-preferences.h
+++ b/libcaja-private/caja-global-preferences.h
@@ -64,6 +64,7 @@ G_BEGIN_DECLS
#define CAJA_PREFERENCES_SHOW_HIDDEN_FILES "show-hidden-files"
#define CAJA_PREFERENCES_SHOW_ADVANCED_PERMISSIONS "show-advanced-permissions"
#define CAJA_PREFERENCES_DATE_FORMAT "date-format"
+#define CAJA_PREFERENCES_USE_IEC_UNITS "use-iec-units"
/* Mouse */
#define CAJA_PREFERENCES_MOUSE_USE_EXTRA_BUTTONS "mouse-use-extra-buttons"
diff --git a/libcaja-private/org.mate.caja.gschema.xml.in b/libcaja-private/org.mate.caja.gschema.xml.in
index fc8fb5ca..1cf7fa0e 100644
--- a/libcaja-private/org.mate.caja.gschema.xml.in
+++ b/libcaja-private/org.mate.caja.gschema.xml.in
@@ -236,6 +236,11 @@
<_summary>Whether to show hidden files</_summary>
<_description>If set to true, then hidden files are shown by default in the file manager. Hidden files are either dotfiles, listed in the folder's .hidden file or backup files ending with a tilde (~).</_description>
</key>
+ <key name="use-iec-units" type="b">
+ <default>false</default>
+ <_summary>Whether to show file sizes with IEC units</_summary>
+ <_description>If set to true, file sizes are shown using IEC (base 1024) units with "KiB" style suffixes, instead of default with SI units.</_description>
+ </key>
</schema>
<schema id="org.mate.caja.icon-view" path="/org/mate/caja/icon-view/" gettext-domain="caja">
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 7b0e0dd0..79378f5a 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -2327,7 +2327,10 @@ fm_directory_view_display_selection_info (FMDirectoryView *view)
char *size_string;
#if GLIB_CHECK_VERSION(2, 30, 0)
- size_string = g_format_size(non_folder_size);
+ if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
+ size_string = g_format_size_full (non_folder_size, G_FORMAT_SIZE_IEC_UNITS);
+ else
+ size_string = g_format_size(non_folder_size);
#else
size_string = g_format_size_for_display(non_folder_size);
#endif
@@ -4766,7 +4769,7 @@ reset_open_with_menu (FMDirectoryView *view, GList *selection)
/* Show open parent folder action if we are in search mode */
if (eel_uri_is_search (fm_directory_view_get_uri (view)) && g_list_length (selection) == 1)
- add_parent_folder_to_openmenu (view,
+ add_parent_folder_to_open_menu (view,
selection,
FM_DIRECTORY_VIEW_MENU_PATH_OPEN,
FM_DIRECTORY_VIEW_POPUP_PATH_OPEN);
diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c
index f74ca6ca..d348a08a 100644
--- a/src/file-manager/fm-properties-window.c
+++ b/src/file-manager/fm-properties-window.c
@@ -2321,7 +2321,10 @@ directory_contents_value_field_update (FMPropertiesWindow *window)
char *size_str;
#if GLIB_CHECK_VERSION(2, 30, 0)
- size_str = g_format_size(total_size);
+ 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);
#else
size_str = g_format_size_for_display(total_size);
#endif
@@ -3144,9 +3147,16 @@ create_pie_widget (FMPropertiesWindow *window)
GFileInfo *info;
#if GLIB_CHECK_VERSION(2, 30, 0)
- capacity = g_format_size(window->details->volume_capacity);
- free = g_format_size(window->details->volume_free);
- used = g_format_size(window->details->volume_capacity - window->details->volume_free);
+ if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) {
+ capacity = g_format_size_full(window->details->volume_capacity, G_FORMAT_SIZE_IEC_UNITS);
+ free = g_format_size_full(window->details->volume_free, G_FORMAT_SIZE_IEC_UNITS);
+ used = g_format_size_full(window->details->volume_capacity - window->details->volume_free, G_FORMAT_SIZE_IEC_UNITS);
+ }
+ else {
+ capacity = g_format_size(window->details->volume_capacity);
+ free = g_format_size(window->details->volume_free);
+ used = g_format_size(window->details->volume_capacity - window->details->volume_free);
+ }
#else
capacity = g_format_size_for_display(window->details->volume_capacity);
free = g_format_size_for_display(window->details->volume_free);