diff options
Diffstat (limited to 'widgets/e-table/e-table-subset-variable.c')
-rw-r--r-- | widgets/e-table/e-table-subset-variable.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/widgets/e-table/e-table-subset-variable.c b/widgets/e-table/e-table-subset-variable.c index 35cd4f9deb..bd96d5360c 100644 --- a/widgets/e-table/e-table-subset-variable.c +++ b/widgets/e-table/e-table-subset-variable.c @@ -38,6 +38,24 @@ etssv_add (ETableSubsetVariable *etssv, e_table_model_changed (etm); } +static void +etssv_add_all (ETableSubsetVariable *etssv) +{ + ETableModel *etm = E_TABLE_MODEL(etssv); + ETableSubset *etss = E_TABLE_SUBSET(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 (!etm->frozen) + e_table_model_changed (etm); +} + static gboolean etssv_remove (ETableSubsetVariable *etssv, gint row) @@ -64,8 +82,9 @@ etssv_class_init (GtkObjectClass *object_class) ETableSubsetVariableClass *klass = E_TABLE_SUBSET_VARIABLE_CLASS(object_class); etssv_parent_class = gtk_type_class (PARENT_TYPE); - klass->add = etssv_add; - klass->remove = etssv_remove; + klass->add = etssv_add; + klass->add_all = etssv_add_all; + klass->remove = etssv_remove; } E_MAKE_TYPE(e_table_subset_variable, "ETableSubsetVariable", ETableSubsetVariable, etssv_class_init, NULL, PARENT_TYPE); @@ -105,6 +124,16 @@ e_table_subset_variable_add (ETableSubsetVariable *etssv, ETSSV_CLASS (etssv)->add (etssv, row); } +void +e_table_subset_variable_add_all (ETableSubsetVariable *etssv) +{ + g_return_if_fail (etssv != NULL); + g_return_if_fail (E_IS_TABLE_SUBSET_VARIABLE(etssv)); + + if (ETSSV_CLASS(etssv)->add_all) + ETSSV_CLASS (etssv)->add_all (etssv); +} + gboolean e_table_subset_variable_remove (ETableSubsetVariable *etssv, gint row) |