[Xfce4-commits] [xfce/thunar] 01/02: Add setting to show file sizes in bytes (bug #11690) - fix for overwrite confirmation dialog

noreply at xfce.org noreply at xfce.org
Fri Feb 9 10:26:53 CET 2018


This is an automated email from the git hooks/post-receive script.

a   l   e   x       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/thunar.

commit b2d7b1e515e744c94eb45a3d31e7b1a0b48053b0
Author: Alexander Schwinn <acs82 at gmx.de>
Date:   Fri Feb 9 10:14:05 2018 +0100

    Add setting to show file sizes in bytes (bug #11690)
    - fix for overwrite confirmation dialog
---
 thunar/thunar-dialogs.c |  4 ++--
 thunar/thunar-file.c    | 26 +++++++++++++++++++++++++-
 thunar/thunar-file.h    |  2 ++
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/thunar/thunar-dialogs.c b/thunar/thunar-dialogs.c
index 5d5da96..97980bd 100644
--- a/thunar/thunar-dialogs.c
+++ b/thunar/thunar-dialogs.c
@@ -632,7 +632,7 @@ thunar_dialogs_show_job_ask_replace (GtkWindow  *parent,
   g_object_unref (G_OBJECT (icon));
   gtk_widget_show (image);
 
-  size_string = thunar_file_get_size_string_formatted (dst_file, file_size_binary);
+  size_string = thunar_file_get_size_string_long (dst_file, file_size_binary);
   date_string = thunar_file_get_date_string (dst_file, THUNAR_FILE_DATE_MODIFIED, date_style);
   text = g_strdup_printf ("%s %s\n%s %s", _("Size:"), size_string, _("Modified:"), date_string);
   label = gtk_label_new (text);
@@ -668,7 +668,7 @@ thunar_dialogs_show_job_ask_replace (GtkWindow  *parent,
   g_object_unref (G_OBJECT (icon));
   gtk_widget_show (image);
 
-  size_string = thunar_file_get_size_string_formatted (src_file, file_size_binary);
+  size_string = thunar_file_get_size_string_long (src_file, file_size_binary);
   date_string = thunar_file_get_date_string (src_file, THUNAR_FILE_DATE_MODIFIED, date_style);
   text = g_strdup_printf ("%s %s\n%s %s", _("Size:"), size_string, _("Modified:"), date_string);
   label = gtk_label_new (text);
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 5348484..8d61bf0 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -2304,7 +2304,7 @@ thunar_file_get_size_string (const ThunarFile *file)
  * You'll need to free the result using g_free()
  * if you're done with it.
  *
- * Return value: the size of @file in a human readable format.
+ * Return value: the size of @file in bytes.
  **/
 gchar *
 thunar_file_get_size_in_bytes_string (const ThunarFile *file)
@@ -2339,6 +2339,30 @@ thunar_file_get_size_string_formatted (const ThunarFile *file, const gboolean fi
 
 
 /**
+ * thunar_file_get_size_string_long:
+ * @file             : a #ThunarFile instance.
+ * @file_size_binary : indicates if file size format
+ *                     should be binary or not.
+ *
+ * Returns the size of the file as text in a human readable
+ * format in decimal or binary format, including the exact
+ * size in bytes. You'll need to free the result using
+ * g_free() if you're done with it.
+ *
+ * Return value: the size of @file in a human readable
+ *               format, including size in bytes.
+ **/
+gchar *
+thunar_file_get_size_string_long (const ThunarFile *file, const gboolean file_size_binary)
+{
+  _thunar_return_val_if_fail (THUNAR_IS_FILE (file), NULL);
+  return g_format_size_full (thunar_file_get_size (file),
+                             G_FORMAT_SIZE_LONG_FORMAT | (file_size_binary ? G_FORMAT_SIZE_IEC_UNITS : G_FORMAT_SIZE_DEFAULT));
+}
+
+
+
+/**
  * thunar_file_get_volume:
  * @file           : a #ThunarFile instance.
  *
diff --git a/thunar/thunar-file.h b/thunar/thunar-file.h
index f16a3e3..73000e4 100644
--- a/thunar/thunar-file.h
+++ b/thunar/thunar-file.h
@@ -171,6 +171,8 @@ gchar            *thunar_file_get_size_string            (const ThunarFile
 gchar            *thunar_file_get_size_in_bytes_string   (const ThunarFile       *file) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
 gchar            *thunar_file_get_size_string_formatted  (const ThunarFile       *file,
                                                           const gboolean          file_size_binary);
+gchar            *thunar_file_get_size_string_long       (const ThunarFile       *file,
+                                                          const gboolean          file_size_binary);
 
 GVolume          *thunar_file_get_volume                 (const ThunarFile       *file);
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list