diff options
-rw-r--r-- | mail/ChangeLog | 8 | ||||
-rw-r--r-- | mail/mail-local.c | 55 |
2 files changed, 36 insertions, 27 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index d24b418a22..56239bb8aa 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2000-11-12 Dan Winship <danw@helixcode.com> + + * mail-local.c (mail_do_register_folder): Do this the normal way + rather than calling mail_operation_wait_for_finish. There was some + reason for it originally, but it no longer applies. This makes + adding new folders from the folder selection dialog no longer + hang. + 2000-11-12 Jeffrey Stedfast <fejj@helixcode.com> * mail-ops.c (do_filter_ondemand): Sync the source folder. diff --git a/mail/mail-local.c b/mail/mail-local.c index 57d8a4e68c..6b1359e73c 100644 --- a/mail/mail-local.c +++ b/mail/mail-local.c @@ -670,11 +670,11 @@ do_register_folder (gpointer in_data, gpointer op_data, CamelException *ex) CamelStore *store; guint32 flags; - name = g_strdup_printf ("%s/local-metadata.xml", local_folder->path); + name = g_strdup_printf ("/%s/local-metadata.xml", local_folder->name); meta = load_metainfo (name); g_free (name); - name = g_strdup_printf ("%s:%s", meta->format, local_folder->path); + name = g_strdup_printf ("%s:/%s", meta->format, local_folder->name); store = camel_session_get_store (session, name, ex); g_free (name); if (!store) { @@ -690,13 +690,36 @@ do_register_folder (gpointer in_data, gpointer op_data, CamelException *ex) free_metainfo (meta); } +static void +cleanup_register_folder (gpointer in_data, gpointer op_data, + CamelException *ex) +{ + MailLocalFolder *local_folder = in_data; + + if (!local_folder->folder) { + g_free (local_folder); + return; + } + + g_hash_table_insert (local_folder->local_store->folders, + local_folder->name, local_folder->folder); + local_folder->name = strrchr (local_folder->path, '/') + 1; + local_folder->last_unread = 0; + + camel_object_hook_event (CAMEL_OBJECT (local_folder->folder), + "folder_changed", local_folder_changed, + local_folder); + local_folder_changed (CAMEL_OBJECT (local_folder->folder), + NULL, local_folder); +} + static const mail_operation_spec op_register_folder = { describe_register_folder, 0, NULL, do_register_folder, - NULL + cleanup_register_folder }; static void @@ -714,33 +737,11 @@ local_storage_new_folder_cb (EvolutionStorageListener *storage_listener, local_store->local_pathlen) != 0) return; - /* We don't need to deal with locking/reffing/copying - * issues because we don't return from the function - * until this is finished. - */ local_folder = g_new0 (MailLocalFolder, 1); - local_folder->path = folder->physical_uri + 7; + local_folder->name = g_strdup (folder->physical_uri + 8); + local_folder->path = g_strdup (path); local_folder->local_store = local_store; mail_operation_queue (&op_register_folder, local_folder, FALSE); - mail_operation_wait_for_finish (); - - if (!local_folder->folder) { - g_free (local_folder); - return; - } - - local_folder->path = g_strdup (path); - local_folder->name = strrchr (local_folder->path, '/') + 1; - local_folder->last_unread = 0; - - g_hash_table_insert (local_store->folders, - g_strdup (folder->physical_uri + 8), - local_folder->folder); - camel_object_hook_event (CAMEL_OBJECT (local_folder->folder), - "folder_changed", local_folder_changed, - local_folder); - local_folder_changed (CAMEL_OBJECT (local_folder->folder), - NULL, local_folder); } static void |