[Mageia-dev] What is Mageia's policy reagarding filesize display? (units/base 2 vs base 10)
Christian Lohmaier
lohmaier+mageia at googlemail.com
Tue Jun 26 19:01:30 CEST 2012
On Tue, Jun 26, 2012 at 6:13 PM, Oliver Burger
<oliver.bgr at googlemail.com> wrote:
> At the moment we have
> the bash showing values in base 2 with the unit K,
> dolphin showing them in base 2 with the unit KiB,
> pcmanfm showing them in base 2 with the unit KB.
>
> So patching nautilus to use base 2 woul make for a more common behaviour of
> the distro, but it will create work for our GNOME maintainer since he would
> have to maintain that patch for every future version.
To get a better idea of the "effort" it would take: This is the patch
diff -ru nautilus-3.4.1_orig/libnautilus-private/nautilus-file.c
nautilus-3.4.1/libnautilus-private/nautilus-file.c
--- nautilus-3.4.1_orig/libnautilus-private/nautilus-file.c 2012-04-13
19:01:03.000000000 +0200
+++ nautilus-3.4.1/libnautilus-private/nautilus-file.c 2012-06-26
16:13:48.649538611 +0200
@@ -5847,7 +5847,7 @@
if (file->details->size == -1) {
return NULL;
}
- return g_format_size (file->details->size);
+ return g_format_size_full (file->details->size, G_FORMAT_SIZE_IEC_UNITS);
}
/**
@@ -5885,7 +5885,7 @@
return NULL;
}
- return g_format_size_full (file->details->size, G_FORMAT_SIZE_LONG_FORMAT);
+ return g_format_size_full (file->details->size,
G_FORMAT_SIZE_IEC_UNITS & G_FORMAT_SIZE_LONG_FORMAT);
}
@@ -5945,7 +5945,7 @@
* directly if desired.
*/
if (report_size) {
- return g_format_size (total_size);
+ return g_format_size_full (total_size, G_FORMAT_SIZE_IEC_UNITS);
}
return format_item_count_for_display (report_directory_count
@@ -6675,7 +6675,7 @@
res = NULL;
if (file->details->free_space != (guint64)-1) {
- res = g_format_size (file->details->free_space);
+ res = g_format_size_full (file->details->free_space,
G_FORMAT_SIZE_IEC_UNITS);
}
return res;
diff -ru nautilus-3.4.1_orig/src/nautilus-view.c
nautilus-3.4.1/src/nautilus-view.c
--- nautilus-3.4.1_orig/src/nautilus-view.c 2012-04-13 19:01:03.000000000 +0200
+++ nautilus-3.4.1/src/nautilus-view.c 2012-06-26 16:13:48.652538574 +0200
@@ -2826,7 +2826,7 @@
if (non_folder_size_known) {
char *size_string;
- size_string = g_format_size (non_folder_size);
+ size_string = g_format_size_full (non_folder_size, G_FORMAT_SIZE_IEC_UNITS);
/* This is marked for translation in case a localiser
* needs to use something other than parentheses. The
* first message gives the number of items selected;
> And it could break any other thing in GNOME since GNOME apps are quite
> interweaved with one another and you never know, what app uses nautilus in
> parts for what.
See above. It is not a massive change in the internals of nautilus.
This is nautilus-only.
And unless glib breaks its API the patch will continue to work. Both
g_format_size and g_format_size_full return a human-readable string,
just the default units differ. If you'd use
g_format_size(size); is the very same as
g_format_size_full(size, G_FORMAT_SIZE_DEFAULT)
So this is purely switching the base, nothing else. No custom "hacks",
no black magic.
ciao
Christian
More information about the Mageia-dev
mailing list