Add e_cal_component_id_hash().
authorMatthew Barnes <mbarnes@redhat.com>
Sat, 16 Mar 2013 21:51:55 +0000 (17:51 -0400)
committerMatthew Barnes <mbarnes@redhat.com>
Sun, 17 Mar 2013 13:35:48 +0000 (09:35 -0400)
calendar/libecal/e-cal-component.c
calendar/libecal/e-cal-component.h
docs/reference/calendar/libecal/libecal-sections.txt

index f54ec45..bb9774c 100644 (file)
@@ -5221,6 +5221,30 @@ e_cal_component_id_copy (const ECalComponentId *id)
 }
 
 /**
+ * e_cal_component_id_hash:
+ * @id: an #ECalComponentId
+ *
+ * Generates a hash value for @id.
+ *
+ * Returns: a hash value for @id
+ *
+ * Since: 3.10
+ **/
+guint
+e_cal_component_id_hash (const ECalComponentId *id)
+{
+       guint uid_hash;
+       guint rid_hash;
+
+       g_return_val_if_fail (id != NULL, 0);
+
+       uid_hash = g_str_hash (id->uid);
+       rid_hash = (id->rid != NULL) ? g_str_hash (id->rid) : 0;
+
+       return uid_hash ^ rid_hash;
+}
+
+/**
  * e_cal_component_free_text_list:
  * @text_list: (element-type ECalComponentText): List of #ECalComponentText
  * structures.
index 57df4d9..61f22eb 100644 (file)
@@ -232,6 +232,7 @@ void e_cal_component_set_uid (ECalComponent *comp, const gchar *uid);
 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);
 
 void e_cal_component_get_categories (ECalComponent *comp, const gchar **categories);
 void e_cal_component_set_categories (ECalComponent *comp, const gchar *categories);
index 921a0ad..1cf48c5 100644 (file)
@@ -257,6 +257,7 @@ e_cal_component_set_uid
 e_cal_component_get_id
 e_cal_component_free_id
 e_cal_component_id_copy
+e_cal_component_id_hash
 e_cal_component_get_categories
 e_cal_component_set_categories
 e_cal_component_get_categories_list