In Nautilus, the Properties of a single item shows the size as:
a value rounded to one decimal place... nn.n KB, MB, GB...
followed by an exact byte count
For non-single items, Nautilus onlys show a rounded size.
(Single item) Size: 1.4 GB (1501773824 bytes)
(Multi items) Size: 5 items, totalling 1.4 GB
(directory) Size: 5 items, totalling 1.4 GB
Is there some way to make Nautilus display the exact byte count in all situations?
I like the way the Properties dialog allows me to copy this size data, but I usually want to work with the exact size (not an approximation).
Konqueror shows the real size total, but It doesn't allow me to copy the value to to clipboard.
NB: The soluton zerwas provided (below) works nicely, except it reaches an integer maximum of 4,294967,296 bytes (4 GB)...
So for anyone reading this and interested to use this method, here is the ammended code, which caters for a "long long" integer... 9,223,372,036,854,775,807 bytes (8 EB.. E xaBytes).
The first line (/* new */) is at line-number 2337
/* new */ long long ll_total_size = total_size;
/* MOD */ size_str = g_format_size_for_display (ll_total_size);
/* MOD */ text = g_strdup_printf (ngettext("%'d item, with size %s (%lld bytes",
/* MOD */ "%'d items, totalling %s (%lld bytes)",
/* ASIS */ total_count),
/* MOD */ total_count, size_str, ll_total_size);
New displayed info:
(Single item) Size: 1.4 GB (1501773824 bytes)
(Multi items) Size: 5 items, totalling 1.4 GB (1502027641 bytes)
(directory) Size: 5 items, totalling 1.4 GB (1502027641 bytes)
--
(directory) Size: 188,120 items, totalling 766.8 GB (823295045767 bytes)
-
The value displayed is called by the function g_format_size_for_display of GLib. You have to edit the source code of nautilus to change this behaviour by just adding an %i to the output:
Step 1: Download source, install dependencies and open the file to edit
mkdir -p .p/nautilus && cd .p/nautilus sudo apt-get build-dep nautilus apt-get source nautilus && cd nautilus* gedit src/file-manager/fm-properties-window.c
Step 2: Change the code
Now go to line 2338 (in Nautilus 2.30) and change
with size %s
towith size %s (%i Bytes)
. Do the same fortotalling %s
. Change it tototalling %s (%i Bytes)
It should now look like this:text = g_strdup_printf (ngettext("%'d item, with size %s (%i Bytes)", "%'d items, totalling %s (%i Bytes)",
Step 3: Compile
Now you can simply compile Nautilus like every other application
./configure --prefix=/usr make sudo make install nautilus -q
Note that Nautilus will be overwritten whenever there will be an update to it through package management. This means you have to build and install it again manually.
There is also an alternative way by using an Nautilus script, but this would add another entry in the right click meny instead of having the value in the properties window.
fred.bear : @zerwas: Thanks for these instructions. It is a very nice lead-in to compiling-from-source... The results are close to the mark. I am getting new dialog output, but the %i value does not show the size in bytes. It shows the "size" as the count of items; the same as %'d.fred.bear : @zerwas: It seems that the third var is "total_size".. in line 2341 ... to become: total_count, size_str, total_size) ... I think I noticed a type warning for %i (as total_size).. Looking into now... but it certainly seems to work! Brilliant!fred.bear : I modified your code to accomodate longlong integers.. Ive included the ammended code in my original question. Thanks again zerwas.... And I am interested in that script method too :)From zerwas
0 comments:
Post a Comment