Rework usage of binary file size properties (bug #11450)
authorHarald Judt <h.judt@gmx.at>
Sun, 8 Mar 2015 10:31:01 +0000 (11:31 +0100)
committerTJ <ubuntu@iam.tj>
Mon, 25 Jan 2016 02:37:12 +0000 (02:37 +0000)
Move get_property calls to the object initialization and, where
appropriate, use signals to notify of any misc-file-size-binary
preference changes. This way, all components should update immediately
whenever the preference changes, while still being nice to performance.

thunar/thunar-gio-extensions.c
thunar/thunar-gio-extensions.h
thunar/thunar-list-model.c
thunar/thunar-list-model.h
thunar/thunar-properties-dialog.c
thunar/thunar-shortcuts-model.c
thunar/thunar-size-label.c
thunar/thunar-standard-view.c
thunar/thunar-transfer-job.c

index 89e92fa..cacb70e 100644 (file)
@@ -409,22 +409,16 @@ thunar_g_file_get_free_space (GFile   *file,
 
 
 gchar *
-thunar_g_file_get_free_space_string (GFile *file)
+thunar_g_file_get_free_space_string (GFile *file, gboolean file_size_binary)
 {
   gchar             *fs_free_str;
   gchar             *fs_size_str;
   guint64            fs_free;
   guint64            fs_size;
   gchar             *fs_string = NULL;
-  ThunarPreferences *preferences;
-  gboolean           file_size_binary;
 
   _thunar_return_val_if_fail (G_IS_FILE (file), NULL);
 
-  preferences = thunar_preferences_get ();
-  g_object_get (preferences, "misc-file-size-binary", &file_size_binary, NULL);
-  g_object_unref (preferences);
-
   if (thunar_g_file_get_free_space (file, &fs_free, &fs_size)
       && fs_size > 0)
     {
index c19101e..7d8922d 100644 (file)
@@ -55,7 +55,8 @@ gboolean  thunar_g_file_get_free_space           (GFile                *file,
                                                   guint64              *fs_free_return,
                                                   guint64              *fs_size_return);
 
-gchar    *thunar_g_file_get_free_space_string    (GFile                *file);
+gchar    *thunar_g_file_get_free_space_string    (GFile                *file,
+                                                  gboolean              file_size_binary);
 
 /**
  * THUNAR_TYPE_G_FILE_LIST:
index eb06c95..a93c3e1 100644 (file)
@@ -185,6 +185,7 @@ static gint               thunar_list_model_get_num_files         (ThunarListMod
 static gboolean           thunar_list_model_get_folders_first     (ThunarListModel        *store);
 
 
+
 struct _ThunarListModelClass
 {
   GObjectClass __parent__;
@@ -1965,6 +1966,57 @@ thunar_list_model_set_show_hidden (ThunarListModel *store,
 
 
 
+/**
+ * thunar_list_model_get_file_size_binary:
+ * @store : a valid #ThunarListModel object.
+ *
+ * Returns %TRUE if the file size should be formatted
+ * as binary.
+ *
+ * Return value: %TRUE if file size format is binary.
+ **/
+gboolean
+thunar_list_model_get_file_size_binary (ThunarListModel *store)
+{
+  _thunar_return_val_if_fail (THUNAR_IS_LIST_MODEL (store), FALSE);
+  return store->file_size_binary;
+}
+
+
+
+/**
+ * thunar_list_model_set_file_size_binary:
+ * @store            : a valid #ThunarListModel object.
+ * @file_size_binary : %TRUE to format file size as binary.
+ *
+ * If @file_size_binary is %TRUE the file size should be
+ * formatted as binary.
+ **/
+void
+thunar_list_model_set_file_size_binary (ThunarListModel *store,
+                                        gboolean         file_size_binary)
+{
+  _thunar_return_if_fail (THUNAR_IS_LIST_MODEL (store));
+
+  /* normalize the setting */
+  file_size_binary = !!file_size_binary;
+
+  /* check if we have a new setting */
+  if (store->file_size_binary != file_size_binary)
+    {
+      /* apply the new setting */
+      store->file_size_binary = file_size_binary;
+
+      /* resort the model with the new setting */
+      thunar_list_model_sort (store);
+
+      /* notify listeners */
+      g_object_notify_by_pspec (G_OBJECT (store), list_model_props[PROP_FILE_SIZE_BINARY]);
+    }
+}
+
+
+
 /**
  * thunar_list_model_get_file:
  * @store : a #ThunarListModel.
index 9392a02..c930c19 100644 (file)
@@ -49,6 +49,10 @@ gboolean         thunar_list_model_get_show_hidden        (ThunarListModel  *sto
 void             thunar_list_model_set_show_hidden        (ThunarListModel  *store,
                                                            gboolean          show_hidden);
 
+gboolean         thunar_list_model_get_file_size_binary   (ThunarListModel  *store);
+void             thunar_list_model_set_file_size_binary   (ThunarListModel  *store,
+                                                           gboolean          file_size_binary);
+
 ThunarFile      *thunar_list_model_get_file               (ThunarListModel  *store,
                                                            GtkTreeIter      *iter);
 
index f5e5483..5834ece 100644 (file)
@@ -64,6 +64,7 @@ enum
 {
   PROP_0,
   PROP_FILES,
+  PROP_FILE_SIZE_BINARY,
 };
 
 /* Signal identifiers */
@@ -118,6 +119,7 @@ struct _ThunarPropertiesDialog
   ThunarPreferences      *preferences;
 
   GList                  *files;
+  gboolean                file_size_binary;
 
   ThunarThumbnailer      *thumbnailer;
   guint                   thumbnail_request;
@@ -180,6 +182,19 @@ thunar_properties_dialog_class_init (ThunarPropertiesDialogClass *klass)
                                                         THUNARX_TYPE_FILE_INFO_LIST,
                                                         EXO_PARAM_READWRITE));
 
+  /**
+   * ThunarPropertiesDialog:file_size_binary:
+   *
+   * Whether the file size should be shown in binary or decimal.
+   **/
+  g_object_class_install_property (gobject_class,
+                                   PROP_FILE_SIZE_BINARY,
+                                   g_param_spec_boolean ("file-size-binary",
+                                                         "FileSizeBinary",
+                                                         NULL,
+                                                         FALSE,
+                                                         EXO_PARAM_READWRITE));
+
   /**
    * ThunarPropertiesDialog::reload:
    * @dialog : a #ThunarPropertiesDialog.
@@ -215,10 +230,15 @@ thunar_properties_dialog_init (ThunarPropertiesDialog *dialog)
   guint      row = 0;
   GtkWidget *image;
 
-  /* acquire a reference on the preferences and monitor the "misc-date-style" setting */
+  /* acquire a reference on the preferences and monitor the
+     "misc-date-style" and "misc-file-size-binary" settings */
   dialog->preferences = thunar_preferences_get ();
   g_signal_connect_swapped (G_OBJECT (dialog->preferences), "notify::misc-date-style",
                             G_CALLBACK (thunar_properties_dialog_reload), dialog);
+  exo_binding_new (G_OBJECT (dialog->preferences), "misc-file-size-binary",
+                   G_OBJECT (dialog), "file-size-binary");
+  g_signal_connect_swapped (G_OBJECT (dialog->preferences), "notify::misc-file-size-binary",
+                            G_CALLBACK (thunar_properties_dialog_reload), dialog);
 
   /* create a new thumbnailer */
   dialog->thumbnailer = thunar_thumbnailer_get ();
@@ -594,6 +614,10 @@ thunar_properties_dialog_get_property (GObject    *object,
       g_value_set_boxed (value, thunar_properties_dialog_get_files (dialog));
       break;
 
+    case PROP_FILE_SIZE_BINARY:
+      g_value_set_boolean (value, dialog->file_size_binary);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -616,6 +640,10 @@ thunar_properties_dialog_set_property (GObject      *object,
       thunar_properties_dialog_set_files (dialog, g_value_get_boxed (value));
       break;
 
+    case PROP_FILE_SIZE_BINARY:
+      dialog->file_size_binary = g_value_get_boolean (value);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1035,7 +1063,14 @@ thunar_properties_dialog_update_single (ThunarPropertiesDialog *dialog)
   /* update the free space (only for folders) */
   if (thunar_file_is_directory (file))
     {
-      fs_string = thunar_g_file_get_free_space_string (thunar_file_get_file (file));
+      fs_string = thunar_g_file_get_free_space_string (thunar_file_get_file (file),
+                                                       dialog->file_size_binary);
+      if (thunar_g_file_get_free_space (thunar_file_get_file (file), &fs_free, &fs_size)
+          && fs_size > 0)
+        {
+          /* free disk space fraction */
+          fs_fraction = ((fs_size - fs_free) * 100 / fs_size);
+        }
       if (fs_string != NULL)
         {
           gtk_label_set_text (GTK_LABEL (dialog->freespace_label), fs_string);
index ab4c74d..996750b 100644 (file)
@@ -62,7 +62,8 @@ typedef struct _ThunarShortcut ThunarShortcut;
 enum
 {
   PROP_0,
-  PROP_HIDDEN_BOOKMARKS
+  PROP_HIDDEN_BOOKMARKS,
+  PROP_FILE_SIZE_BINARY
 };
 
 
@@ -171,6 +172,7 @@ struct _ThunarShortcutsModel
 
   ThunarPreferences    *preferences;
   gchar               **hidden_bookmarks;
+  gboolean              file_size_binary;
 
   ThunarDeviceMonitor  *device_monitor;
 
@@ -226,6 +228,19 @@ thunar_shortcuts_model_class_init (ThunarShortcutsModelClass *klass)
                                                        NULL,
                                                        G_TYPE_STRV,
                                                        EXO_PARAM_READWRITE));
+
+  /**
+   * ThunarPropertiesDialog:file_size_binary:
+   *
+   * Whether the file size should be shown in binary or decimal.
+   **/
+  g_object_class_install_property (gobject_class,
+                                   PROP_FILE_SIZE_BINARY,
+                                   g_param_spec_boolean ("file-size-binary",
+                                                         "FileSizeBinary",
+                                                         NULL,
+                                                         FALSE,
+                                                         EXO_PARAM_READWRITE));
 }
 
 
@@ -271,6 +286,10 @@ thunar_shortcuts_model_init (ThunarShortcutsModel *model)
   exo_binding_new (G_OBJECT (model->preferences), "hidden-bookmarks",
                    G_OBJECT (model), "hidden-bookmarks");
 
+  /* binary file size */
+  exo_binding_new (G_OBJECT (model->preferences), "misc-file-size-binary",
+                   G_OBJECT (model), "file-size-binary");
+
   /* load volumes */
   thunar_shortcuts_model_shortcut_devices (model);
 
@@ -302,6 +321,9 @@ thunar_shortcuts_model_finalize (GObject *object)
   g_list_foreach (model->shortcuts, (GFunc) thunar_shortcut_free, model);
   g_list_free (model->shortcuts);
 
+  /* disconnect from the preferences */
+  g_object_unref (model->preferences);
+
   /* free hidden list */
   g_strfreev (model->hidden_bookmarks);
 
@@ -338,6 +360,10 @@ thunar_shortcuts_model_get_property (GObject    *object,
       g_value_set_boxed (value, model->hidden_bookmarks);
       break;
 
+    case PROP_FILE_SIZE_BINARY:
+      g_value_set_boolean (value, model->file_size_binary);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -394,6 +420,10 @@ thunar_shortcuts_model_set_property (GObject      *object,
       thunar_shortcuts_model_header_visibility (model);
       break;
 
+    case PROP_FILE_SIZE_BINARY:
+      model->file_size_binary = g_value_get_boolean (value);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -530,6 +560,7 @@ thunar_shortcuts_model_get_value (GtkTreeModel *tree_model,
   guint32         trash_items;
   gchar          *trash_string;
   gchar          *parse_name;
+  gboolean        file_size_binary;
 
   _thunar_return_if_fail (iter->stamp == THUNAR_SHORTCUTS_MODEL (tree_model)->stamp);
   _thunar_return_if_fail (THUNAR_IS_SHORTCUTS_MODEL (tree_model));
@@ -583,7 +614,8 @@ thunar_shortcuts_model_get_value (GtkTreeModel *tree_model,
 
           if (file != NULL)
             {
-              disk_usage = thunar_g_file_get_free_space_string (file);
+              file_size_binary = THUNAR_SHORTCUTS_MODEL (tree_model)->file_size_binary;
+              disk_usage = thunar_g_file_get_free_space_string (file, file_size_binary);
               g_object_unref (file);
               g_value_take_string (value, disk_usage);
             }
index f33e19a..c69623f 100644 (file)
@@ -43,6 +43,7 @@ enum
 {
   PROP_0,
   PROP_FILES,
+  PROP_FILE_SIZE_BINARY
 };
 
 
@@ -87,8 +88,10 @@ struct _ThunarSizeLabel
   GtkHBox             __parent__;
 
   ThunarDeepCountJob *job;
+  ThunarPreferences  *preferences;
 
   GList              *files;
+  gboolean            file_size_binary;
 
   GtkWidget          *label;
   GtkWidget          *spinner;
@@ -121,6 +124,19 @@ thunar_size_label_class_init (ThunarSizeLabelClass *klass)
                                    g_param_spec_boxed ("files", "files", "files",
                                                        THUNARX_TYPE_FILE_INFO_LIST,
                                                        EXO_PARAM_READWRITE));
+
+  /**
+   * ThunarPropertiesDialog:file_size_binary:
+   *
+   * Whether the file size should be shown in binary or decimal.
+   **/
+  g_object_class_install_property (gobject_class,
+                                   PROP_FILE_SIZE_BINARY,
+                                   g_param_spec_boolean ("file-size-binary",
+                                                         "FileSizeBinary",
+                                                         NULL,
+                                                         FALSE,
+                                                         EXO_PARAM_READWRITE));
 }
 
 
@@ -130,6 +146,12 @@ thunar_size_label_init (ThunarSizeLabel *size_label)
 {
   GtkWidget *ebox;
 
+  /* binary file size */
+  size_label->preferences = thunar_preferences_get ();
+  exo_binding_new (G_OBJECT (size_label->preferences), "misc-file-size-binary",
+                   G_OBJECT (size_label), "file-size-binary");
+  g_signal_connect_swapped (G_OBJECT (size_label->preferences), "notify::misc-file-size-binary",
+                            G_CALLBACK (thunar_size_label_files_changed), size_label);
   gtk_widget_push_composite_child ();
 
   /* configure the box */
@@ -177,6 +199,10 @@ thunar_size_label_finalize (GObject *object)
   /* reset the file property */
   thunar_size_label_set_files (size_label, NULL);
 
+  /* disconnect from the preferences */
+  g_signal_handlers_disconnect_by_func (size_label->preferences, thunar_size_label_files_changed, size_label);
+  g_object_unref (size_label->preferences);
+
   (*G_OBJECT_CLASS (thunar_size_label_parent_class)->finalize) (object);
 }
 
@@ -196,6 +222,10 @@ thunar_size_label_get_property (GObject    *object,
       g_value_set_boxed (value, thunar_size_label_get_files (size_label));
       break;
 
+    case PROP_FILE_SIZE_BINARY:
+      g_value_set_boolean (value, size_label->file_size_binary);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -218,6 +248,10 @@ thunar_size_label_set_property (GObject      *object,
       thunar_size_label_set_files (size_label, g_value_get_boxed (value));
       break;
 
+    case PROP_FILE_SIZE_BINARY:
+      size_label->file_size_binary = g_value_get_boolean (value);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -267,17 +301,11 @@ thunar_size_label_files_changed (ThunarSizeLabel *size_label)
 {
   gchar             *size_string;
   guint64            size;
-  ThunarPreferences *preferences;
-  gboolean           file_size_binary;
 
   _thunar_return_if_fail (THUNAR_IS_SIZE_LABEL (size_label));
   _thunar_return_if_fail (size_label->files != NULL);
   _thunar_return_if_fail (THUNAR_IS_FILE (size_label->files->data));
 
-  preferences = thunar_preferences_get ();
-  g_object_get (preferences, "misc-file-size-binary", &file_size_binary, NULL);
-  g_object_unref (preferences);
-
   /* cancel the pending job (if any) */
   if (G_UNLIKELY (size_label->job != NULL))
     {
@@ -315,7 +343,7 @@ thunar_size_label_files_changed (ThunarSizeLabel *size_label)
       size = thunar_file_get_size (THUNAR_FILE (size_label->files->data));
 
       /* setup the new label */
-      size_string = g_format_size_full (size, file_size_binary ? G_FORMAT_SIZE_LONG_FORMAT | G_FORMAT_SIZE_IEC_UNITS : G_FORMAT_SIZE_LONG_FORMAT);
+      size_string = g_format_size_full (size, size_label->file_size_binary ? G_FORMAT_SIZE_LONG_FORMAT | G_FORMAT_SIZE_IEC_UNITS : G_FORMAT_SIZE_LONG_FORMAT);
       gtk_label_set_text (GTK_LABEL (size_label->label), size_string);
       g_free (size_string);
     }
@@ -370,24 +398,18 @@ thunar_size_label_status_update (ThunarDeepCountJob *job,
   gchar             *text;
   guint              n;
   gchar             *unreable_text;
-  ThunarPreferences *preferences;
-  gboolean           file_size_binary;
 
   _thunar_return_if_fail (THUNAR_IS_DEEP_COUNT_JOB (job));
   _thunar_return_if_fail (THUNAR_IS_SIZE_LABEL (size_label));
   _thunar_return_if_fail (size_label->job == job);
 
-  preferences = thunar_preferences_get ();
-  g_object_get (preferences, "misc-file-size-binary", &file_size_binary, NULL);
-  g_object_unref (preferences);
-
   /* determine the total number of items */
   n = file_count + directory_count + unreadable_directory_count;
 
   if (G_LIKELY (n > unreadable_directory_count))
     {
       /* update the label */
-      size_string = g_format_size_full (total_size, file_size_binary ? G_FORMAT_SIZE_IEC_UNITS : G_FORMAT_SIZE_DEFAULT);
+      size_string = g_format_size_full (total_size, size_label->file_size_binary ? G_FORMAT_SIZE_IEC_UNITS : G_FORMAT_SIZE_DEFAULT);
       text = g_strdup_printf (ngettext ("%u item, totalling %s", "%u items, totalling %s", n), n, size_string);
       g_free (size_string);
       
index ad4af3a..6ba5996 100644 (file)
@@ -712,6 +712,9 @@ thunar_standard_view_init (ThunarStandardView *standard_view)
    */
   g_signal_connect_swapped (G_OBJECT (standard_view->model), "notify::num-files", G_CALLBACK (thunar_standard_view_update_statusbar_text), standard_view);
 
+  /* be sure to update the statusbar text whenever the file-size-binary property changes */
+  g_signal_connect_swapped (G_OBJECT (standard_view->model), "notify::file-size-binary", G_CALLBACK (thunar_standard_view_update_statusbar_text), standard_view);
+
   /* connect to size allocation signals for generating thumbnail requests */
   g_signal_connect_after (G_OBJECT (standard_view), "size-allocate",
                           G_CALLBACK (thunar_standard_view_size_allocate), NULL);
index 2f15c71..82482e0 100644 (file)
 
 
 
+/* Property identifiers */
+enum
+{
+  PROP_0,
+  PROP_FILE_SIZE_BINARY,
+};
+
+
+
 typedef struct _ThunarTransferNode ThunarTransferNode;
 
 
 
+static void     thunar_transfer_job_get_property (GObject    *object,
+                                                  guint       prop_id,
+                                                  GValue     *value,
+                                                  GParamSpec *pspec);
+
+static void     thunar_transfer_job_set_property (GObject      *object,
+                                                  guint         prop_id,
+                                                  const GValue *value,
+                                                  GParamSpec   *pspec);
+
 static void     thunar_transfer_job_finalize     (GObject                *object);
 static gboolean thunar_transfer_job_execute      (ExoJob                 *job,
                                                   GError                **error);
@@ -74,6 +93,9 @@ struct _ThunarTransferJob
   guint64               total_progress;
   guint64               file_progress;
   guint64               transfer_rate;
+
+  ThunarPreferences    *preferences;
+  gboolean              file_size_binary;
 };
 
 struct _ThunarTransferNode
@@ -97,9 +119,24 @@ thunar_transfer_job_class_init (ThunarTransferJobClass *klass)
 
   gobject_class = G_OBJECT_CLASS (klass);
   gobject_class->finalize = thunar_transfer_job_finalize;
+  gobject_class->get_property = thunar_transfer_job_get_property;
+  gobject_class->set_property = thunar_transfer_job_set_property;
 
   exojob_class = EXO_JOB_CLASS (klass);
   exojob_class->execute = thunar_transfer_job_execute;
+
+  /**
+   * ThunarPropertiesDialog:file_size_binary:
+   *
+   * Whether the file size should be shown in binary or decimal.
+   **/
+  g_object_class_install_property (gobject_class,
+                                   PROP_FILE_SIZE_BINARY,
+                                   g_param_spec_boolean ("file-size-binary",
+                                                         "FileSizeBinary",
+                                                         NULL,
+                                                         FALSE,
+                                                         EXO_PARAM_READWRITE));
 }
 
 
@@ -107,6 +144,10 @@ thunar_transfer_job_class_init (ThunarTransferJobClass *klass)
 static void
 thunar_transfer_job_init (ThunarTransferJob *job)
 {
+  job->preferences = thunar_preferences_get ();
+  exo_binding_new (G_OBJECT (job->preferences), "misc-file-size-binary",
+                   G_OBJECT (job), "file-size-binary");
+
   job->type = 0;
   job->source_node_list = NULL;
   job->target_file_list = NULL;
@@ -130,11 +171,57 @@ thunar_transfer_job_finalize (GObject *object)
 
   thunar_g_file_list_free (job->target_file_list);
 
+  g_object_unref (job->preferences);
+
   (*G_OBJECT_CLASS (thunar_transfer_job_parent_class)->finalize) (object);
 }
 
 
 
+static void
+thunar_transfer_job_get_property (GObject     *object,
+                                  guint        prop_id,
+                                  GValue      *value,
+                                  GParamSpec  *pspec)
+{
+  ThunarTransferJob *job = THUNAR_TRANSFER_JOB (object);
+
+  switch (prop_id)
+    {
+    case PROP_FILE_SIZE_BINARY:
+      g_value_set_boolean (value, job->file_size_binary);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+
+
+static void
+thunar_transfer_job_set_property (GObject      *object,
+                                  guint         prop_id,
+                                  const GValue *value,
+                                  GParamSpec   *pspec)
+{
+  ThunarTransferJob *job = THUNAR_TRANSFER_JOB (object);
+
+  switch (prop_id)
+    {
+    case PROP_FILE_SIZE_BINARY:
+      job->file_size_binary = g_value_get_boolean (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+
+
 static void
 thunar_transfer_job_progress (goffset  current_num_bytes,
                               goffset  total_num_bytes,
@@ -670,26 +757,20 @@ retry_remove:
 
 
 static gboolean
-thunar_transfer_job_veryify_destination (ThunarTransferJob  *transfer_job,
-                                         GError            **error)
+thunar_transfer_job_verify_destination (ThunarTransferJob  *transfer_job,
+                                        GError            **error)
 {
   GFileInfo         *filesystem_info;
-  guint64             free_space;
+  guint64            free_space;
   GFile             *dest;
   GFileInfo         *dest_info;
   gchar             *dest_name = NULL;
   gchar             *base_name;
   gboolean           succeed = TRUE;
   gchar             *size_string;
-  ThunarPreferences *preferences;
-  gboolean           file_size_binary;
 
   _thunar_return_val_if_fail (THUNAR_IS_TRANSFER_JOB (transfer_job), FALSE);
 
-  preferences = thunar_preferences_get ();
-  g_object_get (preferences, "misc-file-size-binary", &file_size_binary, NULL);
-  g_object_unref (preferences);
-
   /* no target file list */
   if (transfer_job->target_file_list == NULL)
     return TRUE;
@@ -736,7 +817,8 @@ thunar_transfer_job_veryify_destination (ThunarTransferJob  *transfer_job,
       free_space = g_file_info_get_attribute_uint64 (filesystem_info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
       if (transfer_job->total_size > free_space)
         {
-          size_string = g_format_size_full (transfer_job->total_size - free_space, file_size_binary ? G_FORMAT_SIZE_IEC_UNITS : G_FORMAT_SIZE_DEFAULT);
+          size_string = g_format_size_full (transfer_job->total_size - free_space,
+                                            transfer_job->file_size_binary ? G_FORMAT_SIZE_IEC_UNITS : G_FORMAT_SIZE_DEFAULT);
           succeed = thunar_job_ask_no_size (THUNAR_JOB (transfer_job),
                                              _("Error while copying to \"%s\": %s more space is "
                                                "required to copy to the destination"),
@@ -954,7 +1036,7 @@ thunar_transfer_job_execute (ExoJob  *job,
   if (G_LIKELY (err == NULL))
     {
       /* check destination */
-      if (!thunar_transfer_job_veryify_destination (transfer_job, &err))
+      if (!thunar_transfer_job_verify_destination (transfer_job, &err))
         {
           if (err != NULL)
             {
@@ -1080,20 +1162,14 @@ thunar_transfer_job_get_status (ThunarTransferJob *job)
   gchar             *transfer_rate_str;
   GString           *status;
   gulong             remaining_time;
-  ThunarPreferences *preferences;
-  gboolean           file_size_binary;
 
   _thunar_return_val_if_fail (THUNAR_IS_TRANSFER_JOB (job), NULL);
 
-  preferences = thunar_preferences_get ();
-  g_object_get (preferences, "misc-file-size-binary", &file_size_binary, NULL);
-  g_object_unref (preferences);
-
   status = g_string_sized_new (100);
 
   /* transfer status like "22.6MB of 134.1MB" */
-  total_size_str = g_format_size_full (job->total_size, file_size_binary ? G_FORMAT_SIZE_IEC_UNITS : G_FORMAT_SIZE_DEFAULT);
-  total_progress_str = g_format_size_full (job->total_progress, file_size_binary ? G_FORMAT_SIZE_IEC_UNITS : G_FORMAT_SIZE_DEFAULT);
+  total_size_str = g_format_size_full (job->total_size, job->file_size_binary ? G_FORMAT_SIZE_IEC_UNITS : G_FORMAT_SIZE_DEFAULT);
+  total_progress_str = g_format_size_full (job->total_progress, job->file_size_binary ? G_FORMAT_SIZE_IEC_UNITS : G_FORMAT_SIZE_DEFAULT);
   g_string_append_printf (status, _("%s of %s"), total_progress_str, total_size_str);
   g_free (total_size_str);
   g_free (total_progress_str);
@@ -1103,7 +1179,7 @@ thunar_transfer_job_get_status (ThunarTransferJob *job)
       && (job->last_update_time - job->start_time) > MINIMUM_TRANSFER_TIME)
     {
       /* remaining time based on the transfer speed */
-      transfer_rate_str = g_format_size_full (job->transfer_rate, file_size_binary ? G_FORMAT_SIZE_IEC_UNITS : G_FORMAT_SIZE_DEFAULT);
+      transfer_rate_str = g_format_size_full (job->transfer_rate, job->file_size_binary ? G_FORMAT_SIZE_IEC_UNITS : G_FORMAT_SIZE_DEFAULT);
       remaining_time = (job->total_size - job->total_progress) / job->transfer_rate;
 
       if (remaining_time > 0)