[Xfce4-commits] <thunar:migration-to-gio> Same as before. Forgot to add these files.

Jannis Pohlmann jannis at xfce.org
Sun Aug 16 00:06:03 CEST 2009


Updating branch refs/heads/migration-to-gio
         to 0f916f1581462526c0cbc84ab7f08ced4b9a2c0f (commit)
       from 4234139ddc3fe3ab20ec9b08540bd2389869f71c (commit)

commit 0f916f1581462526c0cbc84ab7f08ced4b9a2c0f
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Sun Aug 16 00:04:37 2009 +0200

    Same as before. Forgot to add these files.

 thunar/thunar-gio-extensions.c    |   19 -------------------
 thunar/thunar-gio-extensions.h    |    2 --
 thunar/thunar-list-model.c        |    6 +++---
 thunar/thunar-properties-dialog.c |    2 +-
 thunar/thunar-size-label.c        |    4 ++--
 5 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/thunar/thunar-gio-extensions.c b/thunar/thunar-gio-extensions.c
index 49d7031..3636be7 100644
--- a/thunar/thunar-gio-extensions.c
+++ b/thunar/thunar-gio-extensions.c
@@ -212,25 +212,6 @@ g_file_get_location (GFile *file)
 
 
 
-gchar *
-g_file_size_humanize (guint64 size)
-{
-  gchar *buffer;
-
-  if (G_UNLIKELY (size > 1024ul * 1024ul * 1024ul))
-    buffer = g_strdup_printf ("%0.1f GB", size / (1024.0 * 1024.0 * 1024.0));
-  else if (size > 1024ul * 1024ul)
-    buffer = g_strdup_printf ("%0.1f MB", size / (1024.0 * 1024.0));
-  else if (size > 1024ul)
-    buffer = g_strdup_printf ("%0.1f kB", size / 1024.0);
-  else
-    buffer = g_strdup_printf ("%lu B", (gulong) size);
-
-  return buffer;
-}
-
-
-
 GType
 g_file_list_get_type (void)
 {
diff --git a/thunar/thunar-gio-extensions.h b/thunar/thunar-gio-extensions.h
index 36a38a3..f449548 100644
--- a/thunar/thunar-gio-extensions.h
+++ b/thunar/thunar-gio-extensions.h
@@ -44,8 +44,6 @@ gboolean  g_file_write_key_file            (GFile              *file,
 
 gchar    *g_file_get_location              (GFile              *file);
 
-gchar    *g_file_size_humanize             (guint64             size);
-
 /**
  * G_TYPE_FILE_LIST:
  *
diff --git a/thunar/thunar-list-model.c b/thunar/thunar-list-model.c
index d6dc3d1..c8f02f5 100644
--- a/thunar/thunar-list-model.c
+++ b/thunar/thunar-list-model.c
@@ -2247,7 +2247,7 @@ thunar_list_model_get_statusbar_text (ThunarListModel *store,
       if (G_LIKELY (file != NULL && thunar_file_get_free_space (file, &size)))
         {
           /* humanize the free space */
-          fspace_string = g_file_size_humanize (size);
+          fspace_string = g_format_size_for_display (size);
 
           /* check if we have atleast one file in this folder */
           if (G_LIKELY (store->nrows > 0))
@@ -2257,7 +2257,7 @@ thunar_list_model_get_statusbar_text (ThunarListModel *store,
                 size_summary += thunar_file_get_size (row->data);
 
               /* humanize the size summary */
-              size_string = g_file_size_humanize (size_summary);
+              size_string = g_format_size_for_display (size_summary);
 
               /* 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),
@@ -2359,7 +2359,7 @@ thunar_list_model_get_statusbar_text (ThunarListModel *store,
 
       if (size_summary > 0)
         {
-          size_string = g_file_size_humanize (size_summary);
+          size_string = g_format_size_for_display (size_summary);
           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 317ebfa..247e619 100644
--- a/thunar/thunar-properties-dialog.c
+++ b/thunar/thunar-properties-dialog.c
@@ -987,7 +987,7 @@ thunar_properties_dialog_update (ThunarPropertiesDialog *dialog)
   if (thunar_file_is_directory (dialog->file) 
       && thunar_file_get_free_space (dialog->file, &size))
     {
-      size_string = g_file_size_humanize (size);
+      size_string = g_format_size_for_display (size);
       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 67b1488..25102b5 100644
--- a/thunar/thunar-size-label.c
+++ b/thunar/thunar-size-label.c
@@ -414,7 +414,7 @@ thunar_size_label_file_changed (ThunarFile      *file,
       if (G_LIKELY (size > 1024ul))
         {
           /* prepend the humanized size */
-          size_humanized = g_file_size_humanize (size);
+          size_humanized = g_format_size_for_display (size);
           text = g_strdup_printf ("%s (%s)", size_humanized, size_string);
           g_free (size_humanized);
           g_free (size_string);
@@ -498,7 +498,7 @@ thunar_size_label_status_update (ThunarDeepCountJob *job,
   n = file_count + directory_count + unreadable_directory_count;
 
   /* update the label */
-  size_string = g_file_size_humanize (total_size);
+  size_string = g_format_size_for_display (total_size);
   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