aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/pcs/cal-backend.c
diff options
context:
space:
mode:
authorSeth Alves <alves@src.gnome.org>2000-05-01 10:38:32 +0800
committerSeth Alves <alves@src.gnome.org>2000-05-01 10:38:32 +0800
commitd256a1683d895ea02150aa4488d243a8c754adb2 (patch)
treed977fe06efcb300b42ab7c215513e6c21b4b6b1c /calendar/pcs/cal-backend.c
parentc4f6855cebd5b13deca8109e79f0beb7dabdd0ce (diff)
downloadgsoc2013-evolution-d256a1683d895ea02150aa4488d243a8c754adb2.tar.gz
gsoc2013-evolution-d256a1683d895ea02150aa4488d243a8c754adb2.tar.zst
gsoc2013-evolution-d256a1683d895ea02150aa4488d243a8c754adb2.zip
set attendee and contact address correctly.
* pcs/icalendar-save.c (icalcomponent_create_from_ical_object): set attendee and contact address correctly. * pcs/cal-backend.c (icalendar_calendar_load): init priv->object_hash when loading. (cal_get_type_from_filename): if file extension is .ical, consider the file an ical file. svn path=/trunk/; revision=2702
Diffstat (limited to 'calendar/pcs/cal-backend.c')
-rw-r--r--calendar/pcs/cal-backend.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c
index 8864206cd2..3eb2ab2f17 100644
--- a/calendar/pcs/cal-backend.c
+++ b/calendar/pcs/cal-backend.c
@@ -646,10 +646,20 @@ icalendar_parse_file (char* fname)
static void
icalendar_calendar_load (CalBackend * cal, char* fname)
{
+ CalBackendPrivate *priv;
icalcomponent *comp;
icalcomponent *subcomp;
iCalObject *ical;
+ g_assert (cal);
+
+ priv = cal->priv;
+
+ g_assert (!priv->loaded);
+ g_assert (priv->object_hash == NULL);
+
+ priv->object_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
comp = icalendar_parse_file (fname);
subcomp = icalcomponent_get_first_component (comp,
ICAL_ANY_COMPONENT);
@@ -682,28 +692,32 @@ cal_get_type_from_filename (char *str_uri)
{
int len;
- if (str_uri == NULL){
+ if (str_uri == NULL)
return CAL_VCAL;
- }
len = strlen (str_uri);
- if (len < 5){
+ if (len < 4)
return CAL_VCAL;
- }
- if (str_uri[ len-4 ] == '.' &&
- str_uri[ len-3 ] == 'i' &&
- str_uri[ len-2 ] == 'c' &&
- str_uri[ len-1 ] == 's'){
+ if (str_uri[ len-4 ] == '.' && str_uri[ len-3 ] == 'i' &&
+ str_uri[ len-2 ] == 'c' && str_uri[ len-1 ] == 's')
return CAL_ICAL;
- }
- if (str_uri[ len-4 ] == '.' &&
- str_uri[ len-3 ] == 'i' &&
- str_uri[ len-2 ] == 'f' &&
- str_uri[ len-1 ] == 'b'){
+ if (str_uri[ len-4 ] == '.' && str_uri[ len-3 ] == 'i' &&
+ str_uri[ len-2 ] == 'f' && str_uri[ len-1 ] == 'b')
+ return CAL_ICAL;
+
+ if (str_uri[ len-4 ] == '.' && str_uri[ len-3 ] == 'i' &&
+ str_uri[ len-2 ] == 'c' && str_uri[ len-1 ] == 's')
+ return CAL_ICAL;
+
+ if (len < 5)
+ return CAL_VCAL;
+
+ if (str_uri[ len-5 ] == '.' && str_uri[ len-4 ] == 'i' &&
+ str_uri[ len-3 ] == 'c' && str_uri[ len-2 ] == 'a' &&
+ str_uri[ len-1 ] == 'l')
return CAL_ICAL;
- }
return CAL_VCAL;
}