[Xfce4-commits] <thunar:master> Don't use deprecated g_format_size_for_display.

Nick Schermer noreply at xfce.org
Sun Apr 15 14:02:01 CEST 2012


Updating branch refs/heads/master
         to 9a304dd4170fa9c996d9e9e91cca18152ac751c4 (commit)
       from 6da4524b8264233a20bb409ffb990570a9f68890 (commit)

commit 9a304dd4170fa9c996d9e9e91cca18152ac751c4
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Apr 15 13:59:50 2012 +0200

    Don't use deprecated g_format_size_for_display.

 thunar/thunar-file.c              |    4 ++++
 thunar/thunar-list-model.c        |   12 ++++++++++++
 thunar/thunar-properties-dialog.c |    4 ++++
 thunar/thunar-size-label.c        |    8 ++++++++
 4 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index e01f859..4fbf03d 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -1686,7 +1686,11 @@ gchar *
 thunar_file_get_size_string (const ThunarFile *file)
 {
   _thunar_return_val_if_fail (THUNAR_IS_FILE (file), NULL);
+#if GLIB_CHECK_VERSION (2, 30, 0)
+  return g_format_size (thunar_file_get_size (file));
+#else
   return g_format_size_for_display (thunar_file_get_size (file));
+#endif
 }
 
 
diff --git a/thunar/thunar-list-model.c b/thunar/thunar-list-model.c
index f5e42b3..018af4e 100644
--- a/thunar/thunar-list-model.c
+++ b/thunar/thunar-list-model.c
@@ -2292,7 +2292,11 @@ thunar_list_model_get_statusbar_text (ThunarListModel *store,
       if (G_LIKELY (file != NULL && thunar_file_get_free_space (file, &size)))
         {
           /* humanize the free space */
+#if GLIB_CHECK_VERSION (2, 30, 0)
+          fspace_string = g_format_size (size);
+#else
           fspace_string = g_format_size_for_display (size);
+#endif
 
           /* check if we have atleast one file in this folder */
           if (G_LIKELY (store->nrows > 0))
@@ -2302,7 +2306,11 @@ thunar_list_model_get_statusbar_text (ThunarListModel *store,
                 size_summary += thunar_file_get_size (row->data);
 
               /* humanize the size summary */
+#if GLIB_CHECK_VERSION (2, 30, 0)
+              size_string = g_format_size (size_summary);
+#else
               size_string = g_format_size_for_display (size_summary);
+#endif
 
               /* generate a text which includes the size of all items in the folder */
               text = g_strdup_printf (ngettext ("%d item (%s), Free space: %s", "%d items (%s), Free space: %s", store->nrows),
@@ -2404,7 +2412,11 @@ thunar_list_model_get_statusbar_text (ThunarListModel *store,
 
       if (size_summary > 0)
         {
+#if GLIB_CHECK_VERSION (2, 30, 0)
+          size_string = g_format_size (size_summary);
+#else
           size_string = g_format_size_for_display (size_summary);
+#endif
           text = g_strdup_printf (ngettext ("%d item selected (%s)", "%d items selected (%s)", n), n, size_string);
           g_free (size_string);
         }
diff --git a/thunar/thunar-properties-dialog.c b/thunar/thunar-properties-dialog.c
index de90d5d..1e2de45 100644
--- a/thunar/thunar-properties-dialog.c
+++ b/thunar/thunar-properties-dialog.c
@@ -996,7 +996,11 @@ thunar_properties_dialog_update (ThunarPropertiesDialog *dialog)
   if (thunar_file_is_directory (dialog->file) 
       && thunar_file_get_free_space (dialog->file, &size))
     {
+#if GLIB_CHECK_VERSION (2, 30, 0)
+      size_string = g_format_size (size);
+#else
       size_string = g_format_size_for_display (size);
+#endif
       gtk_label_set_text (GTK_LABEL (dialog->freespace_label), size_string);
       gtk_widget_show (dialog->freespace_label);
       g_free (size_string);
diff --git a/thunar/thunar-size-label.c b/thunar/thunar-size-label.c
index d0096bf..c83758e 100644
--- a/thunar/thunar-size-label.c
+++ b/thunar/thunar-size-label.c
@@ -380,7 +380,11 @@ thunar_size_label_file_changed (ThunarFile      *file,
       if (G_LIKELY (size > 1024ul))
         {
           /* prepend the humanized size */
+#if GLIB_CHECK_VERSION (2, 30, 0)
+          size_humanized = g_format_size (size);
+#else
           size_humanized = g_format_size_for_display (size);
+#endif
           text = g_strdup_printf ("%s (%s)", size_humanized, size_string);
           g_free (size_humanized);
           g_free (size_string);
@@ -464,7 +468,11 @@ thunar_size_label_status_update (ThunarDeepCountJob *job,
   n = file_count + directory_count + unreadable_directory_count;
 
   /* update the label */
+#if GLIB_CHECK_VERSION (2, 30, 0)
+  size_string = g_format_size (total_size);
+#else
   size_string = g_format_size_for_display (total_size);
+#endif
   text = g_strdup_printf (ngettext ("%u item, totalling %s", "%u items, totalling %s", n), n, size_string);
   gtk_label_set_text (GTK_LABEL (size_label->label), text);
   g_free (size_string);


More information about the Xfce4-commits mailing list