aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-06-28 06:30:21 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-07-02 22:34:09 +0800
commit93987da1f5e4733e0eb0ba944f06809b4e4d52cb (patch)
treea1e75b6a7a8ee21bd5973bf03331f8e826268606 /e-util
parent96b07a2ff024c6e852344f4614735132219d2104 (diff)
downloadgsoc2013-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.c32
-rw-r--r--e-util/e-table-header.h3
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);