diff -rupN glib-2.22.2-orig/glib/gfileutils.c glib-2.22.2/glib/gfileutils.c
--- glib-2.22.2-orig/glib/gfileutils.c	2009-09-19 01:20:05.000000000 +0200
+++ glib-2.22.2/glib/gfileutils.c	2009-10-17 20:52:33.455605000 +0200
@@ -1735,10 +1735,6 @@ g_build_filename (const gchar *first_ele
   return str;
 }
 
-#define KILOBYTE_FACTOR 1024.0
-#define MEGABYTE_FACTOR (1024.0 * 1024.0)
-#define GIGABYTE_FACTOR (1024.0 * 1024.0 * 1024.0)
-
 /**
  * g_format_size_for_display:
  * @size: a size in bytes.
@@ -1757,34 +1753,35 @@ g_build_filename (const gchar *first_ele
  *
  * Since: 2.16
  **/
-char *
+gchar *
 g_format_size_for_display (goffset size)
 {
-  if (size < (goffset) KILOBYTE_FACTOR)
-    return g_strdup_printf (g_dngettext(GETTEXT_PACKAGE, "%u byte", "%u bytes",(guint) size), (guint) size);
-  else
-    {
-      gdouble displayed_size;
-      
-      if (size < (goffset) MEGABYTE_FACTOR)
-	{
-	  displayed_size = (gdouble) size / KILOBYTE_FACTOR;
-	  return g_strdup_printf (_("%.1f KB"), displayed_size);
-	}
-      else if (size < (goffset) GIGABYTE_FACTOR)
-	{
-	  displayed_size = (gdouble) size / MEGABYTE_FACTOR;
-	  return g_strdup_printf (_("%.1f MB"), displayed_size);
-	}
-      else
-	{
-	  displayed_size = (gdouble) size / GIGABYTE_FACTOR;
-	  return g_strdup_printf (_("%.1f GB"), displayed_size);
-	}
-    }
+  guint i = 0, decimals = 0;
+  gdouble displayed_size = (gdouble) size;
+  static const gchar* sizes[] = 
+  {
+    N_("%.*f KB"),
+    N_("%.*f MB"),
+    N_("%.*f GB"),
+    N_("%.*f TB"),
+    N_("%.*f PB"),
+    N_("%.*f EB")
+  };
+
+  for (i = 0; displayed_size >= 1024 && i < G_N_ELEMENTS(sizes); i++)
+  {
+    displayed_size /= 1024;
+  }
+  
+  decimals = (displayed_size < 10.0) ? 2 : (displayed_size < 100.0) ? 1 : 0;
+  
+  /* if size == 0 return a formatted byte or bytes string otherwise return the result of the for loop */
+  /* note: the i - 1 is needed because the byte entry is missing from the array which is due to the 2 possible byte values "byte" and "bytes" */
+  return (i == 0) 
+            ? g_strdup_printf (g_dngettext(GETTEXT_PACKAGE, "%u byte", "%u bytes",(guint) size), (guint) size)
+            : g_strdup_printf (_(sizes[i - 1]), decimals, displayed_size);
 }
 
-
 /**
  * g_file_read_link:
  * @filename: the symbolic link
diff -rupN glib-2.22.2-orig/glib/gfileutils.h glib-2.22.2/glib/gfileutils.h
--- glib-2.22.2-orig/glib/gfileutils.h	2009-09-05 02:36:18.000000000 +0200
+++ glib-2.22.2/glib/gfileutils.h	2009-10-17 20:48:58.602329000 +0200
@@ -108,7 +108,7 @@ gint    g_file_open_tmp      (const gcha
 			      gchar       **name_used,
 			      GError      **error);
 
-char *g_format_size_for_display (goffset size);
+gchar *g_format_size_for_display (goffset size);
 
 gchar *g_build_path     (const gchar *separator,
 			 const gchar *first_element,
