Search code examples
clinuxnautilus

Getting file-size property from Nautilus


I am hacking on Evince and trying to add a feature that shows the size of the file in the file-property page.

But I am unable to get the file-size value from Nautilus file info.

Does anybody how to get size-info of a file from Nautilus? I can get it in terminal using ls -l and stat commands.


Solution

  • Assuming Evince uses GIO (I failed to find a way to quickly browse its code), you can use e.g. g_file_query_info() to get a GFileInfo pointer.

    You can then use g_file_info_get_size() to get the size of the file.