From 65f69a91c5ff2a0df8ab3d270bc5106d8965449e Mon Sep 17 00:00:00 2001 From: Paolo Borelli Date: Sat, 12 Jul 2008 16:36:45 +0000 Subject: ** Fix for bug #542631 2008-07-12 Paolo Borelli ** Fix for bug #542631 * e-attachment-bar.c: use g_format_size_for_display instead of cut and pasted code. svn path=/trunk/; revision=35740 --- widgets/misc/ChangeLog | 7 +++++++ widgets/misc/e-attachment-bar.c | 35 +---------------------------------- 2 files changed, 8 insertions(+), 34 deletions(-) (limited to 'widgets') diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 83bc08112c..57696e0e68 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,10 @@ +2008-07-12 Paolo Borelli + + ** Fix for bug #542631 + + * e-attachment-bar.c: use g_format_size_for_display instead of cut and + pasted code. + 2008-07-07 Suman Manjunath ** Fix for bug #370731 (bugzilla.novell.com) diff --git a/widgets/misc/e-attachment-bar.c b/widgets/misc/e-attachment-bar.c index 82a910d46d..3da833b7ec 100644 --- a/widgets/misc/e-attachment-bar.c +++ b/widgets/misc/e-attachment-bar.c @@ -95,37 +95,6 @@ static guint signals[LAST_SIGNAL] = { 0 }; static void update (EAttachmentBar *bar); - -static char * -size_to_string (gulong size) -{ - /* code copied from gnome-vfs */ - #define KILOBYTE_FACTOR 1024.0 - #define MEGABYTE_FACTOR (1024.0 * 1024.0) - #define GIGABYTE_FACTOR (1024.0 * 1024.0 * 1024.0) - - if (size < (gulong) KILOBYTE_FACTOR) { - return g_strdup_printf (ngettext ("%u byte", "%u bytes",(guint) size), (guint) size); - } else { - gdouble displayed_size; - - if (size < (gulong) MEGABYTE_FACTOR) { - displayed_size = (gdouble) size / KILOBYTE_FACTOR; - return g_strdup_printf (_("%.1f KB"), displayed_size); - } else if (size < (gulong) 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); - } - } - - #undef KILOBYTE_FACTOR - #undef MEGABYTE_FACTOR - #undef GIGABYTE_FACTOR -} - /* Attachment handling functions. */ static void @@ -483,7 +452,7 @@ update (EAttachmentBar *bar) if (!desc) desc = _("attachment"); - if (attachment->size && (size_string = size_to_string (attachment->size))) { + if (attachment->size && (size_string = g_format_size_for_display (attachment->size))) { label = g_strdup_printf ("%s (%s)", desc, size_string); g_free (size_string); } else @@ -1290,7 +1259,6 @@ e_attachment_bar_to_multipart (EAttachmentBar *bar, CamelMultipart *multipart, c } } - guint e_attachment_bar_get_num_attachments (EAttachmentBar *bar) { @@ -1299,7 +1267,6 @@ e_attachment_bar_get_num_attachments (EAttachmentBar *bar) return bar->priv->attachments->len; } - void e_attachment_bar_attach (EAttachmentBar *bar, const char *file_name, const char *disposition) { -- cgit