diff options
author | Mike Kestner <mkestner@ximian.com> | 2003-02-13 02:02:32 +0800 |
---|---|---|
committer | Mike Kestner <mkestner@src.gnome.org> | 2003-02-13 02:02:32 +0800 |
commit | ad82875fbf44a78eac1625cf221ba1ebb80cc515 (patch) | |
tree | 1e9c561ddc788d90616fd68b653f9449ca8fa181 /widgets/table | |
parent | 26d83d9f3a1627a806425e373f1b072294d266cc (diff) | |
download | gsoc2013-evolution-ad82875fbf44a78eac1625cf221ba1ebb80cc515.tar.gz gsoc2013-evolution-ad82875fbf44a78eac1625cf221ba1ebb80cc515.tar.zst gsoc2013-evolution-ad82875fbf44a78eac1625cf221ba1ebb80cc515.zip |
work around broken models that insert children before parents. bad models.
2003-02-12 Mike Kestner <mkestner@ximian.com>
* e-tree-table-adapter.c (insert_node): work around broken models
that insert children before parents. bad models.
(e_tree_table_adapter_load_expanded_state): don't update_node
(e_tree_table_adapter_node_set_expanded): recursively expand
parent if the node is not visible yet.
(e_tree_table_adapter_set_sort_info): don't resort empty trees
svn path=/trunk/; revision=19894
Diffstat (limited to 'widgets/table')
-rw-r--r-- | widgets/table/e-tree-table-adapter.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c index 7e66ca783c..3fae35737d 100644 --- a/widgets/table/e-tree-table-adapter.c +++ b/widgets/table/e-tree-table-adapter.c @@ -383,8 +383,14 @@ insert_node(ETreeTableAdapter *etta, ETreePath parent, ETreePath path) } parent_gnode = lookup_gnode(etta, parent); - - g_return_if_fail(parent_gnode != NULL); + if (!parent_gnode) { + ETreePath grandparent = e_tree_model_node_get_parent(etta->priv->source, parent); + if (e_tree_model_node_is_root(etta->priv->source, parent)) + generate_tree(etta, parent); + else + insert_node(etta, grandparent, parent); + return; + } parent_node = (node_t *) parent_gnode->data; @@ -931,8 +937,6 @@ e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta, const char *f xmlFreeDoc (doc); - update_node(etta, e_tree_model_get_root (etta->priv->source)); - e_table_model_changed (E_TABLE_MODEL (etta)); } @@ -969,6 +973,12 @@ e_tree_table_adapter_node_set_expanded (ETreeTableAdapter *etta, ETreePath path, if (!expanded && e_tree_model_node_is_root (etta->priv->source, path) && !etta->priv->root_visible) return; + if (!gnode && expanded) { + ETreePath parent = e_tree_model_node_get_parent(etta->priv->source, path); + g_return_if_fail(parent != NULL); + e_tree_table_adapter_node_set_expanded(etta, parent, expanded); + gnode = lookup_gnode(etta, path); + } g_return_if_fail(gnode != NULL); node = (node_t *) gnode->data; @@ -1081,6 +1091,10 @@ e_tree_table_adapter_set_sort_info (ETreeTableAdapter *etta, ETableSortInfo *sor etta->priv->sort_info_changed_id = g_signal_connect(G_OBJECT(sort_info), "sort_info_changed", G_CALLBACK(etta_sort_info_changed), etta); } + + if (!etta->priv->root) + return; + e_table_model_pre_change(E_TABLE_MODEL(etta)); resort_node(etta, etta->priv->root, TRUE); fill_map(etta, 0, etta->priv->root); |