diff options
author | Jason Leach <jleach@ximian.com> | 2001-06-24 02:49:20 +0800 |
---|---|---|
committer | Jacob Leach <jleach@src.gnome.org> | 2001-06-24 02:49:20 +0800 |
commit | 657ab7270a6901e48ba36ae30760dac5a12e7186 (patch) | |
tree | 400b39697cc1a3fb0e0a38e7b422ee5cf8b7c730 /mail/mail-local.c | |
parent | 92d5ddd3b17ffd521be156b1b8ed472d07889084 (diff) | |
download | gsoc2013-evolution-657ab7270a6901e48ba36ae30760dac5a12e7186.tar.gz gsoc2013-evolution-657ab7270a6901e48ba36ae30760dac5a12e7186.tar.zst gsoc2013-evolution-657ab7270a6901e48ba36ae30760dac5a12e7186.zip |
Fixes here for removing folders.
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.
svn path=/trunk/; revision=10445
Diffstat (limited to 'mail/mail-local.c')
-rw-r--r-- | mail/mail-local.c | 39 |
1 files changed, 30 insertions, 9 deletions
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; |