From 7fbadf79122f06e80dd52937bfec8dea36cc2581 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Mon, 27 Jan 2014 16:23:13 +0100 Subject: 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 --- src/file-manager/fm-directory-view.c | 7 +++++-- src/file-manager/fm-properties-window.c | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'src') 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); -- cgit v1.2.1