diff options
author | TingPing <tingping@tingping.se> | 2014-05-03 23:57:45 -0400 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2014-05-03 23:57:45 -0400 |
commit | 9599c29c465cf8b0ac64969152e645ed09fef1d0 (patch) | |
tree | 29d0f52acb17312bb64dfc3a2f75e4ef2d2ce4d6 /src/fe-gtk | |
parent | fe71af15a715ca914fe6cd8ea174c2c948476a68 (diff) |
Use filesize format based on OS
Adds gui_filesize_iec option on Unix Closes #966
Diffstat (limited to 'src/fe-gtk')
-rw-r--r-- | src/fe-gtk/dccgui.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/fe-gtk/dccgui.c b/src/fe-gtk/dccgui.c index 6d6a033d..10ec8388 100644 --- a/src/fe-gtk/dccgui.c +++ b/src/fe-gtk/dccgui.c @@ -107,11 +107,20 @@ static short view_mode; /* 1=download 2=upload 3=both */ static void proper_unit (DCC_SIZE size, char *buf, int buf_len) { - gchar *formated_str = g_format_size ((guint64)size); + gchar *formatted_str; + GFormatSizeFlags format_flags = G_FORMAT_SIZE_DEFAULT; - g_strlcpy (buf, formated_str, buf_len); +#ifndef __APPLE__ /* OS X uses SI */ +#ifndef WIN32 /* Windows uses IEC size (with SI format) */ + if (prefs.hex_gui_filesize_iec) /* Linux can't decide... */ +#endif + format_flags = G_FORMAT_SIZE_IEC_UNITS; +#endif + + formatted_str = g_format_size_full ((guint64)size, format_flags); + g_strlcpy (buf, formatted_str, buf_len); - g_free (formated_str); + g_free (formatted_str); } static void |