aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMike Kestner <mkestner@ximian.com>2003-04-03 00:18:15 +0800
committerMike Kestner <mkestner@src.gnome.org>2003-04-03 00:18:15 +0800
commit0a0e1f2f03c47e3a3b1fa3e5e39924cfc803be8b (patch)
tree7b248f078b86535a1ddca6459fe08c1c77d505b8 /widgets
parentae79ee48c227a3bc7f81468647cba836925a0557 (diff)
downloadgsoc2013-evolution-0a0e1f2f03c47e3a3b1fa3e5e39924cfc803be8b.tar.gz
gsoc2013-evolution-0a0e1f2f03c47e3a3b1fa3e5e39924cfc803be8b.tar.zst
gsoc2013-evolution-0a0e1f2f03c47e3a3b1fa3e5e39924cfc803be8b.zip
restore expanded state of node and all children. Fixes Ximian bug #40393.
2003-04-02 Mike Kestner <mkestner@ximian.com> * e-tree-table-adapter.c (update_node): restore expanded state of node and all children. Fixes Ximian bug #40393. (check_expanded): new traverser function svn path=/trunk/; revision=20642
Diffstat (limited to 'widgets')
-rw-r--r--widgets/table/e-tree-table-adapter.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c
index 99fa12b532..65bdb3cccb 100644
--- a/widgets/table/e-tree-table-adapter.c
+++ b/widgets/table/e-tree-table-adapter.c
@@ -444,11 +444,37 @@ insert_node(ETreeTableAdapter *etta, ETreePath parent, ETreePath path)
e_table_model_rows_inserted(E_TABLE_MODEL(etta), get_row(etta, path), size);
}
+typedef struct {
+ GSList *paths;
+ gboolean expanded;
+} check_expanded_closure;
+
+static gboolean
+check_expanded(GNode *gnode, gpointer data)
+{
+ check_expanded_closure *closure = (check_expanded_closure *) data;
+ node_t *node = (node_t *) gnode->data;
+
+ if (node->expanded != closure->expanded)
+ closure->paths = g_slist_prepend(closure->paths, node->path);
+
+ return FALSE;
+}
+
static void
update_node(ETreeTableAdapter *etta, ETreePath path)
{
+ check_expanded_closure closure;
ETreePath parent = e_tree_model_node_get_parent(etta->priv->source, path);
- gboolean expanded = e_tree_table_adapter_node_is_expanded (etta, path);
+ GNode *gnode = lookup_gnode(etta, path);
+ GSList *l;
+
+ closure.expanded = e_tree_model_get_expanded_default (etta->priv->source);
+ closure.paths = NULL;
+
+ if (gnode)
+ g_node_traverse(gnode, G_IN_ORDER, G_TRAVERSE_ALL, -1, check_expanded, &closure);
+
if (e_tree_model_node_is_root(etta->priv->source, path))
generate_tree(etta, path);
else {
@@ -456,8 +482,10 @@ update_node(ETreeTableAdapter *etta, ETreePath path)
insert_node(etta, parent, path);
}
- if (expanded != e_tree_model_get_expanded_default (etta->priv->source))
- e_tree_table_adapter_node_set_expanded (etta, path, expanded);
+ for (l = closure.paths; l; l = l->next)
+ e_tree_table_adapter_node_set_expanded (etta, l->data, !closure.expanded);
+
+ g_slist_free(closure.paths);
}
static void