diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 7 | ||||
-rw-r--r-- | mail/mail-local.c | 39 | ||||
-rw-r--r-- | mail/mail-ops.c | 17 |
3 files changed, 47 insertions, 16 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index cf06d7f961..2e47d22e4d 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,10 @@ +2001-06-23 Jason Leach <jleach@ximian.com> + + * mail-local.c (local_storage_removed_folder_cb): Fixes here for + removing folders. + + * mail-ops.c (remove_folder_get): Some fixes in here too. + 2001-06-22 Jeffrey Stedfast <fejj@ximian.com> * mail-config.c (config_read): Duh, we saved the charset as diff --git a/mail/mail-local.c b/mail/mail-local.c index 49e7d67d38..017125f8b2 100644 --- a/mail/mail-local.c +++ b/mail/mail-local.c @@ -49,6 +49,8 @@ #include "evolution-shell-component.h" #include "evolution-storage-listener.h" +#include "e-util/e-path.h" + #include "camel/camel.h" #include "camel/camel-vee-store.h" #include "camel/camel-vee-folder.h" @@ -250,7 +252,7 @@ mail_local_store_init (gpointer object, gpointer klass) } static void -free_local_folder(MailLocalFolder *lf) +free_local_folder (MailLocalFolder *lf) { if (lf->folder) { camel_object_unhook_event((CamelObject *)lf->folder, @@ -523,6 +525,7 @@ register_folder_register(struct _mail_msg *mm) name = g_strdup_printf ("%s:%s", meta->format, path); store = camel_session_get_store (session, name, &mm->ex); g_free (name); + if (!store) { free_metainfo (meta); camel_operation_unregister(mm->cancel); @@ -630,17 +633,33 @@ local_storage_removed_folder_cb (EvolutionStorageListener *storage_listener, { MailLocalStore *local_store = data; MailLocalFolder *local_folder; + char *physical_path; + char *tmpname; + + physical_path = e_path_to_physical (local_store->local_path, path); - if (strncmp (path, "file://", 7) != 0 || - strncmp (path + 7, local_store->local_path, + if (strncmp (physical_path, local_store->local_path, local_store->local_pathlen) != 0) return; - local_folder = g_hash_table_lookup (local_store->folders, path + 8); + tmpname = strchr (physical_path, '/'); + if (tmpname) { + while (*tmpname == '/') + tmpname++; + local_folder = g_hash_table_lookup (local_store->folders, tmpname); + camel_object_ref ((CamelObject *)local_store); /* When we go to free_local_folder() the + local_store will be unref'd */ + } + else + local_folder = NULL; + if (local_folder) { - g_hash_table_remove (local_store->folders, path); - free_local_folder(local_folder); + g_hash_table_remove (local_store->folders, tmpname); + + free_local_folder (local_folder); } + + g_free (physical_path); } static CamelProvider local_provider = { @@ -719,7 +738,7 @@ mail_local_storage_startup (EvolutionShellClient *shellclient, CORBA_exception_init (&ev); GNOME_Evolution_Storage_addListener (local_store->corba_local_storage, - corba_local_storage_listener, &ev); + corba_local_storage_listener, &ev); if (ev._major != CORBA_NO_EXCEPTION) { g_warning ("Cannot add a listener to the Local Storage."); camel_object_unref (CAMEL_OBJECT (local_store)); @@ -730,7 +749,9 @@ mail_local_storage_startup (EvolutionShellClient *shellclient, } -/* Local folder reconfiguration stuff */ +/*---------------------------------------------------------------------- + * Local folder reconfiguration stuff + *----------------------------------------------------------------------*/ /* open new @@ -808,7 +829,7 @@ reconfigure_folder_reconfigure(struct _mail_msg *mm) d(printf("reconfiguring folder: %s to type %s\n", m->fb->uri, m->newtype)); - mail_status_start(_("Reconfiguring folder")); + mail_status (_("Reconfiguring folder")); /* NOTE: This var is cleared by the folder_browser via the set_uri method */ m->fb->reconfigure = TRUE; diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 6804e835c1..d8897e3726 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -1431,23 +1431,26 @@ remove_folder_get (struct _mail_msg *mm) { struct _remove_folder_msg *m = (struct _remove_folder_msg *)mm; CamelStore *store; - CamelURL *url; + CamelFolder *folder; m->removed = FALSE; camel_operation_register (mm->cancel); - - store = camel_session_get_store (session, m->uri, &mm->ex); + + folder = mail_tool_uri_to_folder (m->uri, &mm->ex); + + store = camel_folder_get_parent_store (folder); if (!store) goto done; - - url = camel_url_new (m->uri, NULL); - camel_store_delete_folder (store, url->path + 1, &mm->ex); + + camel_store_delete_folder (store, camel_folder_get_full_name (folder), &mm->ex); m->removed = !camel_exception_is_set (&mm->ex); camel_object_unref (CAMEL_OBJECT (store)); - camel_url_free (url); done: + if (store) + camel_object_unref (CAMEL_OBJECT (store)); + camel_operation_unregister (mm->cancel); } |