From ccd8e1fedde7a29acb5e10ade7e69b9197e65dbe Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Fri, 5 May 2000 00:10:32 +0000 Subject: Add an e_table_group_add_all function and implement it in the different 2000-05-04 Christopher James Lahey * e-table-group-container.c, e-table-group-leaf.c, e-table-group.c, e-table-group.h: Add an e_table_group_add_all function and implement it in the different ETableGroup classes. * e-table-sort-info.c: Make set_nth not call changed twice if it needs to allocate more space. * e-table-sorted-variable.c, e-table-subset-variable.c, e-table-subset-variable.h: Add and implement an e_table_subset_variable_add_all command. * e-table.c: Use e_table_group_add_all as appropriate. Fix ETable grouping xml to work if there is a text element at the bottom of the grouping tree. svn path=/trunk/; revision=2806 --- widgets/e-table/e-table-sorted-variable.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'widgets/e-table/e-table-sorted-variable.c') diff --git a/widgets/e-table/e-table-sorted-variable.c b/widgets/e-table/e-table-sorted-variable.c index 1cc2557133..e3a0fbc8c5 100644 --- a/widgets/e-table/e-table-sorted-variable.c +++ b/widgets/e-table/e-table-sorted-variable.c @@ -26,6 +26,7 @@ static void etsv_proxy_model_cell_changed (ETableModel *etm, int col, int row, E static void etsv_sort_info_changed (ETableSortInfo *info, ETableSortedVariable *etsv); static void etsv_sort (ETableSortedVariable *etsv); static void etsv_add (ETableSubsetVariable *etssv, gint row); +static void etsv_add_all (ETableSubsetVariable *etssv); static void etsv_destroy (GtkObject *object) @@ -68,6 +69,7 @@ etsv_class_init (GtkObjectClass *object_class) object_class->destroy = etsv_destroy; etssv_class->add = etsv_add; + etssv_class->add_all = etsv_add_all; } static void @@ -115,6 +117,29 @@ etsv_add (ETableSubsetVariable *etssv, e_table_model_changed (etm); } +static void +etsv_add_all (ETableSubsetVariable *etssv) +{ + ETableModel *etm = E_TABLE_MODEL(etssv); + ETableSubset *etss = E_TABLE_SUBSET(etssv); + ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE (etssv); + int rows = e_table_model_row_count(etss->source); + int i; + + if (etss->n_map + rows > etssv->n_vals_allocated){ + etssv->n_vals_allocated += MAX(INCREMENT_AMOUNT, rows); + etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof(int)); + } + for (i = 0; i < rows; i++) + etss->map_table[etss->n_map++] = i; + + if (etsv->sort_idle_id == 0) { + etsv->sort_idle_id = g_idle_add_full(50, (GSourceFunc) etsv_sort_idle, etsv, NULL); + } + if (!etm->frozen) + e_table_model_changed (etm); +} + ETableModel * e_table_sorted_variable_new (ETableModel *source, ETableHeader *full_header, ETableSortInfo *sort_info) { -- cgit v1.2.3