GNOME Bugzilla – Bug 640432
integrating libkibi into glib?
Last modified: 2011-06-02 19:50:58 UTC
libkibi [1] is a library for byte prefixes. It is designed for formatting sizes in bytes for display. The user can configure a preferred prefix style. Would glib adopt a patch that adds the functionality of libkibi to glib? This includes deprecating g_format_display_for_size, adding a bunch of new functions for input and output (see below), and making it configurable by the user (e.g. via gsettings). I don't want to start working on a patch if there is no change to get it into glib. The functions could be: g_format_size() - replacement for g_format_size_for_display() g_format_size_detailed() - show size in base2 and base10 g_format_transfer_rate() - same as g_format_size(), but adds "/s" g_format_memory_size() - formats a memory size always in base 2 (e.g. for RAM sizes) g_format_si_unit() - format si units like "Hz" These function are required for inputting sizes: kibi_divide_size() kibi_get_unit_for_size() kibi_get_unit_for_transfer_rate() kibi_multiply_size() Here is some pseudo code how these input functions work: inputbox.set_value(kibi_divide_size(2, size)) label.set_text("Please input the size in " + kibi_get_unit_for_size(2)) show() size = kibi_multiply_size(2, inputbox.get_value()) [1] https://launchpad.net/libkibi
No need to open a new bug. We can just continue the flames in bug 554172
The configuration of libkibi is described in the byteprefix man page [1]. I want to get GNOME compliant to Ubuntu's unit policy [2], which could be done with libkibi, but having a compliant glib would be better. I don't want to start or continue a flame war, but I know that this is a bikeshed topic. [1] http://bazaar.launchpad.net/~libkibi-dev/libkibi/trunk/view/head:/doc/byteprefix.5.in [2] https://wiki.ubuntu.com/UnitsPolicy
I see different direction that glib can go: 1) Do nothing. This won't solve the problems. 2) Deprecate g_format_size_for_display() and a) do nothing. That moves the problem away from glib. I) Allow libkibi as dependency for GNOME applications. II) Let every application implement its own conversion function. b) introduce the new functions proposed in the description allowing the user to choose between base2, base10, and historic. c) introduce the new functions proposed in the description allowing the user to choose between base2 and base10. d) introduce new functions that allow only one type of conversion and I) use base 10 with SI prefixes (base10 in libkibi). II) use base 2 with IEC prefixes (base2 in libkibi). III) use base 2 with nearly SI prefix (historic in libkibi) which is similar to solution 1). Did I miss something? glib developers, please make a decision or at least tell me what of the above directions are acceptable for you.
Hi Benjamin, David outlined several possible APIs in bug 554172. If you have patches, please propose them there. *** This bug has been marked as a duplicate of bug 554172 ***