From 3c1ddb743e12aa5baa0e1fdab25eaddf4730b00d Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Wed, 26 Apr 2000 14:47:10 +0000 Subject: Add argument handling here. 2000-04-24 Miguel de Icaza * e-table.c (e_table_class_init): Add argument handling here. * e-table-group-leaf.c (e_table_group_apply_to_leafs): New method. Enables us to walk all the children of an ETableGroup. * e-table.c (et_get_arg, et_set_arg): Implement ::get and ::set methods. (e_table_construct_from_spec_file): Now we return the etable. (e_table_construct): ditto. (et_real_construct): Now we return the ETable. Returns NULL on construct failure. (e_table_new): ditto. (e_table_new_from_spec_file): ditto. * (et_build_grouping_spec): Removed vestige code that still contained references to the etable->specification XML code. Dumped all the ifdefed out code. * e-table.h: Removed ETable->specification finally. svn path=/trunk/; revision=2632 --- widgets/table/e-table-group-container.c | 39 ++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'widgets/table/e-table-group-container.c') diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index f660cd01c3..ac93cecc69 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -12,6 +12,7 @@ #include #include #include "e-table-group-container.h" +#include "e-table-group-leaf.h" #include "e-table-item.h" #include #include "e-util/e-util.h" @@ -81,19 +82,19 @@ etgc_destroy (GtkObject *object) { ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object); - if (etgc->font){ + if (etgc->font) gdk_font_unref (etgc->font); etgc->font = NULL; - } - if (etgc->ecol){ + + if (etgc->ecol) gtk_object_unref (GTK_OBJECT(etgc->ecol)); - } - if (etgc->sort_info){ + + if (etgc->sort_info) gtk_object_unref (GTK_OBJECT(etgc->sort_info)); - } - if (etgc->rect){ + + if (etgc->rect) gtk_object_destroy (GTK_OBJECT(etgc->rect)); - } + e_table_group_container_list_free (etgc); GTK_OBJECT_CLASS (etgc_parent_class)->destroy (object); @@ -555,7 +556,7 @@ child_row_selection (ETableGroup *etg, int row, gboolean selected, static void etgc_add (ETableGroup *etg, gint row) { - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); + ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); void *val = e_table_model_value_at (etg->model, etgc->ecol->col_idx, row); GCompareFunc comp = etgc->ecol->compare; GList *list = etgc->children; @@ -565,7 +566,8 @@ etgc_add (ETableGroup *etg, gint row) for (; list; list = g_list_next (list), i++){ int comp_val; - child_node = (ETableGroupContainerChildNode *)(list->data); + + child_node = list->data; comp_val = (*comp)(child_node->key, val); if (comp_val == 0) { child = child_node->child; @@ -881,6 +883,23 @@ etgc_init (GtkObject *object) E_MAKE_TYPE (e_table_group_container, "ETableGroupContainer", ETableGroupContainer, etgc_class_init, etgc_init, PARENT_TYPE); +void +e_table_group_apply_to_leafs (ETableGroup *etg, ETableGroupLeafFn fn, void *closure) +{ + if (E_IS_TABLE_GROUP_CONTAINER (etg)){ + ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); + GList *list = etgc->children; + for (list = etgc->children; list; list = list->next){ + ETableGroupContainerChildNode *child_node = list->data; + e_table_group_apply_to_leafs (child_node->child, fn, closure); + } + } else if (E_IS_TABLE_GROUP_LEAF (etg)){ + (*fn) (E_TABLE_GROUP_LEAF (etg)->item, closure); + } else { + g_error ("Unknown ETableGroup found: %s", + gtk_type_name (GTK_OBJECT (etg)->klass->type)); + } +} -- cgit v1.2.3