Re: [Evolution-hackers] importers importing outside of local folders, bug 38461
- From: Not Zed <notzed ximian com>
- To: Rodrigo Moya <rodrigo ximian com>
- Cc: Evolution Hackers <evolution-hackers ximian com>
- Subject: Re: [Evolution-hackers] importers importing outside of local folders, bug 38461
- Date: 12 Mar 2003 06:41:11 +1030
1. thats not 'easy'.
2. it wont work if you have the same path in different stores.
On Tue, 2003-03-11 at 22:29, Rodrigo Moya wrote:
> On Tue, 2003-03-11 at 02:58, Not Zed wrote:
> > Looked into this problem - the whole importer framework explictly only
> > supports local folders.
> >
> I fixed it for the calendar importers some time ago. The fix was as easy
> as to convert the folderpath you get in the importer callbacks to its
> associated URI (in calendar/importers/icalendar-importer.c):
>
> 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;
> }
>
> I guess we could move this function to some shared place and make all
> importers use it. This was all I needed to fix it for the calendar
> importer, so I guess for mail/addressbook, it should be the same.
>
> cheers
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]