diff options
author | David Zeuthen <davidz@redhat.com> | 2008-09-02 18:34:23 +0000 |
---|---|---|
committer | David Zeuthen <davidz@src.gnome.org> | 2008-09-02 18:34:23 +0000 |
commit | a4dadfac7b3d059618a7d00dc882bb2dc8ca6493 (patch) | |
tree | b8e8176e220eb63cc11970713e6e306f74dbe505 | |
parent | 0ef19ec95bc58d923814dffdf1ec9a9decb9b5ed (diff) | |
download | gvfs-a4dadfac7b3d059618a7d00dc882bb2dc8ca6493.tar.gz |
Add docs explaining why powers of 10 are used.
2008-09-02 David Zeuthen <davidz@redhat.com>
* monitor/hal/ghalvolume.c (format_size_for_display): Add docs
explaining why powers of 10 are used.
svn path=/trunk/; revision=1930
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | monitor/hal/ghalvolume.c | 19 |
2 files changed, 24 insertions, 0 deletions
@@ -1,5 +1,10 @@ 2008-09-02 David Zeuthen <davidz@redhat.com> + * monitor/hal/ghalvolume.c (format_size_for_display): Add docs + explaining why powers of 10 are used. + +2008-09-02 David Zeuthen <davidz@redhat.com> + * monitor/hal/ghalvolume.c (do_update_from_hal): Revert patch from bug 550100 - we really don't want to show "61.7MB Volume" instead of "64M Volume". diff --git a/monitor/hal/ghalvolume.c b/monitor/hal/ghalvolume.c index 4c9e43f5..12579887 100644 --- a/monitor/hal/ghalvolume.c +++ b/monitor/hal/ghalvolume.c @@ -140,6 +140,25 @@ changed_in_idle (gpointer data) #define MEGABYTE_FACTOR (1000.0 * 1000.0) #define GIGABYTE_FACTOR (1000.0 * 1000.0 * 1000.0) +/** + * format_size_for_display: + * @size: a number of octects + * + * Format a human readable string that can conveys how much storage a + * user-visible drive or piece of media can hold. + * + * As a matter of policy, we want this string to resemble what's on + * the packaging of the drive/media. Since all manufacturers use + * powers of 10, g_format_size_for_display() is not suitable here. + * + * TODO: we probably want to round to nearest power of two if @size is + * "close" (e.g. within 5%) - this is to avoid e.g. 63.4G when the + * packaging says "64G drive". We could also use per-drive or + * per-media quirks to make a better guess. + * + * Returns: A human readable string, caller must free it using + * g_free(). + **/ static char * format_size_for_display (guint64 size) { |