aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-06-28 23:44:27 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-07-02 22:34:08 +0800
commit46b7a9961fc0606941dc0e2a2edf4a1383e3fa25 (patch)
tree156226055dca51700dfb2625f1f916df738516db
parenta6b1bc0c1ed2acea8a1e053560826e26a7f1246c (diff)
downloadgsoc2013-evolution-46b7a9961fc0606941dc0e2a2edf4a1383e3fa25.tar
gsoc2013-evolution-46b7a9961fc0606941dc0e2a2edf4a1383e3fa25.tar.gz
gsoc2013-evolution-46b7a9961fc0606941dc0e2a2edf4a1383e3fa25.tar.bz2
gsoc2013-evolution-46b7a9961fc0606941dc0e2a2edf4a1383e3fa25.tar.lz
gsoc2013-evolution-46b7a9961fc0606941dc0e2a2edf4a1383e3fa25.tar.xz
gsoc2013-evolution-46b7a9961fc0606941dc0e2a2edf4a1383e3fa25.tar.zst
gsoc2013-evolution-46b7a9961fc0606941dc0e2a2edf4a1383e3fa25.zip
Add e_table_column_specification_equal().
Compares two ETableColumnSpecification instances for equality, which just means they both refer to the same model column number.
-rw-r--r--doc/reference/evolution-util/evolution-util-sections.txt1
-rw-r--r--e-util/e-table-column-specification.c28
-rw-r--r--e-util/e-table-column-specification.h3
3 files changed, 32 insertions, 0 deletions
diff --git a/doc/reference/evolution-util/evolution-util-sections.txt b/doc/reference/evolution-util/evolution-util-sections.txt
index 4cfcb810b6..039667a3b0 100644
--- a/doc/reference/evolution-util/evolution-util-sections.txt
+++ b/doc/reference/evolution-util/evolution-util-sections.txt
@@ -3397,6 +3397,7 @@ e_table_col_get_type
<TITLE>ETableColumnSpecification</TITLE>
ETableColumnSpecification
e_table_column_specification_new
+e_table_column_specification_equal
e_table_column_specification_load_from_node
<SUBSECTION Standard>
E_TABLE_COLUMN_SPECIFICATION
diff --git a/e-util/e-table-column-specification.c b/e-util/e-table-column-specification.c
index a5d68b43b1..a770bdcd62 100644
--- a/e-util/e-table-column-specification.c
+++ b/e-util/e-table-column-specification.c
@@ -98,6 +98,34 @@ e_table_column_specification_new (void)
return g_object_new (E_TYPE_TABLE_COLUMN_SPECIFICATION, NULL);
}
+/**
+ * e_table_column_specification_equal:
+ * @spec_a: an #ETableColumnSpecification
+ * @spec_b: another #ETableColumnSpecification
+ *
+ * Convenience function compares @spec_a and @spec_b for equality, which
+ * simply means they share the same model column number.
+ *
+ * <note>
+ * <para>
+ * We should strive to get rid of this function by ensuring only one
+ * #ETableSpecification instance exists per table specification file.
+ * Then we could compare for equality by simply comparing pointers.
+ * </para>
+ * </note>
+ *
+ * Returns: %TRUE if @spec_a and @spec_b describe the same column
+ **/
+gboolean
+e_table_column_specification_equal (ETableColumnSpecification *spec_a,
+ ETableColumnSpecification *spec_b)
+{
+ g_return_val_if_fail (E_IS_TABLE_COLUMN_SPECIFICATION (spec_a), FALSE);
+ g_return_val_if_fail (E_IS_TABLE_COLUMN_SPECIFICATION (spec_b), FALSE);
+
+ return (spec_a->model_col == spec_b->model_col);
+}
+
void
e_table_column_specification_load_from_node (ETableColumnSpecification *etcs,
const xmlNode *node)
diff --git a/e-util/e-table-column-specification.h b/e-util/e-table-column-specification.h
index 68ded2e6c4..1790d2a42a 100644
--- a/e-util/e-table-column-specification.h
+++ b/e-util/e-table-column-specification.h
@@ -81,6 +81,9 @@ struct _ETableColumnSpecificationClass {
GType e_table_column_specification_get_type (void) G_GNUC_CONST;
ETableColumnSpecification *
e_table_column_specification_new (void);
+gboolean e_table_column_specification_equal
+ (ETableColumnSpecification *spec_a,
+ ETableColumnSpecification *spec_b);
void e_table_column_specification_load_from_node
(ETableColumnSpecification *state,
const xmlNode *node);