aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-subset-variable.c
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/table/e-table-subset-variable.c')
-rw-r--r--widgets/table/e-table-subset-variable.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/widgets/table/e-table-subset-variable.c b/widgets/table/e-table-subset-variable.c
index 35b451f693..5c2aea35e6 100644
--- a/widgets/table/e-table-subset-variable.c
+++ b/widgets/table/e-table-subset-variable.c
@@ -42,6 +42,27 @@ etssv_add (ETableSubsetVariable *etssv,
}
static void
+etssv_add_array (ETableSubsetVariable *etssv,
+ const gint *array,
+ gint count)
+{
+ ETableModel *etm = E_TABLE_MODEL(etssv);
+ ETableSubset *etss = E_TABLE_SUBSET(etssv);
+ int i;
+
+ e_table_model_pre_change(etm);
+
+ if (etss->n_map + count > etssv->n_vals_allocated){
+ etssv->n_vals_allocated += MAX(INCREMENT_AMOUNT, count);
+ etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof(int));
+ }
+ for (i = 0; i < count; i++)
+ etss->map_table[etss->n_map++] = array[i];
+
+ e_table_model_changed (etm);
+}
+
+static void
etssv_add_all (ETableSubsetVariable *etssv)
{
ETableModel *etm = E_TABLE_MODEL(etssv);
@@ -90,6 +111,7 @@ etssv_class_init (GtkObjectClass *object_class)
etssv_parent_class = gtk_type_class (PARENT_TYPE);
klass->add = etssv_add;
+ klass->add_array = etssv_add_array;
klass->add_all = etssv_add_all;
klass->remove = etssv_remove;
}
@@ -132,6 +154,18 @@ e_table_subset_variable_add (ETableSubsetVariable *etssv,
}
void
+e_table_subset_variable_add_array (ETableSubsetVariable *etssv,
+ const gint *array,
+ gint count)
+{
+ g_return_if_fail (etssv != NULL);
+ g_return_if_fail (E_IS_TABLE_SUBSET_VARIABLE(etssv));
+
+ if (ETSSV_CLASS(etssv)->add_array)
+ ETSSV_CLASS (etssv)->add_array (etssv, array, count);
+}
+
+void
e_table_subset_variable_add_all (ETableSubsetVariable *etssv)
{
g_return_if_fail (etssv != NULL);