[gnome-calendar] utils: build an uuid string
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] utils: build an uuid string
- Date: Thu, 4 Dec 2014 22:45:42 +0000 (UTC)
commit 67732884bbd044fc838a3eca33a20686f4be9bab
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Tue Dec 2 16:29:18 2014 -0500
utils: build an uuid string
Use an ESource and ECalComponent to build an uuid string with the format specified
src/gcal-utils.c | 37 +++++++++++++++++++++++++++++++++++++
src/gcal-utils.h | 3 +++
2 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-utils.c b/src/gcal-utils.c
index 33aeab7..5a3c130 100644
--- a/src/gcal-utils.c
+++ b/src/gcal-utils.c
@@ -349,6 +349,43 @@ get_desc_from_component (ECalComponent *component,
return desc;
}
+/**
+ * get_uuid_from_component:
+ * @source: an { link ESource}
+ * @component: an { link ECalComponent}
+ *
+ * Obtains the uuid from a component in the form
+ * "source_uid:event_uid:event_rid" or "source:uid:event_uid" if the
+ * component doesn't hold a recurrence event
+ *
+ * Returns: (Transfer full) a new allocated string with the description
+ **/
+gchar*
+get_uuid_from_component (ESource *source,
+ ECalComponent *component)
+{
+ gchar *uuid;
+ ECalComponentId *id;
+
+ id = e_cal_component_get_id (component);
+ if (id->rid != NULL)
+ {
+ uuid = g_strdup_printf ("%s:%s:%s",
+ e_source_get_uid (source),
+ id->uid,
+ id->rid);
+ }
+ else
+ {
+ uuid = g_strdup_printf ("%s:%s",
+ e_source_get_uid (source),
+ id->uid);
+ }
+ e_cal_component_free_id (id);
+
+ return uuid;
+}
+
gint
get_first_weekday (void)
{
diff --git a/src/gcal-utils.h b/src/gcal-utils.h
index ac1bab7..25ecccf 100644
--- a/src/gcal-utils.h
+++ b/src/gcal-utils.h
@@ -81,6 +81,9 @@ void print_date (const gchar*
gchar* get_desc_from_component (ECalComponent *component,
const gchar *joint_char);
+gchar* get_uuid_from_component (ESource *source,
+ ECalComponent *component);
+
gint get_first_weekday (void);
/* code brought from evolution */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]