From 153eecb0b2829a3379eecca2c0db25a9549f98a5 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Sat, 31 Mar 2001 15:08:36 +0000 Subject: Made e_tree_selection_model_foreach work. (etsm_select_all): Made 2001-03-31 Christopher James Lahey * e-tree-selection-model.c (etsm_foreach_all_recurse): Made e_tree_selection_model_foreach work. (etsm_select_all): Made etsm_select_all work. (update_parents): Fixed a crash. svn path=/trunk/; revision=9073 --- widgets/table/e-tree-selection-model.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c index 93f59583d8..ac34653362 100644 --- a/widgets/table/e-tree-selection-model.c +++ b/widgets/table/e-tree-selection-model.c @@ -373,6 +373,12 @@ etsm_select_all (ESelectionModel *selection) etsm->root->all_children_selected = TRUE; etsm->root->any_children_selected = TRUE; + e_tree_selection_model_node_fill_children(etsm, e_tree_model_get_root(E_TREE_MODEL(etsm->ets)), etsm->root); + etsm->root->all_children_selected_array = e_bit_array_new(etsm->root->num_children); + etsm->root->any_children_selected_array = e_bit_array_new(etsm->root->num_children); + e_bit_array_select_all(etsm->root->all_children_selected_array); + e_bit_array_select_all(etsm->root->any_children_selected_array); + if (etsm->cursor_col == -1) etsm->cursor_col = 0; if (etsm->cursor_path == NULL) @@ -526,7 +532,7 @@ update_parents (ETreeSelectionModel *etsm, ETreePath path) depth = e_tree_model_node_depth (E_TREE_MODEL(ets), path); - orig_position_sequence = g_new(int, depth); + orig_position_sequence = g_new(int, depth + 1); node_sequence = g_new(ETreeSelectionModelNode *, depth + 1); parents = path; @@ -746,15 +752,16 @@ etsm_foreach_all_recurse (ETreeSelectionModel *etsm, ETreeForeachFunc callback, gpointer closure) { - ETreePath child = e_tree_model_node_get_first_child(E_TREE_MODEL(etsm->ets), path); - for ( ; child; child = e_tree_model_node_get_next(E_TREE_MODEL(etsm->ets), child)) { - if (child) { - ETreePath model_path = e_tree_sorted_view_to_model_path(etsm->ets, child); - callback(model_path, closure); + ETreePath model_path; + ETreePath child; + + model_path = e_tree_sorted_view_to_model_path(etsm->ets, path); + callback(model_path, closure); + child = e_tree_model_node_get_first_child(E_TREE_MODEL(etsm->ets), path); + for ( ; child; child = e_tree_model_node_get_next(E_TREE_MODEL(etsm->ets), child)) + if (child) etsm_foreach_all_recurse (etsm, child, callback, closure); - } - } } static void -- cgit