1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-11-29 04:32:15 -05:00

Use filesize format based on OS

Adds gui_filesize_iec option on Unix

Closes #966
This commit is contained in:
TingPing 2014-05-03 23:57:45 -04:00
parent fe71af15a7
commit 9599c29c46
3 changed files with 14 additions and 3 deletions

View File

@ -416,6 +416,7 @@ const struct prefs vars[] =
{"gui_dialog_left", P_OFFINT (hex_gui_dialog_left), TYPE_INT}, {"gui_dialog_left", P_OFFINT (hex_gui_dialog_left), TYPE_INT},
{"gui_dialog_top", P_OFFINT (hex_gui_dialog_top), TYPE_INT}, {"gui_dialog_top", P_OFFINT (hex_gui_dialog_top), TYPE_INT},
{"gui_dialog_width", P_OFFINT (hex_gui_dialog_width), TYPE_INT}, {"gui_dialog_width", P_OFFINT (hex_gui_dialog_width), TYPE_INT},
{"gui_filesize_iec", P_OFFINT (hex_gui_filesize_iec), TYPE_BOOL},
{"gui_focus_omitalerts", P_OFFINT (hex_gui_focus_omitalerts), TYPE_BOOL}, {"gui_focus_omitalerts", P_OFFINT (hex_gui_focus_omitalerts), TYPE_BOOL},
{"gui_hide_menu", P_OFFINT (hex_gui_hide_menu), TYPE_BOOL}, {"gui_hide_menu", P_OFFINT (hex_gui_hide_menu), TYPE_BOOL},
{"gui_input_attr", P_OFFINT (hex_gui_input_attr), TYPE_BOOL}, {"gui_input_attr", P_OFFINT (hex_gui_input_attr), TYPE_BOOL},

View File

@ -156,6 +156,7 @@ struct hexchatprefs
unsigned int hex_gui_autoopen_recv; unsigned int hex_gui_autoopen_recv;
unsigned int hex_gui_autoopen_send; unsigned int hex_gui_autoopen_send;
unsigned int hex_gui_compact; unsigned int hex_gui_compact;
unsigned int hex_gui_filesize_iec;
unsigned int hex_gui_focus_omitalerts; unsigned int hex_gui_focus_omitalerts;
unsigned int hex_gui_hide_menu; unsigned int hex_gui_hide_menu;
unsigned int hex_gui_input_attr; unsigned int hex_gui_input_attr;

View File

@ -107,11 +107,20 @@ static short view_mode; /* 1=download 2=upload 3=both */
static void static void
proper_unit (DCC_SIZE size, char *buf, int buf_len) 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
g_free (formated_str); formatted_str = g_format_size_full ((guint64)size, format_flags);
g_strlcpy (buf, formatted_str, buf_len);
g_free (formatted_str);
} }
static void static void