From 0e5cccbd8a13b407422e2c1bdd2f3228bc87506b Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Fri, 29 Sep 2006 06:21:52 +0000 Subject: ** Fixes bug #341474 patch from Ushveen 2006-09-29 Srinivasa Ragavan ** Fixes bug #341474 patch from Ushveen * e-attachment-bar.c: (size_to_string): Use gnome_vfs_format_file_size_for_display instead of manual calculations. svn path=/trunk/; revision=32820 --- widgets/misc/ChangeLog | 7 +++++++ widgets/misc/e-attachment-bar.c | 23 ++++------------------- 2 files changed, 11 insertions(+), 19 deletions(-) (limited to 'widgets/misc') diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index a6c99bddc5..615912f4e8 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,10 @@ +2006-09-29 Srinivasa Ragavan + + ** Fixes bug #341474 patch from Ushveen + + * e-attachment-bar.c: (size_to_string): Use + gnome_vfs_format_file_size_for_display instead of manual calculations. + 2006-09-12 Ushveen Kaur ** Fix for bug #325614 diff --git a/widgets/misc/e-attachment-bar.c b/widgets/misc/e-attachment-bar.c index 708a365549..b4b3ef9fe5 100644 --- a/widgets/misc/e-attachment-bar.c +++ b/widgets/misc/e-attachment-bar.c @@ -89,31 +89,16 @@ static void update (EAttachmentBar *bar); static char * -size_to_string (size_t size) +size_to_string (gulong size) { char *size_string; /* FIXME: The following should probably go into a separate module, as we might have to do the same thing in other places as well. Also, I am not sure this will be OK for all the languages. */ - - if (size < 1e3L) { - size_string = NULL; - } else { - gdouble displayed_size; - - if (size < 1e6L) { - displayed_size = (gdouble) size / 1.0e3; - size_string = g_strdup_printf (_("%.0fK"), displayed_size); - } else if (size < 1e9L) { - displayed_size = (gdouble) size / 1.0e6; - size_string = g_strdup_printf (_("%.0fM"), displayed_size); - } else { - displayed_size = (gdouble) size / 1.0e9; - size_string = g_strdup_printf (_("%.0fG"), displayed_size); - } - } - + + size_string = gnome_vfs_format_file_size_for_display (size); + return size_string; } -- cgit v1.2.3