aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-table/e-table-group.c
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1999-11-02 04:35:26 +0800
committerArturo Espinosa <unammx@src.gnome.org>1999-11-02 04:35:26 +0800
commitc5e2fd8592f00928776550e078f9eeba31caa163 (patch)
tree5be84c3f277c1ce679b644c04ad8334c7f345a2a /widgets/e-table/e-table-group.c
parentc8d14b53ef41de80458405ffadb0721458b7add9 (diff)
downloadgsoc2013-evolution-c5e2fd8592f00928776550e078f9eeba31caa163.tar
gsoc2013-evolution-c5e2fd8592f00928776550e078f9eeba31caa163.tar.gz
gsoc2013-evolution-c5e2fd8592f00928776550e078f9eeba31caa163.tar.bz2
gsoc2013-evolution-c5e2fd8592f00928776550e078f9eeba31caa163.tar.lz
gsoc2013-evolution-c5e2fd8592f00928776550e078f9eeba31caa163.tar.xz
gsoc2013-evolution-c5e2fd8592f00928776550e078f9eeba31caa163.tar.zst
gsoc2013-evolution-c5e2fd8592f00928776550e078f9eeba31caa163.zip
Added my widgets stuff -miguel
svn path=/trunk/; revision=1364
Diffstat (limited to 'widgets/e-table/e-table-group.c')
-rw-r--r--widgets/e-table/e-table-group.c98
1 files changed, 98 insertions, 0 deletions
diff --git a/widgets/e-table/e-table-group.c b/widgets/e-table/e-table-group.c
new file mode 100644
index 0000000000..194bc6b235
--- /dev/null
+++ b/widgets/e-table/e-table-group.c
@@ -0,0 +1,98 @@
+/*
+ * E-Table-Group.c: Implements the grouping objects for elements on a table
+ *
+ * Author:
+ * Miguel de Icaza (miguel@gnu.org()
+ *
+ * Copyright 1999, International GNOME Support.
+ */
+
+#include <config.h>
+#include "e-table-group.h"
+
+void
+e_table_group_destroy (ETableGroup *etg)
+{
+ g_return_val_if_fail (etg != NULL);
+
+ g_free (etg->title);
+
+ if (etg->is_leaf == 0){
+ GSList *l;
+
+ for (l = etg->u.children; l; l = l->next){
+ ETableGroup *child = l->data;
+
+ e_table_group_destroy (child);
+ }
+ g_slist_free (etg->u.children);
+ etg->u.children = NULL;
+ }
+ g_free (etg);
+}
+
+ETableGroup *
+e_table_group_new_leaf (const char *title, ETableModel *table)
+{
+ ETableGroup *etg;
+
+ g_return_val_if_fail (title != NULL, NULL);
+ g_return_val_if_fail (table != NULL, NULL);
+
+ etg = g_new (ETableGroup, 1);
+
+ etg->expanded = 0;
+ etg->is_leaf = 1;
+ etg->u.table = table;
+ etg->title = g_strdup (title);
+
+ return eg;
+}
+
+ETableGroup *
+e_table_group_new_leaf (const char *title)
+{
+ ETableGroup *etg;
+
+ g_return_val_if_fail (title != NULL, NULL);
+
+ etg = g_new (ETableGroup, 1);
+
+ etg->expanded = 0;
+ etg->is_leaf = 0;
+ etg->u.children = NULL;
+ etg->title = g_strdup (title);
+
+ return eg;
+}
+
+void
+e_table_group_append_child (ETableGroup *etg, ETableGroup *child)
+{
+ g_return_val_if_fail (etg != NULL);
+ g_return_val_if_fail (child != NULL);
+ g_return_val_if_fail (etg->is_leaf != 0);
+
+ etg->u.children = g_slist_append (etg->u.children, child);
+}
+
+int
+e_table_group_size (ETableGroup *etg)
+{
+ g_return_val_if_fail (etg != NULL);
+
+ if (etg->is_leaf)
+ return e_table_model_height (etg->u.table);
+ else {
+ GSList *l;
+ int size = 0;
+
+ for (l = etg->u.children; l; l = l->next){
+ ETableGroup *child = l->data;
+
+ size += e_table_group_size (child);
+ }
+ return size;
+ }
+}
+