aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-tree-table-adapter.c
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/table/e-tree-table-adapter.c')
-rw-r--r--widgets/table/e-tree-table-adapter.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c
index 55674ecac3..6bf82ede38 100644
--- a/widgets/table/e-tree-table-adapter.c
+++ b/widgets/table/e-tree-table-adapter.c
@@ -963,6 +963,44 @@ open_file (ETreeTableAdapter *etta, const char *filename)
return doc;
}
+static void
+set_expanded_state_func (gpointer keyp, gpointer value, gpointer data)
+{
+ ETreePath path = keyp;
+ node_t *node = ((GNode *)value)->data;
+ ETreeTableAdapter *etta = (ETreeTableAdapter *) data;
+
+ if (node->expanded != TRUE) {
+ e_tree_table_adapter_node_set_expanded(etta, path, TRUE);
+ node->expanded = TRUE;
+ }
+}
+
+static void
+set_collapsed_state_func (gpointer keyp, gpointer value, gpointer data)
+{
+ ETreePath path = keyp;
+ node_t *node = ((GNode *)value)->data;
+ ETreeTableAdapter *etta = (ETreeTableAdapter *) data;
+ xmlNode *xmlnode;
+
+ if (node->expanded != FALSE) {
+ e_tree_table_adapter_node_set_expanded(etta, path, FALSE);
+ node->expanded = FALSE;
+ }
+}
+void
+e_tree_table_adapter_load_all_expanded_state (ETreeTableAdapter *etta, gboolean state)
+{
+
+ g_return_if_fail(etta != NULL);
+
+ if (state)
+ g_hash_table_foreach (etta->priv->nodes, set_expanded_state_func, etta);
+ else
+ g_hash_table_foreach (etta->priv->nodes, set_collapsed_state_func, etta);
+}
+
void
e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta, const char *filename)
{