From 3071da6711b34d44971a0be4aafa1d1667cf4ba6 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 10 Oct 2011 21:53:00 +0200 Subject: [PATCH] Use g_format_size with GLib 2.30.0 --- midori/midori-browser.c | 4 ++-- midori/sokoke.c | 6 +++--- midori/sokoke.h | 4 ++++ panels/midori-transfers.c | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index aeed4062..695398a6 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -960,8 +960,8 @@ midori_browser_prepare_download (MidoriBrowser* browser, } else if (free_space < total_size) { - gchar* total_size_string = g_format_size_for_display (total_size); - gchar* free_space_string = g_format_size_for_display (free_space); + gchar* total_size_string = g_format_size (total_size); + gchar* free_space_string = g_format_size (free_space); message = g_strdup_printf ( _("There is not enough free space to download \"%s\"."), &uri[7]); diff --git a/midori/sokoke.c b/midori/sokoke.c index d7b17058..1ed09cc6 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -2230,8 +2230,8 @@ midori_download_prepare_tooltip_text (WebKitDownload* download) minutes_str = g_strdup_printf (ngettext ("%d minute", "%d minutes", minutes_left), minutes_left); seconds_str = g_strdup_printf (ngettext ("%d second", "%d seconds", seconds_left), seconds_left); - current = g_format_size_for_display (current_size); - total = g_format_size_for_display (total_size); + current = g_format_size (current_size); + total = g_format_size (total_size); last_time = g_object_get_data (G_OBJECT (download), "last-time"); last_size = g_object_get_data (G_OBJECT (download), "last-size"); @@ -2241,7 +2241,7 @@ midori_download_prepare_tooltip_text (WebKitDownload* download) g_free (total); if (time_elapsed != *last_time) - download_speed = g_format_size_for_display ( + download_speed = g_format_size ( (current_size - *last_size) / (time_elapsed - *last_time)); else /* i18n: Unknown number of bytes, used for transfer rate like ?B/s */ diff --git a/midori/sokoke.h b/midori/sokoke.h index b446982c..20bb9dca 100644 --- a/midori/sokoke.h +++ b/midori/sokoke.h @@ -25,6 +25,10 @@ #define g_content_type_from_mime_type(mtp) g_strdup (mtp) #endif +#if !GLIB_CHECK_VERSION (2, 30, 0) + #define g_format_size(sz) g_format_size_for_display ((goffset)sz) +#endif + #if !GTK_CHECK_VERSION (2, 14, 0) #define gtk_dialog_get_content_area(dlg) dlg->vbox #define gtk_dialog_get_action_area(dlg) dlg->action_area diff --git a/panels/midori-transfers.c b/panels/midori-transfers.c index fef9a0d9..3309e6e0 100644 --- a/panels/midori-transfers.c +++ b/panels/midori-transfers.c @@ -263,8 +263,8 @@ midori_transfers_treeview_render_text_cb (GtkTreeViewColumn* column, gtk_tree_model_get (model, iter, 1, &download, -1); /* FIXME: Ellipsize filename */ - current = g_format_size_for_display (webkit_download_get_current_size (download)); - total = g_format_size_for_display (webkit_download_get_total_size (download)); + current = g_format_size (webkit_download_get_current_size (download)); + total = g_format_size (webkit_download_get_total_size (download)); size_text = g_strdup_printf (_("%s of %s"), current, total); g_free (current); g_free (total); -- 2.39.5