aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorPaolo Borelli <pborelli@katamail.com>2008-07-13 00:36:45 +0800
committerPaolo Borelli <pborelli@src.gnome.org>2008-07-13 00:36:45 +0800
commit65f69a91c5ff2a0df8ab3d270bc5106d8965449e (patch)
tree6cb53b2848371037db433dcb64926a34734dd043 /widgets
parent3127d12f901da70e6503f7e7d979c279849662f5 (diff)
downloadgsoc2013-evolution-65f69a91c5ff2a0df8ab3d270bc5106d8965449e.tar.gz
gsoc2013-evolution-65f69a91c5ff2a0df8ab3d270bc5106d8965449e.tar.zst
gsoc2013-evolution-65f69a91c5ff2a0df8ab3d270bc5106d8965449e.zip
** Fix for bug #542631
2008-07-12 Paolo Borelli <pborelli@katamail.com> ** 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
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/ChangeLog7
-rw-r--r--widgets/misc/e-attachment-bar.c35
2 files changed, 8 insertions, 34 deletions
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 <pborelli@katamail.com>
+
+ ** 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 <msuman@novell.com>
** 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)
{