diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 5 | ||||
-rw-r--r-- | mail/folder-browser.c | 5 | ||||
-rw-r--r-- | mail/message-list.c | 42 |
3 files changed, 49 insertions, 3 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index a4ba0b1fce..f16399f24c 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2000-02-22 bertrand <Bertrand.Guiheneuf@aful.org> + + * message-list.c (message_list_set_folder): + fix to show a sample correct implementation. + 2000-02-21 Matt Loper <matt@helixcode.com> * Makefile.am: added -lunicode to evolution_mail_LDADD. diff --git a/mail/folder-browser.c b/mail/folder-browser.c index e6fe8d496a..85a09395a8 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -65,7 +65,10 @@ folder_browser_load_folder (FolderBrowser *fb, const char *name) gtk_object_unref (GTK_OBJECT (fb->folder)); fb->folder = new_folder; - + + camel_folder_exists (new_folder, NULL); + printf ("In folder browser, folder = %p\n", new_folder); + message_list_set_folder (fb->message_list, new_folder); return TRUE; diff --git a/mail/message-list.c b/mail/message-list.c index 7da9b9fa8b..6f571c1029 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -457,19 +457,57 @@ void message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder) { CamelException ex; - + gboolean folder_exists; + g_return_if_fail (message_list != NULL); g_return_if_fail (camel_folder != NULL); g_return_if_fail (IS_MESSAGE_LIST (message_list)); g_return_if_fail (CAMEL_IS_FOLDER (camel_folder)); g_return_if_fail (camel_folder_has_summary_capability (camel_folder, &ex)); + + camel_exception_init (&ex); + if (message_list->folder) gtk_object_unref (GTK_OBJECT (message_list->folder)); message_list->folder = camel_folder; - message_list->folder_summary = camel_folder_get_summary (camel_folder, &ex); + folder_exists = camel_folder_exists (camel_folder, NULL); + + if (camel_exception_get_id (&ex)) { + printf ("Unable to test for folder existence \n"); + return; + } + + if (!folder_exists) { + g_warning ("Folder does not exist, creating it\n"); + /* + if you don't want the directory to be created + automatically here remove this. + */ + camel_folder_create (camel_folder, &ex); + if (camel_exception_get_id (&ex)) { + printf ("Unable to create folder\n"); + return; + } + + } + + + camel_folder_open (camel_folder, FOLDER_OPEN_RW, &ex); + if (camel_exception_get_id (&ex)) { + printf ("Unable to open folder\n"); + return; + } + + message_list->folder_summary = camel_folder_get_summary (camel_folder, &ex); + if (camel_exception_get_id (&ex)) { + printf ("Unable to get summary \n"); + return; + } + + gtk_object_ref (GTK_OBJECT (camel_folder)); printf ("Modelo cambio!\n"); |