diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2003-04-03 00:58:12 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2003-04-03 00:58:12 +0800 |
commit | f00811036388bcd351175cedc7eeda618a99cbb2 (patch) | |
tree | e6fa8fb97dfa943b3dee55631f3bba15389efa91 /calendar | |
parent | 7cbc883d3d714e144be20182eb8c797c0091e7f2 (diff) | |
download | gsoc2013-evolution-f00811036388bcd351175cedc7eeda618a99cbb2.tar.gz gsoc2013-evolution-f00811036388bcd351175cedc7eeda618a99cbb2.tar.zst gsoc2013-evolution-f00811036388bcd351175cedc7eeda618a99cbb2.zip |
Fixes #39262
2003-04-02 Rodrigo Moya <rodrigo@ximian.com>
Fixes #39262
* importers/icalendar-importer.c (load_file_fn, vcal_load_file_fn):
use folder_type argument to determine what to import.
svn path=/trunk/; revision=20647
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 7 | ||||
-rw-r--r-- | calendar/importers/icalendar-importer.c | 40 |
2 files changed, 40 insertions, 7 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index e6c664792d..55faefc160 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,12 @@ 2003-04-02 Rodrigo Moya <rodrigo@ximian.com> + Fixes #39262 + + * importers/icalendar-importer.c (load_file_fn, vcal_load_file_fn): + use folder_type argument to determine what to import. + +2003-04-02 Rodrigo Moya <rodrigo@ximian.com> + * importers/icalendar-importer.c (load_file_fn, vcal_load_file_fn): added "folder_type" parameter to EvolutionImporterLoadFileFn. diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c index a6d99379dc..59d529732d 100644 --- a/calendar/importers/icalendar-importer.c +++ b/calendar/importers/icalendar-importer.c @@ -279,7 +279,7 @@ load_file_fn (EvolutionImporter *importer, const char *folder_type, void *closure) { - char *contents; + char *contents, *f; gboolean ret = FALSE; ICalImporter *ici = (ICalImporter *) closure; @@ -287,6 +287,18 @@ load_file_fn (EvolutionImporter *importer, contents = read_file (filename); + if (!strcmp (folder_type, "calendar")) { + ici->folder_contains_events = TRUE; + ici->folder_contains_tasks = FALSE; + + f = g_strdup ("calendar.ics"); + } else { + ici->folder_contains_events = FALSE; + ici->folder_contains_tasks = TRUE; + + f = g_strdup ("tasks.ics"); + } + /* parse the file */ if (contents) { icalcomponent *icalcomp; @@ -296,9 +308,8 @@ load_file_fn (EvolutionImporter *importer, char *real_uri; if (!g_strncasecmp (physical_uri, "file", 4) && - g_strcasecmp (physical_uri + (strlen (physical_uri) - strlen ("calendar.ics")), - "calendar.ics")) { - real_uri = g_concat_dir_and_file (physical_uri, "calendar.ics"); + g_strcasecmp (physical_uri + (strlen (physical_uri) - strlen (f)), f)) { + real_uri = g_concat_dir_and_file (physical_uri, f); } else real_uri = g_strdup (physical_uri); @@ -313,6 +324,7 @@ load_file_fn (EvolutionImporter *importer, } g_free (contents); + g_free (f); return ret; } @@ -419,19 +431,31 @@ vcal_load_file_fn (EvolutionImporter *importer, void *closure) { gboolean ret = FALSE; + char *f; ICalImporter *ici = (ICalImporter *) closure; icalcomponent *icalcomp; g_return_val_if_fail (ici != NULL, FALSE); + if (!strcmp (folder_type, "calendar")) { + ici->folder_contains_events = TRUE; + ici->folder_contains_tasks = FALSE; + + f = g_strdup ("calendar.ics"); + } else { + ici->folder_contains_events = FALSE; + ici->folder_contains_tasks = TRUE; + + f = g_strdup ("tasks.ics"); + } + icalcomp = load_vcalendar_file (filename); if (icalcomp) { char *real_uri; if (!g_strncasecmp (physical_uri, "file", 4) && - g_strcasecmp (physical_uri + (strlen (physical_uri) - strlen ("calendar.ics")), - "calendar.ics")) { - real_uri = g_concat_dir_and_file (physical_uri, "calendar.ics"); + g_strcasecmp (physical_uri + (strlen (physical_uri) - strlen (f)), f)) { + real_uri = g_concat_dir_and_file (physical_uri, f); } else real_uri = g_strdup (physical_uri); @@ -444,6 +468,8 @@ vcal_load_file_fn (EvolutionImporter *importer, g_free (real_uri); } + g_free (f); + return ret; } |