Use g_format_size with GLib 2.30.0

This commit is contained in:
Christian Dywan 2011-10-10 21:53:00 +02:00
parent cb6a4290d6
commit 3071da6711
4 changed files with 11 additions and 7 deletions

View file

@ -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]);

View file

@ -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 */

View file

@ -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

View file

@ -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);