utils: build an uuid string
Use an ESource and ECalComponent to build an uuid string with the format specified
This commit is contained in:
@@ -349,6 +349,43 @@ get_desc_from_component (ECalComponent *component,
|
|||||||
return desc;
|
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
|
gint
|
||||||
get_first_weekday (void)
|
get_first_weekday (void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -81,6 +81,9 @@ void print_date (const gchar*
|
|||||||
gchar* get_desc_from_component (ECalComponent *component,
|
gchar* get_desc_from_component (ECalComponent *component,
|
||||||
const gchar *joint_char);
|
const gchar *joint_char);
|
||||||
|
|
||||||
|
gchar* get_uuid_from_component (ESource *source,
|
||||||
|
ECalComponent *component);
|
||||||
|
|
||||||
gint get_first_weekday (void);
|
gint get_first_weekday (void);
|
||||||
|
|
||||||
/* code brought from evolution */
|
/* code brought from evolution */
|
||||||
|
|||||||
Reference in New Issue
Block a user