[evolution] Add e_table_header_get_column_by_spec().
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Add e_table_header_get_column_by_spec().
- Date: Tue, 2 Jul 2013 15:25:46 +0000 (UTC)
commit 93987da1f5e4733e0eb0ba944f06809b4e4d52cb
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Jun 27 18:30:21 2013 -0400
Add e_table_header_get_column_by_spec().
Will eventually replace e_table_header_get_column_by_col_idx().
.../evolution-util/evolution-util-sections.txt | 1 +
e-util/e-table-header.c | 32 ++++++++++++++++++++
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 6555f5b..6ef68b0 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 546c8d1..0b8d527 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 298131e..e5762c6 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]