aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@novell.com>2006-01-16 16:17:21 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2006-01-16 16:17:21 +0800
commitef3ea1d41b2163f838c205f3c8aee071ffdaafe1 (patch)
tree27858c4ca5473ae0e94ba815c94b5ab9b7c9446e /widgets/table
parent129812de59395f825482ba32a67e0c9fc52eb0b3 (diff)
downloadgsoc2013-evolution-ef3ea1d41b2163f838c205f3c8aee071ffdaafe1.tar.gz
gsoc2013-evolution-ef3ea1d41b2163f838c205f3c8aee071ffdaafe1.tar.zst
gsoc2013-evolution-ef3ea1d41b2163f838c205f3c8aee071ffdaafe1.zip
Added functions to collapse/Expand all
2006-01-16 Srinivasa Ragavan <sragavan@novell.com> * table/e-tree-table-adapter.c (set_expanded_state_func), (set_collapsed_state_func): (e_tree_table_adapter_load_all_expanded_state): * table/e-tree.c: (e_tree_load_all_expanded_state): Added functions to collapse/Expand all svn path=/trunk/; revision=31203
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-tree-table-adapter.c38
-rw-r--r--widgets/table/e-tree.c6
2 files changed, 44 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)
{
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index aa644f09ea..9ba6f7f5f2 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -2014,6 +2014,12 @@ e_tree_load_expanded_state (ETree *et, char *filename)
e_tree_table_adapter_load_expanded_state (et->priv->etta, filename);
}
+void
+e_tree_load_all_expanded_state (ETree *et, gboolean state)
+{
+ e_tree_table_adapter_load_all_expanded_state (et->priv->etta, state);
+}
+
gint
e_tree_row_count (ETree *et)
{