diff options
-rw-r--r-- | calendar/ChangeLog | 6 | ||||
-rw-r--r-- | calendar/gui/itip-utils.c | 5 | ||||
-rw-r--r-- | calendar/importers/icalendar-importer.c | 95 |
3 files changed, 14 insertions, 92 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index eb109a9a59..30411808ca 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,9 @@ +2003-03-20 Rodrigo Moya <rodrigo@ximian.com> + + * importers/ical-importer.c (get_uri_from_folder_path): removed. + (load_file_fn, vcal_load_file_fn): use physical_uri instead of + folderpath. + 2003-03-19 Ettore Perazzoli <ettore@ximian.com> * importers/GNOME_Evolution_Calendar_Importer.server.in.in: diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index 0b1aca392e..94517dff6a 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -873,8 +873,9 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp, /* Set recipients, subject */ GNOME_Evolution_Composer_setHeaders (composer_server, from, to_list, cc_list, bcc_list, subject, &ev); - if (BONOBO_EX (&ev)) { - g_warning ("Unable to set composer headers while sending iTip message"); + if (BONOBO_EX (&ev)) { + g_warning ("Unable to set composer headers while sending iTip message: %s", + bonobo_exception_get_text (&ev)); goto cleanup; } diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c index 6de5624805..823dc11458 100644 --- a/calendar/importers/icalendar-importer.c +++ b/calendar/importers/icalendar-importer.c @@ -148,83 +148,6 @@ read_file (const char *filename) } } - -/* Returns the URI to load given a folder path. The returned string should be freed. */ -static char* -get_uri_from_folder_path (ICalImporter *ici, const char *folderpath) -{ - GNOME_Evolution_StorageRegistry corba_registry; - GNOME_Evolution_StorageRegistry_StorageList *storage_list; - GNOME_Evolution_Folder *corba_folder; - CORBA_Environment ev; - int i; - char *uri = NULL; - - corba_registry = evolution_shell_client_get_storage_registry_interface (ici->shell_client); - if (!corba_registry) { - return g_strdup_printf ("%s/evolution/local/Calendar/calendar.ics", - g_get_home_dir ()); - } - - CORBA_exception_init (&ev); - storage_list = GNOME_Evolution_StorageRegistry_getStorageList (corba_registry, &ev); - if (BONOBO_EX (&ev)) { - g_warning (_("Can't get storage list from registry: %s"), CORBA_exception_id (&ev)); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - for (i = 0; i < storage_list->_length; i++) { - CORBA_exception_init (&ev); - corba_folder = GNOME_Evolution_Storage_getFolderAtPath (storage_list->_buffer[i], - folderpath, &ev); - if (BONOBO_EX (&ev)) { - g_warning (_("Can't call getFolderAtPath on storage: %s"), CORBA_exception_id (&ev)); - CORBA_exception_free (&ev); - continue; - } - - CORBA_exception_free (&ev); - - if (corba_folder) { - ici->folder_contains_events = FALSE; - ici->folder_contains_tasks = FALSE; - - if (!strncmp (corba_folder->physicalUri, "file:", 5)) { - if (!strcmp (corba_folder->type, "tasks")) { - ici->folder_contains_tasks = TRUE; - uri = g_strdup_printf ("%s/tasks.ics", - corba_folder->physicalUri); - } - else if (!strcmp (corba_folder->type, "calendar")) { - ici->folder_contains_events = TRUE; - uri = g_strdup_printf ("%s/calendar.ics", - corba_folder->physicalUri); - } - } else { - uri = g_strdup (corba_folder->physicalUri); - - if (!strcmp (corba_folder->type, "tasks") || - !strcmp (corba_folder->type, "tasks/public")) - ici->folder_contains_tasks = TRUE; - else if (!strcmp (corba_folder->type, "calendar") || - !strcmp (corba_folder->type, "calendar/public")) - ici->folder_contains_events = TRUE; - } - - CORBA_free (corba_folder); - break; - } - } - - CORBA_free (storage_list); - - return uri; -} - - /* This removes all components except VEVENTs and VTIMEZONEs from the toplevel icalcomponent, and returns a GList of the VTODO components. */ static GList* @@ -378,17 +301,15 @@ support_format_fn (EvolutionImporter *importer, static gboolean load_file_fn (EvolutionImporter *importer, const char *filename, - const char *folderpath, + const char *physical_uri, void *closure) { - char *uri_str, *contents; + char *contents; gboolean ret = FALSE; ICalImporter *ici = (ICalImporter *) closure; g_return_val_if_fail (ici != NULL, FALSE); - uri_str = get_uri_from_folder_path (ici, folderpath); - contents = read_file (filename); /* parse the file */ @@ -397,7 +318,7 @@ load_file_fn (EvolutionImporter *importer, icalcomp = icalparser_parse_string (contents); if (icalcomp) { - if (cal_client_open_calendar (ici->client, uri_str, TRUE) + if (cal_client_open_calendar (ici->client, physical_uri, TRUE) && cal_client_open_default_tasks (ici->tasks_client, FALSE)) { ici->icalcomp = icalcomp; ret = TRUE; @@ -406,7 +327,6 @@ load_file_fn (EvolutionImporter *importer, } g_free (contents); - g_free (uri_str); return ret; } @@ -509,29 +429,24 @@ load_vcalendar_file (const char *filename) static gboolean vcal_load_file_fn (EvolutionImporter *importer, const char *filename, - const char *folderpath, + const char *physical_uri, void *closure) { - char *uri_str; gboolean ret = FALSE; ICalImporter *ici = (ICalImporter *) closure; icalcomponent *icalcomp; g_return_val_if_fail (ici != NULL, FALSE); - uri_str = get_uri_from_folder_path (ici, folderpath); - icalcomp = load_vcalendar_file (filename); if (icalcomp) { - if (cal_client_open_calendar (ici->client, uri_str, TRUE) + if (cal_client_open_calendar (ici->client, physical_uri, TRUE) && cal_client_open_default_tasks (ici->tasks_client, FALSE)) { ici->icalcomp = icalcomp; ret = TRUE; } } - g_free (uri_str); - return ret; } |