From 8f49b91ebb936f0311e9ee9ae1d5ce5922a97ada Mon Sep 17 00:00:00 2001 From: Alexander Schwinn Date: Fri, 16 Feb 2018 23:43:30 +0100 Subject: [PATCH] Add option for directories in detailed view: Show number of items instead of size (bug #10338) --- thunar/thunar-column-editor.c | 31 ++++ thunar/thunar-folder.c | 62 ++++++++ thunar/thunar-folder.h | 1 + thunar/thunar-list-model.c | 350 +++++++++++++++++++++++++++--------------- thunar/thunar-preferences.c | 11 ++ thunar/thunar-standard-view.c | 1 + 6 files changed, 334 insertions(+), 122 deletions(-) diff --git a/thunar/thunar-column-editor.c b/thunar/thunar-column-editor.c index 7761984c..3d338e5f 100644 --- a/thunar/thunar-column-editor.c +++ b/thunar/thunar-column-editor.c @@ -269,6 +269,37 @@ thunar_column_editor_init (ThunarColumnEditor *column_editor) thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), button); gtk_widget_show (button); + frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL); + gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0); + gtk_widget_show (frame); + + label = gtk_label_new (_("File size of folders")); + gtk_label_set_attributes (GTK_LABEL (label), thunar_pango_attr_list_bold ()); + gtk_frame_set_label_widget (GTK_FRAME (frame), label); + gtk_widget_show (label); + + grid = gtk_grid_new (); + gtk_grid_set_column_spacing (GTK_GRID (grid), 6); + gtk_grid_set_row_spacing (GTK_GRID (grid), 6); + gtk_container_set_border_width (GTK_CONTAINER (grid), 12); + gtk_container_add (GTK_CONTAINER (frame), grid); + gtk_widget_show (grid); + + /* explain what it does */ + label = gtk_label_new (_("When the column 'size' is selected, you may choose to show the\n" + "number of items in a folder instead of the fixed folder size.")); + gtk_label_set_xalign (GTK_LABEL (label), 0.0f); + gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1); + gtk_widget_show (label); + + /* create the "Display number of files in size column of folders" button */ + button = gtk_check_button_new_with_mnemonic (_("Display the number of items instead of the fixed size")); + exo_mutual_binding_new (G_OBJECT (column_editor->preferences), "misc-items-count-as-dir-size", G_OBJECT (button), "active"); + gtk_widget_set_tooltip_text (button, _("Select this option to show the number of files in the 'size' column of folders.")); + gtk_widget_set_hexpand (button, TRUE); + gtk_grid_attach (GTK_GRID (grid), button, 0, 4, 2, 1); + gtk_widget_show (button); + /* setup the tree selection */ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (column_editor->tree_view)); g_signal_connect_swapped (G_OBJECT (selection), "changed", G_CALLBACK (thunar_column_editor_update_buttons), column_editor); diff --git a/thunar/thunar-folder.c b/thunar/thunar-folder.c index a90988e4..0e52d129 100644 --- a/thunar/thunar-folder.c +++ b/thunar/thunar-folder.c @@ -111,6 +111,9 @@ struct _ThunarFolder GList *files; gboolean reload_info; + guint32 file_count; + gboolean file_count_is_cached; + GList *content_type_ptr; guint content_type_idle_id; @@ -937,6 +940,62 @@ thunar_folder_get_files (const ThunarFolder *folder) /** + * thunar_folder_get_file_count: + * @file : a #ThunarFolder instance. + * + * Returns the number of items in the directory + * Counts the number of files in the directory as fast as possible. + * Will use cached data to do calculations only once + * + * Return value: Number of files in a folder + **/ +guint32 +thunar_folder_get_file_count (ThunarFolder *folder) +{ + _thunar_return_val_if_fail (THUNAR_IS_FOLDER (folder), 0); + + ThunarFile *file; + GFileEnumerator *enumerator; + GFileInfo *child_info; + + /* If we already have a cached value, just return it */ + if (G_LIKELY (folder->file_count_is_cached)) + return folder->file_count; + + /* If the content type loader already loaded the file-list, just count it*/ + if (folder->files != NULL) + { + folder->file_count = g_list_length (folder->files); + folder->file_count_is_cached = TRUE; + return folder->file_count; + } + + /* As fallback we will go through the list of gfiles */ + file = thunar_folder_get_corresponding_file (folder); + enumerator = g_file_enumerate_children (thunar_file_get_file (file), NULL, + G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, + NULL, NULL); + if(!enumerator) + return 0; + + folder->file_count = 0; + child_info = g_file_enumerator_next_file (enumerator, NULL, NULL); + while (child_info) + { + ++(folder->file_count); + g_object_unref (child_info); + child_info = g_file_enumerator_next_file (enumerator, NULL, NULL); + } + g_file_enumerator_close (enumerator, NULL, NULL); + g_object_unref (enumerator); + + folder->file_count_is_cached = TRUE; + return folder->file_count; +} + + + +/** * thunar_folder_get_loading: * @folder : a #ThunarFolder instance. * @@ -968,6 +1027,9 @@ thunar_folder_reload (ThunarFolder *folder, { _thunar_return_if_fail (THUNAR_IS_FOLDER (folder)); + folder->file_count = 0; + folder->file_count_is_cached = FALSE; + /* reload file info too? */ folder->reload_info = reload_info; diff --git a/thunar/thunar-folder.h b/thunar/thunar-folder.h index 1701b453..fc91e6f5 100644 --- a/thunar/thunar-folder.h +++ b/thunar/thunar-folder.h @@ -40,6 +40,7 @@ ThunarFolder *thunar_folder_get_for_file (ThunarFile *file); ThunarFile *thunar_folder_get_corresponding_file (const ThunarFolder *folder); GList *thunar_folder_get_files (const ThunarFolder *folder); +guint32 thunar_folder_get_file_count (ThunarFolder *folder); gboolean thunar_folder_get_loading (const ThunarFolder *folder); void thunar_folder_reload (ThunarFolder *folder, diff --git a/thunar/thunar-list-model.c b/thunar/thunar-list-model.c index 825b5147..528ba993 100644 --- a/thunar/thunar-list-model.c +++ b/thunar/thunar-list-model.c @@ -31,6 +31,7 @@ #endif #include +#include #include #include #include @@ -50,6 +51,7 @@ enum PROP_FOLDERS_FIRST, PROP_NUM_FILES, PROP_SHOW_HIDDEN, + PROP_ITEMS_COUNT_AS_DIR_SIZE, PROP_FILE_SIZE_BINARY, N_PROPERTIES }; @@ -69,125 +71,131 @@ typedef gint (*ThunarSortFunc) (const ThunarFile *a, -static void thunar_list_model_tree_model_init (GtkTreeModelIface *iface); -static void thunar_list_model_drag_dest_init (GtkTreeDragDestIface *iface); -static void thunar_list_model_sortable_init (GtkTreeSortableIface *iface); -static void thunar_list_model_dispose (GObject *object); -static void thunar_list_model_finalize (GObject *object); -static void thunar_list_model_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void thunar_list_model_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static GtkTreeModelFlags thunar_list_model_get_flags (GtkTreeModel *model); -static gint thunar_list_model_get_n_columns (GtkTreeModel *model); -static GType thunar_list_model_get_column_type (GtkTreeModel *model, - gint idx); -static gboolean thunar_list_model_get_iter (GtkTreeModel *model, - GtkTreeIter *iter, - GtkTreePath *path); -static GtkTreePath *thunar_list_model_get_path (GtkTreeModel *model, - GtkTreeIter *iter); -static void thunar_list_model_get_value (GtkTreeModel *model, - GtkTreeIter *iter, - gint column, - GValue *value); -static gboolean thunar_list_model_iter_next (GtkTreeModel *model, - GtkTreeIter *iter); -static gboolean thunar_list_model_iter_children (GtkTreeModel *model, - GtkTreeIter *iter, - GtkTreeIter *parent); -static gboolean thunar_list_model_iter_has_child (GtkTreeModel *model, - GtkTreeIter *iter); -static gint thunar_list_model_iter_n_children (GtkTreeModel *model, - GtkTreeIter *iter); -static gboolean thunar_list_model_iter_nth_child (GtkTreeModel *model, - GtkTreeIter *iter, - GtkTreeIter *parent, - gint n); -static gboolean thunar_list_model_iter_parent (GtkTreeModel *model, - GtkTreeIter *iter, - GtkTreeIter *child); -static gboolean thunar_list_model_drag_data_received (GtkTreeDragDest *dest, - GtkTreePath *path, - GtkSelectionData *data); -static gboolean thunar_list_model_row_drop_possible (GtkTreeDragDest *dest, - GtkTreePath *path, - GtkSelectionData *data); -static gboolean thunar_list_model_get_sort_column_id (GtkTreeSortable *sortable, - gint *sort_column_id, - GtkSortType *order); -static void thunar_list_model_set_sort_column_id (GtkTreeSortable *sortable, - gint sort_column_id, - GtkSortType order); -static void thunar_list_model_set_default_sort_func (GtkTreeSortable *sortable, - GtkTreeIterCompareFunc func, - gpointer data, - GDestroyNotify destroy); -static void thunar_list_model_set_sort_func (GtkTreeSortable *sortable, - gint sort_column_id, - GtkTreeIterCompareFunc func, - gpointer data, - GDestroyNotify destroy); -static gboolean thunar_list_model_has_default_sort_func (GtkTreeSortable *sortable); -static gint thunar_list_model_cmp_func (gconstpointer a, - gconstpointer b, - gpointer user_data); -static void thunar_list_model_sort (ThunarListModel *store); -static void thunar_list_model_file_changed (ThunarFileMonitor *file_monitor, - ThunarFile *file, - ThunarListModel *store); -static void thunar_list_model_folder_destroy (ThunarFolder *folder, - ThunarListModel *store); -static void thunar_list_model_folder_error (ThunarFolder *folder, - const GError *error, - ThunarListModel *store); -static void thunar_list_model_files_added (ThunarFolder *folder, - GList *files, - ThunarListModel *store); -static void thunar_list_model_files_removed (ThunarFolder *folder, - GList *files, - ThunarListModel *store); -static gint sort_by_date_accessed (const ThunarFile *a, - const ThunarFile *b, - gboolean case_sensitive); -static gint sort_by_date_modified (const ThunarFile *a, - const ThunarFile *b, - gboolean case_sensitive); -static gint sort_by_group (const ThunarFile *a, - const ThunarFile *b, - gboolean case_sensitive); -static gint sort_by_mime_type (const ThunarFile *a, - const ThunarFile *b, - gboolean case_sensitive); -static gint sort_by_owner (const ThunarFile *a, - const ThunarFile *b, - gboolean case_sensitive); -static gint sort_by_permissions (const ThunarFile *a, - const ThunarFile *b, - gboolean case_sensitive); -static gint sort_by_size (const ThunarFile *a, - const ThunarFile *b, - gboolean case_sensitive); -static gint sort_by_size_in_bytes (const ThunarFile *a, - const ThunarFile *b, - gboolean case_sensitive); -static gint sort_by_type (const ThunarFile *a, - const ThunarFile *b, - gboolean case_sensitive); - -static gboolean thunar_list_model_get_case_sensitive (ThunarListModel *store); -static void thunar_list_model_set_case_sensitive (ThunarListModel *store, - gboolean case_sensitive); -static ThunarDateStyle thunar_list_model_get_date_style (ThunarListModel *store); -static void thunar_list_model_set_date_style (ThunarListModel *store, - ThunarDateStyle date_style); -static gint thunar_list_model_get_num_files (ThunarListModel *store); -static gboolean thunar_list_model_get_folders_first (ThunarListModel *store); - +static void thunar_list_model_tree_model_init (GtkTreeModelIface *iface); +static void thunar_list_model_drag_dest_init (GtkTreeDragDestIface *iface); +static void thunar_list_model_sortable_init (GtkTreeSortableIface *iface); +static void thunar_list_model_dispose (GObject *object); +static void thunar_list_model_finalize (GObject *object); +static void thunar_list_model_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void thunar_list_model_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static GtkTreeModelFlags thunar_list_model_get_flags (GtkTreeModel *model); +static gint thunar_list_model_get_n_columns (GtkTreeModel *model); +static GType thunar_list_model_get_column_type (GtkTreeModel *model, + gint idx); +static gboolean thunar_list_model_get_iter (GtkTreeModel *model, + GtkTreeIter *iter, + GtkTreePath *path); +static GtkTreePath *thunar_list_model_get_path (GtkTreeModel *model, + GtkTreeIter *iter); +static void thunar_list_model_get_value (GtkTreeModel *model, + GtkTreeIter *iter, + gint column, + GValue *value); +static gboolean thunar_list_model_iter_next (GtkTreeModel *model, + GtkTreeIter *iter); +static gboolean thunar_list_model_iter_children (GtkTreeModel *model, + GtkTreeIter *iter, + GtkTreeIter *parent); +static gboolean thunar_list_model_iter_has_child (GtkTreeModel *model, + GtkTreeIter *iter); +static gint thunar_list_model_iter_n_children (GtkTreeModel *model, + GtkTreeIter *iter); +static gboolean thunar_list_model_iter_nth_child (GtkTreeModel *model, + GtkTreeIter *iter, + GtkTreeIter *parent, + gint n); +static gboolean thunar_list_model_iter_parent (GtkTreeModel *model, + GtkTreeIter *iter, + GtkTreeIter *child); +static gboolean thunar_list_model_drag_data_received (GtkTreeDragDest *dest, + GtkTreePath *path, + GtkSelectionData *data); +static gboolean thunar_list_model_row_drop_possible (GtkTreeDragDest *dest, + GtkTreePath *path, + GtkSelectionData *data); +static gboolean thunar_list_model_get_sort_column_id (GtkTreeSortable *sortable, + gint *sort_column_id, + GtkSortType *order); +static void thunar_list_model_set_sort_column_id (GtkTreeSortable *sortable, + gint sort_column_id, + GtkSortType order); +static void thunar_list_model_set_default_sort_func (GtkTreeSortable *sortable, + GtkTreeIterCompareFunc func, + gpointer data, + GDestroyNotify destroy); +static void thunar_list_model_set_sort_func (GtkTreeSortable *sortable, + gint sort_column_id, + GtkTreeIterCompareFunc func, + gpointer data, + GDestroyNotify destroy); +static gboolean thunar_list_model_has_default_sort_func (GtkTreeSortable *sortable); +static gint thunar_list_model_cmp_func (gconstpointer a, + gconstpointer b, + gpointer user_data); +static void thunar_list_model_sort (ThunarListModel *store); +static void thunar_list_model_file_changed (ThunarFileMonitor *file_monitor, + ThunarFile *file, + ThunarListModel *store); +static void thunar_list_model_folder_destroy (ThunarFolder *folder, + ThunarListModel *store); +static void thunar_list_model_folder_error (ThunarFolder *folder, + const GError *error, + ThunarListModel *store); +static void thunar_list_model_files_added (ThunarFolder *folder, + GList *files, + ThunarListModel *store); +static void thunar_list_model_files_removed (ThunarFolder *folder, + GList *files, + ThunarListModel *store); +static gint sort_by_date_accessed (const ThunarFile *a, + const ThunarFile *b, + gboolean case_sensitive); +static gint sort_by_date_modified (const ThunarFile *a, + const ThunarFile *b, + gboolean case_sensitive); +static gint sort_by_group (const ThunarFile *a, + const ThunarFile *b, + gboolean case_sensitive); +static gint sort_by_mime_type (const ThunarFile *a, + const ThunarFile *b, + gboolean case_sensitive); +static gint sort_by_owner (const ThunarFile *a, + const ThunarFile *b, + gboolean case_sensitive); +static gint sort_by_permissions (const ThunarFile *a, + const ThunarFile *b, + gboolean case_sensitive); +static gint sort_by_size (const ThunarFile *a, + const ThunarFile *b, + gboolean case_sensitive); +static gint sort_by_size_in_bytes (const ThunarFile *a, + const ThunarFile *b, + gboolean case_sensitive); +static gint sort_by_size_and_items_count (ThunarFile *a, + ThunarFile *b, + gboolean case_sensitive); +static gint sort_by_type (const ThunarFile *a, + const ThunarFile *b, + gboolean case_sensitive); + +static gboolean thunar_list_model_get_case_sensitive (ThunarListModel *store); +static void thunar_list_model_set_case_sensitive (ThunarListModel *store, + gboolean case_sensitive); +static ThunarDateStyle thunar_list_model_get_date_style (ThunarListModel *store); +static void thunar_list_model_set_date_style (ThunarListModel *store, + ThunarDateStyle date_style); +static gint thunar_list_model_get_num_files (ThunarListModel *store); +static gboolean thunar_list_model_get_folders_first (ThunarListModel *store); + +static gboolean thunar_list_model_get_items_count_as_dir_size (ThunarListModel *store); +static void thunar_list_model_set_items_count_as_dir_size (ThunarListModel *store, + gboolean items_count); struct _ThunarListModelClass @@ -215,6 +223,7 @@ struct _ThunarListModel GSList *hidden; ThunarFolder *folder; gboolean show_hidden : 1; + gboolean items_count_as_dir_size : 1; gboolean file_size_binary : 1; ThunarDateStyle date_style; @@ -345,6 +354,15 @@ thunar_list_model_class_init (ThunarListModelClass *klass) "file-size-binary", FALSE, EXO_PARAM_READWRITE); + /** + * ThunarListModel:items-count-as-dir-size: + **/ + list_model_props[PROP_ITEMS_COUNT_AS_DIR_SIZE] = + g_param_spec_boolean ("items-count-as-dir-size", + "items-count-as-dir-size", + "items-count-as-dir-size", + TRUE, + EXO_PARAM_READWRITE); /* install properties */ g_object_class_install_properties (gobject_class, N_PROPERTIES, list_model_props); @@ -501,6 +519,10 @@ thunar_list_model_get_property (GObject *object, g_value_set_boolean (value, thunar_list_model_get_file_size_binary (store)); break; + case PROP_ITEMS_COUNT_AS_DIR_SIZE: + g_value_set_boolean (value, thunar_list_model_get_items_count_as_dir_size (store)); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -543,6 +565,10 @@ thunar_list_model_set_property (GObject *object, thunar_list_model_set_file_size_binary (store, g_value_get_boolean (value)); break; + case PROP_ITEMS_COUNT_AS_DIR_SIZE: + thunar_list_model_set_items_count_as_dir_size (store, g_value_get_boolean (value)); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -675,6 +701,7 @@ thunar_list_model_get_value (GtkTreeModel *model, ThunarUser *user; ThunarFile *file; gchar *str; + guint32 item_count; _thunar_return_if_fail (THUNAR_IS_LIST_MODEL (model)); _thunar_return_if_fail (iter->stamp == (THUNAR_LIST_MODEL (model))->stamp); @@ -753,7 +780,13 @@ thunar_list_model_get_value (GtkTreeModel *model, case THUNAR_COLUMN_SIZE: g_value_init (value, G_TYPE_STRING); - g_value_take_string (value, thunar_file_get_size_string_formatted (file, THUNAR_LIST_MODEL (model)->file_size_binary)); + if (THUNAR_LIST_MODEL (model)->items_count_as_dir_size && thunar_file_is_directory (file) ) + { + item_count = thunar_folder_get_file_count (thunar_folder_get_for_file (file)); + g_value_take_string (value, g_strdup_printf (ngettext ("%u item", "%u items", item_count), item_count)); + } + else + g_value_take_string (value, thunar_file_get_size_string_formatted (file, THUNAR_LIST_MODEL (model)->file_size_binary)); break; case THUNAR_COLUMN_SIZE_IN_BYTES: @@ -918,7 +951,7 @@ thunar_list_model_get_sort_column_id (GtkTreeSortable *sortable, *sort_column_id = THUNAR_COLUMN_NAME; else if (store->sort_func == sort_by_permissions) *sort_column_id = THUNAR_COLUMN_PERMISSIONS; - else if (store->sort_func == sort_by_size) + else if (store->sort_func == sort_by_size || store->sort_func == sort_by_size_and_items_count) *sort_column_id = THUNAR_COLUMN_SIZE; else if (store->sort_func == sort_by_size_in_bytes) *sort_column_id = THUNAR_COLUMN_SIZE_IN_BYTES; @@ -989,7 +1022,7 @@ thunar_list_model_set_sort_column_id (GtkTreeSortable *sortable, break; case THUNAR_COLUMN_SIZE: - store->sort_func = sort_by_size; + store->sort_func = store->items_count_as_dir_size ? sort_by_size_and_items_count : sort_by_size; break; case THUNAR_COLUMN_SIZE_IN_BYTES: @@ -1590,6 +1623,32 @@ sort_by_size_in_bytes (const ThunarFile *a, static gint +sort_by_size_and_items_count (ThunarFile *a, + ThunarFile *b, + gboolean case_sensitive) +{ + guint32 count_a; + guint32 count_b; + + if (thunar_file_is_directory(a) && thunar_file_is_directory(b)) + { + count_a = thunar_folder_get_file_count (thunar_folder_get_for_file (a)); + count_b = thunar_folder_get_file_count (thunar_folder_get_for_file (b)); + + if (count_a < count_b) + return -1; + else if (count_a > count_b) + return 1; + else + return thunar_file_compare_by_name (a, b, case_sensitive); + } + + return sort_by_size(a, b, case_sensitive); +} + + + +static gint sort_by_type (const ThunarFile *a, const ThunarFile *b, gboolean case_sensitive) @@ -2093,6 +2152,53 @@ thunar_list_model_set_file_size_binary (ThunarListModel *store, /** + * thunar_list_model_get_items_count_as_dir_size: + * @store : a #ThunarListModel. + * + * Return value: %TRUE if items count in directory will be shown as + * directory size, else %FALSE. + **/ +static gboolean +thunar_list_model_get_items_count_as_dir_size (ThunarListModel *store) +{ + _thunar_return_val_if_fail (THUNAR_IS_LIST_MODEL (store), FALSE); + return store->items_count_as_dir_size; +} + + + +/** + * thunar_list_model_set_items_count_as_dir_size: + * @store : a #ThunarListModel. + * @count_as_dir_size : %TRUE if items count in directory will be shown + * as directory size, else %FALSE. + **/ +void +thunar_list_model_set_items_count_as_dir_size (ThunarListModel *store, + gboolean count_as_dir_size) +{ + _thunar_return_if_fail (THUNAR_IS_LIST_MODEL (store)); + + /* check if the new setting differs */ + if (store->items_count_as_dir_size == count_as_dir_size) + return; + + store->items_count_as_dir_size = count_as_dir_size; + g_object_notify_by_pspec (G_OBJECT (store), list_model_props[PROP_ITEMS_COUNT_AS_DIR_SIZE]); + + gtk_tree_model_foreach (GTK_TREE_MODEL (store), (GtkTreeModelForeachFunc) gtk_tree_model_row_changed, NULL); + + /* re-sorting the store if needed */ + if (store->sort_func == sort_by_size || store->sort_func == sort_by_size_and_items_count) + { + store->sort_func = store->items_count_as_dir_size ? sort_by_size_and_items_count : sort_by_size; + thunar_list_model_sort (store); + } +} + + + +/** * thunar_list_model_get_file: * @store : a #ThunarListModel. * @iter : a valid #GtkTreeIter for @store. diff --git a/thunar/thunar-preferences.c b/thunar/thunar-preferences.c index 1ce996a6..199355d5 100644 --- a/thunar/thunar-preferences.c +++ b/thunar/thunar-preferences.c @@ -77,6 +77,7 @@ enum PROP_MISC_DATE_STYLE, PROP_EXEC_SHELL_SCRIPTS_BY_DEFAULT, PROP_MISC_FOLDERS_FIRST, + PROP_MISC_ITEMS_COUNT_AS_DIR_SIZE, PROP_MISC_FULL_PATH_IN_TITLE, PROP_MISC_HORIZONTAL_WHEEL_NAVIGATES, PROP_MISC_IMAGE_SIZE_IN_STATUSBAR, @@ -521,6 +522,16 @@ thunar_preferences_class_init (ThunarPreferencesClass *klass) EXO_PARAM_READWRITE); /** + * ThunarPreferences:misc-folders-first: + **/ + preferences_props[PROP_MISC_ITEMS_COUNT_AS_DIR_SIZE] = + g_param_spec_boolean ("misc-items-count-as-dir-size", + "MiscItemsCountAsDirSize", + NULL, + TRUE, + EXO_PARAM_READWRITE); + + /** * ThunarPreferences:misc-full-path-in-title: * * Show the full directory path in the window title, instead of diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c index c94c38d2..e0a99c34 100644 --- a/thunar/thunar-standard-view.c +++ b/thunar/thunar-standard-view.c @@ -705,6 +705,7 @@ thunar_standard_view_init (ThunarStandardView *standard_view) exo_binding_new (G_OBJECT (standard_view->preferences), "misc-date-style", G_OBJECT (standard_view->model), "date-style"); exo_binding_new (G_OBJECT (standard_view->preferences), "misc-folders-first", G_OBJECT (standard_view->model), "folders-first"); exo_binding_new (G_OBJECT (standard_view->preferences), "misc-file-size-binary", G_OBJECT (standard_view->model), "file-size-binary"); + exo_binding_new (G_OBJECT (standard_view->preferences), "misc-items-count-as-dir-size", G_OBJECT (standard_view->model), "items-count-as-dir-size"); /* setup the icon renderer */ standard_view->icon_renderer = thunar_icon_renderer_new (); -- 2.11.0