GNOME Bugzilla – Bug 773617
g_format_size: Add support for variable size format option
Last modified: 2018-05-24 19:10:53 UTC
Created attachment 338667 [details] Screenshot: Use variable size format for different sizes. I currently use an ipod which has various contents: Music / Photos / Videos / Podcasts etc. In these cases, the higher sizes for contents need more resolution and lower sizes need less resolution. Please refer to attached image for details. E.g. 3.4 GB can be 3.42 GB ( 3.42 GB is more useful than 3.4 GB ) 248.2 KB can be 248 KB ( 248.2 KB is not very useful compared to 248 KB ) Currently, g_format_size has ".1f" for all sizes ( GB / KB / MB ) etc. It should support one more flag in "GFormatSizeFlags", which implements this behavior. This can co-exists with the current behavior.
Just a thought. A more generic solution would be to have a int[] for specifying format specifiers for size. Currently supported sizes: [ KILOBYTE, MEGABYTE, GIGABYTE, TERABYTE, PETABYTE, EXABYTE ] [1] -> [1,1,1,1,1,1]. All sizes have %.1f ( default ). This is the current format. [1,2] -> [1,2,2,2,2,2] ( KB has %.1f format. Others have %.2f format. ) [1,2,2,3] -> [1,2,2,3,3,3] ( KB has %.1f format. MB, GB have %.2f. Others have %.3f format. )
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/1216.