aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/importers
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-10-25 07:52:05 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-10-25 07:52:05 +0800
commit85b2913a380c69f14ae0254ad23b10fabfb33667 (patch)
treec1cf143e37294dd9dd3667ebbe0a1d0c00b04b56 /calendar/importers
parente7a31c5035a0afeed6c1675e30487c1e2bdc139f (diff)
downloadgsoc2013-evolution-85b2913a380c69f14ae0254ad23b10fabfb33667.tar.gz
gsoc2013-evolution-85b2913a380c69f14ae0254ad23b10fabfb33667.tar.zst
gsoc2013-evolution-85b2913a380c69f14ae0254ad23b10fabfb33667.zip
Merge revisions 36534:36684 from trunk.
svn path=/branches/kill-bonobo/; revision=36685
Diffstat (limited to 'calendar/importers')
-rw-r--r--calendar/importers/icalendar-importer.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c
index da10434890..eb751d07a3 100644
--- a/calendar/importers/icalendar-importer.c
+++ b/calendar/importers/icalendar-importer.c
@@ -474,22 +474,34 @@ vcal_supported(EImport *ei, EImportTarget *target, EImportImporter *im)
if (g_file_get_contents(filename, &contents, NULL, NULL)) {
VObject *vcal;
+ icalcomponent *icalcomp;
- /* parse the file */
- vcal = Parse_MIME (contents, strlen (contents));
- g_free (contents);
+ icalcomp = e_cal_util_parse_ics_string (contents);
- if (vcal) {
- icalcomponent *icalcomp;
+ if (icalcomp && icalcomponent_is_valid (icalcomp)) {
+ /* If we can create proper iCalendar from the file, then
+ rather use ics importer, because it knows to read more
+ information than older version, the vCalendar. */
+ ret = FALSE;
+ g_free (contents);
+ } else {
+ if (icalcomp)
+ icalcomponent_free (icalcomp);
- icalcomp = icalvcal_convert (vcal);
+ /* parse the file */
+ vcal = Parse_MIME (contents, strlen (contents));
+ g_free (contents);
- if (icalcomp) {
- icalcomponent_free (icalcomp);
- ret = TRUE;
- }
+ if (vcal) {
+ icalcomp = icalvcal_convert (vcal);
- cleanVObject (vcal);
+ if (icalcomp) {
+ icalcomponent_free (icalcomp);
+ ret = TRUE;
+ }
+
+ cleanVObject (vcal);
+ }
}
}
g_free (filename);