From e9299f623e9779bfd63a8c30b4803a2dca5ca172 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 26 Jun 2013 12:46:06 -0400 Subject: Add e_table_specification_ref_columns(). --- e-util/e-table-specification.c | 28 ++++++++++++++++++++++++++++ e-util/e-table-specification.h | 3 ++- 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'e-util') diff --git a/e-util/e-table-specification.c b/e-util/e-table-specification.c index 03c160ba74..b14bbde9df 100644 --- a/e-util/e-table-specification.c +++ b/e-util/e-table-specification.c @@ -111,6 +111,34 @@ e_table_specification_new (void) return g_object_new (E_TYPE_TABLE_SPECIFICATION, NULL); } +/** + * e_table_specification_ref_columns: + * @specification: an #ETableSpecification + * + * Returns a #GPtrArray containing #ETableColumnSpecification instances for + * all columns defined by @specification. The array contents are owned by + * the @specification and should not be modified. Unreference the array + * with g_ptr_array_unref() when finished with it. + * + * Returns: a #GPtrArray of #ETableColumnSpecification instances + **/ +GPtrArray * +e_table_specification_ref_columns (ETableSpecification *specification) +{ + GPtrArray *array; + guint ii; + + g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), NULL); + g_return_val_if_fail (specification->columns != NULL, NULL); + + array = g_ptr_array_new (); + + for (ii = 0; specification->columns[ii] != NULL; ii++) + g_ptr_array_add (array, specification->columns[ii]); + + return array; +} + /** * e_table_specification_load_from_file: * @specification: an #ETableSpecification diff --git a/e-util/e-table-specification.h b/e-util/e-table-specification.h index 11986bb991..feada9e82c 100644 --- a/e-util/e-table-specification.h +++ b/e-util/e-table-specification.h @@ -84,7 +84,8 @@ struct _ETableSpecificationClass { GType e_table_specification_get_type (void) G_GNUC_CONST; ETableSpecification * e_table_specification_new (void); - +GPtrArray * e_table_specification_ref_columns + (ETableSpecification *specification); gboolean e_table_specification_load_from_file (ETableSpecification *specification, const gchar *filename); -- cgit