[evolution-data-server] Add e_cal_component_id_equal().



commit 44959c51192ca75a5a7549041f0215c6f94bd76c
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Mar 16 18:00:26 2013 -0400

    Add e_cal_component_id_equal().

 calendar/libecal/e-cal-component.c                 |   31 ++++++++++++++++++++
 calendar/libecal/e-cal-component.h                 |    1 +
 .../calendar/libecal/libecal-sections.txt          |    1 +
 3 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/calendar/libecal/e-cal-component.c b/calendar/libecal/e-cal-component.c
index bb9774c..1cc00a9 100644
--- a/calendar/libecal/e-cal-component.c
+++ b/calendar/libecal/e-cal-component.c
@@ -5245,6 +5245,37 @@ e_cal_component_id_hash (const ECalComponentId *id)
 }
 
 /**
+ * e_cal_component_id_equal:
+ * @id1: the first #ECalComponentId
+ * @id2: the second #ECalComponentId
+ *
+ * Compares two #ECalComponentId structs for equality.
+ *
+ * Returns: %TRUE if @id1 and @id2 are equal
+ *
+ * Since: 3.10
+ **/
+gboolean
+e_cal_component_id_equal (const ECalComponentId *id1,
+                          const ECalComponentId *id2)
+{
+       gboolean uids_equal;
+       gboolean rids_equal;
+
+       if (id1 == id2)
+               return TRUE;
+
+       /* Safety check before we dereference. */
+       g_return_val_if_fail (id1 != NULL, FALSE);
+       g_return_val_if_fail (id2 != NULL, FALSE);
+
+       uids_equal = (g_strcmp0 (id1->uid, id2->uid) == 0);
+       rids_equal = (g_strcmp0 (id1->rid, id2->rid) == 0);
+
+       return uids_equal && rids_equal;
+}
+
+/**
  * e_cal_component_free_text_list:
  * @text_list: (element-type ECalComponentText): List of #ECalComponentText
  * structures.
diff --git a/calendar/libecal/e-cal-component.h b/calendar/libecal/e-cal-component.h
index 61f22eb..8944324 100644
--- a/calendar/libecal/e-cal-component.h
+++ b/calendar/libecal/e-cal-component.h
@@ -233,6 +233,7 @@ ECalComponentId *e_cal_component_get_id (ECalComponent *comp);
 void e_cal_component_free_id (ECalComponentId *id);
 ECalComponentId *e_cal_component_id_copy (const ECalComponentId *id);
 guint e_cal_component_id_hash (const ECalComponentId *id);
+gboolean e_cal_component_id_equal (const ECalComponentId *id1, const ECalComponentId *id2);
 
 void e_cal_component_get_categories (ECalComponent *comp, const gchar **categories);
 void e_cal_component_set_categories (ECalComponent *comp, const gchar *categories);
diff --git a/docs/reference/calendar/libecal/libecal-sections.txt 
b/docs/reference/calendar/libecal/libecal-sections.txt
index 1cf48c5..86d933b 100644
--- a/docs/reference/calendar/libecal/libecal-sections.txt
+++ b/docs/reference/calendar/libecal/libecal-sections.txt
@@ -258,6 +258,7 @@ e_cal_component_get_id
 e_cal_component_free_id
 e_cal_component_id_copy
 e_cal_component_id_hash
+e_cal_component_id_equal
 e_cal_component_get_categories
 e_cal_component_set_categories
 e_cal_component_get_categories_list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]