After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 773617 - g_format_size: Add support for variable size format option
g_format_size: Add support for variable size format option
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2016-10-28 03:31 UTC by gnome.vrb
Modified: 2018-05-24 19:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot: Use variable size format for different sizes. (25.34 KB, image/png)
2016-10-28 03:31 UTC, gnome.vrb
Details

Description gnome.vrb 2016-10-28 03:31:43 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.
Comment 1 gnome.vrb 2016-10-30 08:49:38 UTC
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. )
Comment 2 GNOME Infrastructure Team 2018-05-24 19:10:53 UTC
-- 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.