changeset 832:a14d7da2736d

iconlist_refresh optimization
author nadvornik
date Sat, 14 Jun 2008 12:43:39 +0000
parents b02a24ebf441
children 1d6fedb891dc
files src/view_file_icon.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/view_file_icon.c	Sat Jun 14 12:30:44 2008 +0000
+++ b/src/view_file_icon.c	Sat Jun 14 12:43:39 2008 +0000
@@ -2084,6 +2084,7 @@
 	GList *new_filelist = NULL;
 	GList *selected;
 	gint num_selected = 0;
+	GList *new_iconlist = NULL;
 
 	focus_id = VFICON_INFO(vf, focus_id);
 
@@ -2157,12 +2158,21 @@
 			id->selected = SELECTION_NONE;
 			id->row = -1;
 			id->fd = file_data_ref(new_fd);
-			vf->list = g_list_insert_before(vf->list, work, id);
+			if (work)
+				vf->list = g_list_insert_before(vf->list, work, id);
+			else
+				new_iconlist = g_list_prepend(new_iconlist, id); /* it is faster to append all new entries together later */
+				
 			work_fd = work_fd->next;
 			}
 
 		}
 
+	if (new_iconlist)
+		{
+		vf->list = g_list_concat(vf->list, g_list_reverse(new_iconlist));
+		}
+
 	filelist_free(new_filelist);
 
 	vficon_populate(vf, TRUE, keep_position);