Closed oliver-joos closed 11 years ago
Here is my (pre-alpha!) prototype of an IEC-Size column. Save it as "~/.local/share/caja-python/extensions/iec-size-column.py" and restart Caja, e.g. with Terminal command "caja -q".
import os
from stat import *
import urllib
import caja
formats = ('%d bytes', '%.1f KiB', '%.1f MiB', '%.1f GiB')
class IECSizeColumnExtension(caja.ColumnProvider, caja.InfoProvider):
def __init__(self):
pass
def get_columns(self):
col = caja.Column("CajaPython::iec_size_column",
"iec_size",
"Size (IEC)",
"Object sizes in KiB,Mib,GiB")
col.set_property('xalign', 1) # right-aligned
return (col, )
def update_file_info(self, file):
if file.get_uri_scheme() != 'file':
return
filename = urllib.unquote(file.get_uri()[7:])
file_stat = os.stat(filename)
if S_ISDIR(file_stat.st_mode):
# TODO: count items in directory
file.add_string_attribute('iec_size', '? items')
else:
filesize = int(file_stat.st_size)
for format in formats:
if filesize < 1024:
break
filesize /= 1024.0
file.add_string_attribute('iec_size', format % filesize)
Already discussed here: https://github.com/mate-desktop/mate-file-manager/issues/8
Closing, given that this can be implemented with an extension
As I said I would prefer a special checkbox in Cajas preferences that could switch all size displays, like the status bar and properties dialogs. This cannot be done in a Caja extension AFAIK.
Meanwhile I got used to non-IEC sizes a bit. And I had a less invasive idea: only the status bar could show the size of selected files as G_FORMAT_SIZE_LONG_FORMAT! Something like this:
"MyCD.iso" selected: 734.0 MB (734'003'200 bytes), Free space: 11.3 GB
For new users this would be a nice hint that in Caja 1 MB = 1'000'000 bytes. And for experts this would allow to quickly check/compare exact file sizes. For me I think I can do this in a Caja extension. But I would be glad to help implementing this into Caja as default, since IMO typical Mate users care about exact file sizes, like these guys: https://bugzilla.gnome.org/show_bug.cgi?id=94691
There is literally no reason for this to be happening. All other software is using KiB for it's sizes so you're clearly doing it differently, hell all of your own programs are using KiB instead of KB. What's going on with you people where you have a single program that's different?
@133794m3r please read https://developer.gnome.org/glib/2.38/glib-Miscellaneous-Utility-Functions.html#g-format-size first however, we added an option to use IEC units in 1.8
Then why is that not default then? Pluma and every other program in mate-desktop uses IEC for it's unit sizes. So why is caja the only program that's different?
Plus for 99.9999999% of people out there there's zero difference between KiB and KB, they see KB as 1024, only HDD/flash memory/etc are using that weird system. All linux programs use IEC, windows and even mac uses IEC for the default size for files. Why is caja the only one that's different?
If you're truly wanting to use non IEC sizes for KB, then why haven't you changed pluma, and every other program included in mate to all use the ass-backwards weird system that most people don't even see/use?
Edit: Also I read it, but still if you're truly using glib then why are you even doing that then? file-roller's mate version, pluma, everything in mate-desktop-enviroment is all using 1024 for the file size. Only caja isn't it's as weird as humanly possible.
Where does pluma shows IEC units? All MATE apps use g_format_size from glib, so all sizes are in SI units. Caja is the only one that has the option to show IEC units too.
Open up a file in pluma, look at the sizes that it shows. It is showing the file sizes in base 2 as it should. The file size in caja for a 1024MiB file is 1.1GB, pluma shows it as 1023MB which is the true size of the actual file.
Also that's fine and dandy that it's in 1.8 but that means I'm stuck with either a) having to manually do the math for file sizes in my head when using mate or going back to xfce until this thing gets fixed.
Edit: And to add why are you doing something that everything in the world except apparently gnome 3(and all of it's crap) does but everything else uses IEC units which is what most users expect to see. There's no way to easily change it at all and that's just plain stupid. It should be default or it should say "oh hey do you want normal units or weird ones?" Since it's going to confuse all kinds of people, since it'll make them think that their files are magically bigger in mate.
We didnt change the behaviour. It just changed in glib. You could have same MATE app showing IEC or SI, just depending on glib version you have. And I have pluma and engrampa showing SI units too (but pluma shows sizes in open dialog folder, and it comes from gtk, it is not in pluma itself)
...
@133794m3r Please use an appropriate language here
@133794m3r Calm down, you are getting too worked up about this. If you have a problem with this investigate where in MATE you see this is a problem, send the MATE team analysis with a proposal how to fix it.
Then it's super simple, always use IEC units or use GTK for the file sizes for all of mate-desktop as it's more inline with what everything else out there is using for its own "user friendly" strings for file sizes.
With an option to use the SI units in the preferences area on the control panel, and label it something like "show file sizes like GNOME does." or something similar that way the entire system's sizes are similar and are not randomly changing due to the gnome team being stupid.
I don't see any difference between caja list view, gtk-file-open dialog, both show the same value for me in MATE 1.6.
$ dd bs=1000000 count=1000 if=/dev/zero of=test.file
1000+0 records gelezen
1000+0 records geschreven
1000000000 bytes (1,0 GB) gekopieerd, 0,439566 s, 2,3 GB/s
sander@infirit ~/unit_test $ ls -l
totaal 976564
-rw-r--r-- 1 sander users 1000000000 16 mrt 18:16 test.file
Eh I've got no idea why you're seeing it that way as it is, but also why was it changed in the first place? 1024=1KB has been the standard way for displaying the sizes since the beginning of time. HDDs/storage media has shown itself to be different, but optical media has always been base 2. So your system that you're using is different than it ever was.
The GNOME team randomly changing the sizes as displayed to the users is just complete and utter insanity as it is different than what anything has ever been done in the past. Also your block size is the issue you're not setting the block size as all extent/almost all file systems use which is 4096 bytes.
I checked this across several distributions with different languages, all show the same consistent view. Dunno what to tell you.
You have the option to change this in Caja 1.8 but more than that I see not happening in MATE anytime soon. But personally I like how glib does it by default, if that makes me insane or stupid so be it.
Why it changed is not important, it changed and you either live with it or don't, up to you. If you feel it is wrong you can open a bug on glib in bugzilla.gnome.org and try to persuade the glib developers.
It wont work, the GNOME developers won't listen to common sense. Look at GNOME 3, they threw away all of the past history of user training and basic UX design so a few designers could masturbate to how great they all are. KB has been 1024 for as long as computers have been around and there's no reason to randomly decide to change that. Especially when you put in a CD it should say 699.8MB free but this'll make it say something different, DVD? Oh that's not 4.7GB it's some weird value that makes no sense. The whole thing is stupid, whoever decided that they should change it should be shot.
Even if I tried to rationalize with them it'd be closed as wontfix because some designer wants to clearly seperate KB and KiB even though the vast majority of the population uses KB when they mearn KiB none of them know the difference and it's never been different until glib decided to change it.
Caja 1.4.0 in List View mode shows filesizes with 1000000 bytes = 1000kB = 1 MB. Nautilus 2.x showed 1048576 bytes = 1024 KB = 1 MB, which was wrong indeed. Only the uppercase 'K' was a hint for factor 1024. An IEC standard defines special binary unit prefixes: 10485761 bytes = 1024 KiB = 1 MiB.
The current solution in Caja is correct, but IMHO not optimal in many situations:
I am sure that there are arguments for kB/MB/GB too and would not like to discuss these. Therefore I propose to implement both! I hacked together a caja-python extension for an IEC Size column (see image). But I would prefer a special checkbox in Cajas preferences that could switch other size displays too, like in the status bar or properties dialogs.