From b234a3141bf6607ac8f4a980637d5f63e9b74511 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Fri, 27 Oct 2000 02:31:08 +0000 Subject: If we are inserting into the root level, we dont have to search the whole 2000-10-27 Not Zed * e-tree-model.c (e_tree_model_node_insert): If we are inserting into the root level, we dont have to search the whole array for a parent node we'll never find. svn path=/trunk/; revision=6218 --- widgets/table/e-tree-model.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'widgets/table') diff --git a/widgets/table/e-tree-model.c b/widgets/table/e-tree-model.c index 918c286b34..2b5f3fa6b0 100644 --- a/widgets/table/e-tree-model.c +++ b/widgets/table/e-tree-model.c @@ -909,7 +909,12 @@ e_tree_model_node_insert (ETreeModel *tree_model, if (position == -1) position = e_tree_model_node_num_visible_descendents (tree_model, parent_path) - 1; - parent_row = e_tree_model_row_of_node (tree_model, parent_path); + /* if the parent is the root, no need to search for its position since it aint there */ + if (parent_path->parent == NULL) { + parent_row = -1; + } else { + parent_row = e_tree_model_row_of_node (tree_model, parent_path); + } priv->row_array = g_array_insert_val (priv->row_array, parent_row + position + 1, new_path); -- cgit