diff options
author | António Fernandes <antoniof@gnome.org> | 2022-10-20 17:51:29 +0100 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-10-21 02:02:35 +0100 |
commit | a2f20d1c841cdb76b06a5ab6037f8b4d53622495 (patch) | |
tree | 009e3dd71efe3079aa9c11c7342adb5430564231 /src/nautilus-list-base.c | |
parent | 62d375898555f2199e98e28465197915e6efb850 (diff) | |
download | nautilus-a2f20d1c841cdb76b06a5ab6037f8b4d53622495.tar.gz |
files-view: Drop .compare_files() vfunc
It gets called at a time when the new files haven't made it into the
view mode yet. So, we create a pair of dummy items for the sorter to
work on, and then throw them away.
Creating and destroying object instances at every step in the sorting
algorithm wastes a lot of cycles while loading large folders, with
visible performance impact.
So, instead of sorting before the view items are created, do it when
they are created, right before they are added to the model's internal
list store.
Diffstat (limited to 'src/nautilus-list-base.c')
-rw-r--r-- | src/nautilus-list-base.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/nautilus-list-base.c b/src/nautilus-list-base.c index c1f85e6d1..04a02cb2a 100644 --- a/src/nautilus-list-base.c +++ b/src/nautilus-list-base.c @@ -1299,30 +1299,6 @@ real_reveal_selection (NautilusFilesView *files_view) nautilus_list_base_scroll_to_item (self, get_first_selected_item (self)); } -static int -real_compare_files (NautilusFilesView *files_view, - NautilusFile *file1, - NautilusFile *file2) -{ - NautilusListBase *self = NAUTILUS_LIST_BASE (files_view); - NautilusListBasePrivate *priv = nautilus_list_base_get_instance_private (self); - GtkSorter *sorter; - g_autoptr (NautilusViewItem) item1 = NULL; - g_autoptr (NautilusViewItem) item2 = NULL; - - sorter = nautilus_view_model_get_sorter (priv->model); - if (sorter == NULL) - { - return 0; - } - - /* Generate fake model items for sorter use only. */ - item1 = nautilus_view_item_new (file1, NAUTILUS_GRID_ICON_SIZE_SMALL); - item2 = nautilus_view_item_new (file2, NAUTILUS_GRID_ICON_SIZE_SMALL); - - return gtk_sorter_compare (sorter, item1, item2); -} - static void on_clipboard_contents_received (GObject *source_object, GAsyncResult *res, @@ -1737,7 +1713,6 @@ nautilus_list_base_class_init (NautilusListBaseClass *klass) files_view_class->select_all = real_select_all; files_view_class->set_selection = real_set_selection; files_view_class->invert_selection = real_invert_selection; - files_view_class->compare_files = real_compare_files; files_view_class->end_file_changes = real_end_file_changes; files_view_class->end_loading = real_end_loading; files_view_class->get_first_visible_file = real_get_first_visible_file; |