diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-06-28 06:30:21 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-07-02 22:34:09 +0800 |
commit | 93987da1f5e4733e0eb0ba944f06809b4e4d52cb (patch) | |
tree | a1e75b6a7a8ee21bd5973bf03331f8e826268606 /e-util | |
parent | 96b07a2ff024c6e852344f4614735132219d2104 (diff) | |
download | gsoc2013-evolution-93987da1f5e4733e0eb0ba944f06809b4e4d52cb.tar gsoc2013-evolution-93987da1f5e4733e0eb0ba944f06809b4e4d52cb.tar.gz gsoc2013-evolution-93987da1f5e4733e0eb0ba944f06809b4e4d52cb.tar.bz2 gsoc2013-evolution-93987da1f5e4733e0eb0ba944f06809b4e4d52cb.tar.lz gsoc2013-evolution-93987da1f5e4733e0eb0ba944f06809b4e4d52cb.tar.xz gsoc2013-evolution-93987da1f5e4733e0eb0ba944f06809b4e4d52cb.tar.zst gsoc2013-evolution-93987da1f5e4733e0eb0ba944f06809b4e4d52cb.zip |
Add e_table_header_get_column_by_spec().
Will eventually replace e_table_header_get_column_by_col_idx().
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-table-header.c | 32 | ||||
-rw-r--r-- | e-util/e-table-header.h | 3 |
2 files changed, 35 insertions, 0 deletions
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); |