summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fe-gtk/dccgui.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/fe-gtk/dccgui.c b/src/fe-gtk/dccgui.c
index 562fe9e5..6d6a033d 100644
--- a/src/fe-gtk/dccgui.c
+++ b/src/fe-gtk/dccgui.c
@@ -103,26 +103,15 @@ static short view_mode;	/* 1=download 2=upload 3=both */
 #define VIEW_UPLOAD 2
 #define VIEW_BOTH 3
 
-#define KILOBYTE 1024
-#define MEGABYTE (KILOBYTE * 1024)
-#define GIGABYTE (MEGABYTE * 1024)
-
 
 static void
 proper_unit (DCC_SIZE size, char *buf, int buf_len)
 {
-	if (size <= KILOBYTE)
-	{
-		snprintf (buf, buf_len, "%"DCC_SFMT"B", size);
-	}
-	else if (size > KILOBYTE && size <= MEGABYTE)
-	{
-		snprintf (buf, buf_len, "%"DCC_SFMT"kB", size / KILOBYTE);
-	}
-	else
-	{
-		snprintf (buf, buf_len, "%.2fMB", (float)size / MEGABYTE);
-	}
+	gchar *formated_str = g_format_size ((guint64)size);
+
+	g_strlcpy (buf, formated_str, buf_len);
+
+	g_free (formated_str);
 }
 
 static void