diff options
-rw-r--r-- | doc/reference/evolution-util/evolution-util-sections.txt | 1 | ||||
-rw-r--r-- | e-util/e-table-header.c | 32 | ||||
-rw-r--r-- | e-util/e-table-header.h | 3 |
3 files changed, 36 insertions, 0 deletions
diff --git a/doc/reference/evolution-util/evolution-util-sections.txt b/doc/reference/evolution-util/evolution-util-sections.txt index 6555f5b1dd..6ef68b07b0 100644 --- a/doc/reference/evolution-util/evolution-util-sections.txt +++ b/doc/reference/evolution-util/evolution-util-sections.txt @@ -3586,6 +3586,7 @@ ETableHeader e_table_header_new e_table_header_add_column e_table_header_get_column +e_table_header_get_column_by_spec e_table_header_get_column_by_col_idx e_table_header_count e_table_header_index diff --git a/e-util/e-table-header.c b/e-util/e-table-header.c index 546c8d1d3b..0b8d527883 100644 --- a/e-util/e-table-header.c +++ b/e-util/e-table-header.c @@ -468,6 +468,38 @@ e_table_header_get_column (ETableHeader *eth, } /** + * e_table_header_get_column_by_spec: + * @eth: the ETableHeader to query + * @spec: an #ETableColumnSpecification + * + * Returns the #ETableCol having @spec as the column specification, or + * %NULL if there is no matching #ETableCol. + * + * Returns: an #ETableCol, or %NULL + **/ +ETableCol * +e_table_header_get_column_by_spec (ETableHeader *eth, + ETableColumnSpecification *spec) +{ + gint ii; + + g_return_val_if_fail (E_IS_TABLE_HEADER (eth), NULL); + g_return_val_if_fail (E_IS_TABLE_COLUMN_SPECIFICATION (spec), NULL); + + for (ii = 0; ii < eth->col_count; ii++) { + gboolean column_specs_equal; + + column_specs_equal = e_table_column_specification_equal ( + spec, eth->columns[ii]->spec); + + if (column_specs_equal) + return eth->columns[ii]; + } + + return NULL; +} + +/** * e_table_header_get_column_by_col_id: * @eth: the ETableHeader to query * @col_id: the col_id to search for. diff --git a/e-util/e-table-header.h b/e-util/e-table-header.h index 298131eeed..e5762c6eed 100644 --- a/e-util/e-table-header.h +++ b/e-util/e-table-header.h @@ -99,6 +99,9 @@ void e_table_header_add_column (ETableHeader *eth, gint pos); ETableCol * e_table_header_get_column (ETableHeader *eth, gint column); +ETableCol * e_table_header_get_column_by_spec + (ETableHeader *eth, + ETableColumnSpecification *spec); ETableCol * e_table_header_get_column_by_col_idx (ETableHeader *eth, gint col_idx); |