From 093a00cf2bba85c4f1f0826dde1cb500ecc415d6 Mon Sep 17 00:00:00 2001 From: 0 Date: Tue, 30 Oct 2001 03:28:40 +0000 Subject: Argh!!! Dont free the async op data here, the async op is still running 2001-10-30 * subscribe-dialog.c (fe_cancel_op_foreach): Argh!!! Dont free the async op data here, the async op is still running and will access it! Just try to cancel it and mark it as cancelled (id == -1) (fe_done_subscribing): Only remove outselves from the hash table if we're not cancelled. The handle should always be set here, since this code runs in the gui thread. * message-list.c (on_cursor_activated_idle): If nothing selected/cursor not activated, then select no message. * mail-folder-cache.c (update_1folder): Make the trash count optional on EVOLUTION_COUNT_TRASH, becuase some lusers are just too stupid to understand what its for. * component-factory.c (storage_xfer_folder): Return slightly better error codes for copying folders, since its not implemented yet. * mail-vfolder.c, mail-local.c, mail-folder-cache.c, message-list.c component-factory.c, mail-ops.c, subscribe-dialog.c, mail-session.c: d() out some debug printfs, w() out some warnings. * folder-browser-ui.c (folder_browser_ui_add_message): Fix typo, Resent->Resend. svn path=/trunk/; revision=14412 --- mail/ChangeLog | 28 ++++++++++++++++++++++++++++ mail/component-factory.c | 32 +++++++++++++++++--------------- mail/folder-browser-ui.c | 2 +- mail/mail-folder-cache.c | 15 ++++++++++----- mail/mail-local.c | 6 +++--- mail/mail-ops.c | 7 ++++--- mail/mail-session.c | 10 +++++----- mail/mail-vfolder.c | 4 ++-- mail/message-list.c | 7 +++++-- mail/subscribe-dialog.c | 15 ++++++++------- 10 files changed, 83 insertions(+), 43 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index cded203cb9..43c4b36c42 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,31 @@ +2001-10-30 + + * subscribe-dialog.c (fe_cancel_op_foreach): Argh!!! Dont free the + async op data here, the async op is still running and will access + it! Just try to cancel it and mark it as cancelled (id == -1) + (fe_done_subscribing): Only remove outselves from the hash table + if we're not cancelled. The handle should always be set here, + since this code runs in the gui thread. + + * message-list.c (on_cursor_activated_idle): If nothing + selected/cursor not activated, then select no message. + + * mail-folder-cache.c (update_1folder): Make the trash count + optional on EVOLUTION_COUNT_TRASH, becuase some lusers are just + too stupid to understand what its for. + + * component-factory.c (storage_xfer_folder): Return slightly + better error codes for copying folders, since its not implemented + yet. + + * mail-vfolder.c, mail-local.c, mail-folder-cache.c, + message-list.c component-factory.c, mail-ops.c, + subscribe-dialog.c, mail-session.c: d() out some debug printfs, + w() out some warnings. + + * folder-browser-ui.c (folder_browser_ui_add_message): Fix typo, + Resent->Resend. + 2001-10-29 Jeffrey Stedfast * mail-ops.c (transfer_messages_transfer): Don't warn the user if diff --git a/mail/component-factory.c b/mail/component-factory.c index 2ac7a4a110..9d501ba815 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -55,6 +55,8 @@ #include "mail-vfolder.h" #include "mail-autofilter.h" +#define d(x) + char *default_drafts_folder_uri; CamelFolder *drafts_folder = NULL; char *default_sent_folder_uri; @@ -324,7 +326,7 @@ xfer_folder (EvolutionShellComponent *shell_component, GPtrArray *uids; CamelURL *src, *dst; - printf("Renaming folder '%s' to dest '%s' type '%s'\n", source_physical_uri, destination_physical_uri, type); + d(printf("Renaming folder '%s' to dest '%s' type '%s'\n", source_physical_uri, destination_physical_uri, type)); CORBA_exception_init (&ev); @@ -687,11 +689,11 @@ unref_standard_folders (void) *standard_folders[i].folder = NULL; if (CAMEL_OBJECT (folder)->ref_count == 1) - printf ("About to finalise folder %s\n", folder->full_name); + d(printf ("About to finalise folder %s\n", folder->full_name)); else - printf ("Folder %s still has %d extra ref%s on it\n", folder->full_name, - CAMEL_OBJECT (folder)->ref_count - 1, - CAMEL_OBJECT (folder)->ref_count - 1 == 1 ? "" : "s"); + d(printf ("Folder %s still has %d extra ref%s on it\n", folder->full_name, + CAMEL_OBJECT (folder)->ref_count - 1, + CAMEL_OBJECT (folder)->ref_count - 1 == 1 ? "" : "s")); camel_object_unref (CAMEL_OBJECT (folder)); } @@ -1160,7 +1162,7 @@ storage_xfer_folder (EvolutionStorage *storage, char *src, *dst; char *p, c, sep; - printf("Transfer folder on store source = '%s' dest = '%s'\n", source_path, destination_path); + d(printf("Transfer folder on store source = '%s' dest = '%s'\n", source_path, destination_path)); /* Remap the 'path' to the camel friendly name based on the store dir separator */ sep = store->dir_sep; @@ -1180,22 +1182,22 @@ storage_xfer_folder (EvolutionStorage *storage, camel_exception_init (&ex); if (remove_source) { - printf("trying to rename\n"); + d(printf("trying to rename\n")); camel_store_rename_folder(store, src, dst, &ex); + if (camel_exception_is_set(&ex)) + notify_listener (listener, GNOME_Evolution_Storage_GENERIC_ERROR); + else + notify_listener (listener, GNOME_Evolution_Storage_OK); } else { - printf("No remove, can't rename\n"); - camel_exception_setv(&ex, 1, "Can copy folders"); + d(printf("No remove, can't rename\n")); + /* FIXME: Implement folder 'copy' for remote stores */ + /* This exception never goes anywhere, so it doesn't need translating or using */ + notify_listener (listener, GNOME_Evolution_Storage_UNSUPPORTED_OPERATION); } g_free(src); g_free(dst); - if (camel_exception_is_set(&ex)) { - notify_listener (listener, GNOME_Evolution_Storage_INVALID_URI); - } else { - notify_listener (listener, GNOME_Evolution_Storage_OK); - } - camel_exception_clear (&ex); } diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c index d11b6a473e..5b137d95bc 100644 --- a/mail/folder-browser-ui.c +++ b/mail/folder-browser-ui.c @@ -315,7 +315,7 @@ folder_browser_ui_add_message (FolderBrowser *fb) /* Resend Message */ if (fb->folder && !folder_browser_is_sent (fb)) - fbui_sensitise_item(fb, "MessageResent", FALSE); + fbui_sensitise_item(fb, "MessageResend", FALSE); /* sensitivity of message-specific commands */ prev_state = fb->selection_state; diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index a3abc13073..ffbc210e82 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -47,6 +47,7 @@ #include "mail-vfolder.h" #include "mail-autofilter.h" +#define w(x) #define d(x) /* note that many things are effectively serialised by having them run in @@ -113,6 +114,7 @@ static int update_id = -1; /* hack for people who LIKE to have unsent count */ static int count_sent = FALSE; +static int count_trash = FALSE; static void free_update(struct _folder_update *up) @@ -162,7 +164,7 @@ real_flush_updates(void *o, void *event_data, void *data) /* Its really a rename, but we have no way of telling the shell that, so remove it */ if (up->oldpath) { if (storage != NULL) { - printf("Removing old folder (rename?) '%s'\n", up->oldpath); + d(printf("Removing old folder (rename?) '%s'\n", up->oldpath)); evolution_storage_removed_folder(storage, up->oldpath); } /* ELSE? Shell supposed to handle the local snot case */ @@ -170,7 +172,7 @@ real_flush_updates(void *o, void *event_data, void *data) /* We can tell the vfolder code though */ if (up->olduri && up->add) { - printf("renaming folder '%s' to '%s'\n", up->olduri, up->uri); + d(printf("renaming folder '%s' to '%s'\n", up->olduri, up->uri)); mail_vfolder_rename_uri(up->store, up->olduri, up->uri); mail_filter_rename_uri(up->store, up->olduri, up->uri); } @@ -288,7 +290,9 @@ update_1folder(struct _folder_info *mfi, CamelFolderInfo *info) folder = mfi->folder; if (folder) { - if (CAMEL_IS_VTRASH_FOLDER (folder) || folder == outbox_folder || (count_sent && folder == sent_folder)) { + if ((count_trash && CAMEL_IS_VTRASH_FOLDER (folder)) + || folder == outbox_folder + || (count_sent && folder == sent_folder)) { unread = camel_folder_get_message_count(folder); } else { if (info) @@ -432,7 +436,7 @@ void mail_note_folder(CamelFolder *folder) mfi = g_hash_table_lookup(si->folders, folder->full_name); if (mfi == NULL) { - g_warning("Adding a folder `%s' that I dont know about yet?", folder->full_name); + w(g_warning("Adding a folder `%s' that I dont know about yet?", folder->full_name)); UNLOCK(info_lock); return; } @@ -674,7 +678,7 @@ mail_note_store_remove(CamelStore *store) ud = (struct _update_data *)si->folderinfo_updates.head; while (ud->next) { - (printf("Cancelling outstanding folderinfo update %d\n", ud->id)); + d(printf("Cancelling outstanding folderinfo update %d\n", ud->id)); mail_msg_cancel(ud->id); ud = ud->next; } @@ -735,6 +739,7 @@ mail_note_store(CamelStore *store, EvolutionStorage *storage, GNOME_Evolution_St if (stores == NULL) { stores = g_hash_table_new(NULL, NULL); count_sent = getenv("EVOLUTION_COUNT_SENT") != NULL; + count_trash = getenv("EVOLUTION_COUNT_TRASH") != NULL; } si = g_hash_table_lookup(stores, store); diff --git a/mail/mail-local.c b/mail/mail-local.c index 77dec887b5..74a7c3fbe9 100644 --- a/mail/mail-local.c +++ b/mail/mail-local.c @@ -490,7 +490,7 @@ mlf_set_folder(MailLocalFolder *mlf, guint32 flags, CamelException *ex) /* mlf->real_folder = camel_store_get_folder(mlf->real_store, mlf->meta->name, flags, ex); */ mbox = g_strdup_printf("%s/%s", mlf->real_path, mlf->meta->name); - printf("Opening mbox on real path: %s\n", mbox); + d(printf("Opening mbox on real path: %s\n", mbox)); mlf->real_folder = camel_store_get_folder(mlf->real_store, mbox, flags, ex); g_free(mbox); if (mlf->real_folder == NULL) @@ -984,7 +984,7 @@ static void mail_local_store_add_folder(MailLocalStore *mls, const char *uri, co CamelFolderInfo *info = NULL; CamelURL *url; - (printf("Shell adding folder: '%s' path = '%s'\n", uri, path)); + d(printf("Shell adding folder: '%s' path = '%s'\n", uri, path)); url = camel_url_new(uri, NULL); if (url == NULL) { @@ -1041,7 +1041,7 @@ static void mail_local_store_remove_folder(MailLocalStore *mls, const char *path { struct _search_info data = { path, NULL }; - printf("shell removing folder? '%s'\n", path); + d(printf("shell removing folder? '%s'\n", path)); /* we're keyed on uri, not path, so have to search for it manually */ diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 9f5b3235bb..201e8a5e13 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -50,7 +50,8 @@ #include "mail-mt.h" #include "mail-folder-cache.h" -#define d(x) x +#define w(x) +#define d(x) /* used for both just filtering a folder + uid's, and for filtering a whole folder */ /* used both for fetching mail, and for filtering mail */ @@ -1106,8 +1107,8 @@ get_folderinfo_got (struct _mail_msg *mm) char *url; url = camel_service_get_url (CAMEL_SERVICE (m->store)); - g_warning ("Error getting folder info from store at %s: %s", - url, camel_exception_get_description (&mm->ex)); + w(g_warning ("Error getting folder info from store at %s: %s", + url, camel_exception_get_description (&mm->ex))); g_free (url); } diff --git a/mail/mail-session.c b/mail/mail-session.c index b225c02179..b9449033eb 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -936,29 +936,29 @@ mail_session_enable_interaction (gboolean enable) struct _pass_msg *pm; struct _user_message_msg *um; - printf("Gone non-interactive, checking for outstanding interactive tasks\n"); + d(printf("Gone non-interactive, checking for outstanding interactive tasks\n")); /* clear out pending password requests */ while ((pm = (struct _pass_msg *)e_dlist_remhead(&password_list))) { - printf("Flushing password request : %s\n", pm->prompt); + d(printf("Flushing password request : %s\n", pm->prompt)); e_msgport_reply((EMsg *)pm); } /* destroy the current */ if (password_dialogue) { - printf("Destroying password dialogue\n"); + d(printf("Destroying password dialogue\n")); gtk_object_destroy((GtkObject *)password_dialogue); } /* same for pending user messages */ while ((um = (struct _user_message_msg *)e_dlist_remhead(&message_list))) { - printf("Flusing message request: %s\n", um->prompt); + d(printf("Flusing message request: %s\n", um->prompt)); e_msgport_reply((EMsg *)um); } /* and the current */ if (message_dialogue) { - printf("Destroying message dialogue\n"); + d(printf("Destroying message dialogue\n")); gtk_object_destroy((GtkObject *)message_dialogue); } } diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index b593b4757d..ca695f8ae6 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -475,7 +475,7 @@ mail_vfolder_rename_uri(CamelStore *store, const char *from, const char *to) if (changed) { char *user; - printf("Vfolders updated from renamed folder\n"); + d(printf("Vfolders updated from renamed folder\n")); user = g_strdup_printf("%s/vfolders.xml", evolution_dir); rule_context_save((RuleContext *)context, user); g_free(user); @@ -550,7 +550,7 @@ rule_changed(FilterRule *rule, CamelFolder *folder) else sources_uri = g_list_append(sources_uri, g_strdup(l->data)); } else { - printf(" -> No such folder?\n"); + d(printf(" -> No such folder?\n")); } l = l->next; } diff --git a/mail/message-list.c b/mail/message-list.c index 512102bb07..bcc6c22ea6 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -1766,7 +1766,7 @@ build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes) gettimeofday(&start, NULL); #endif - printf("updating changes to display\n"); + d(printf("updating changes to display\n")); /* remove individual nodes? */ d(printf("Removing messages from view:\n")); @@ -1977,9 +1977,12 @@ on_cursor_activated_idle (gpointer data) gint selected = e_selection_model_selected_count (esm); if (selected == 1 && message_list->cursor_uid) { - printf ("emitting cursor changed signal, for uid %s\n", message_list->cursor_uid); + d(printf ("emitting cursor changed signal, for uid %s\n", message_list->cursor_uid)); gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED], message_list->cursor_uid); + } else { + gtk_signal_emit (GTK_OBJECT (message_list), + message_list_signals[MESSAGE_SELECTED], NULL); } message_list->idle_id = 0; diff --git a/mail/subscribe-dialog.c b/mail/subscribe-dialog.c index e594b6dd5e..25d6290094 100644 --- a/mail/subscribe-dialog.c +++ b/mail/subscribe-dialog.c @@ -53,7 +53,7 @@ #include "art/empty.xpm" #include "art/mark.xpm" -#define d(x) x +#define d(x) /* Things to test. * - Feature @@ -829,7 +829,7 @@ fe_done_subscribing (const char *full_name, const char *name, gboolean subscribe { ftree_op_data *closure = (ftree_op_data *) user_data; - if (success) { + if (success && closure->handle != -1) { char *path; path = fe_node_to_shell_path (closure->data); @@ -850,7 +850,9 @@ fe_done_subscribing (const char *full_name, const char *name, gboolean subscribe e_tree_model_node_data_changed (E_TREE_MODEL (closure->ftree), closure->path); } - g_hash_table_remove (closure->ftree->subscribe_ops, closure->path); + if (closure->handle != -1) + g_hash_table_remove (closure->ftree->subscribe_ops, closure->path); + g_free (closure); } @@ -864,10 +866,9 @@ fe_cancel_op_foreach (gpointer key, gpointer value, gpointer user_data) if (closure->handle != -1) mail_msg_cancel (closure->handle); - else - printf ("aaagh, annoying race condition in fe_cancel_op_foreach.\n"); - g_free (value); + closure->handle = -1; + return TRUE; } @@ -1135,7 +1136,7 @@ static void store_data_async_get_store (StoreData *sd, StoreDataStoreFunc func, gpointer user_data) { if (sd->request_id) { - printf ("Already loading store, nooping\n"); + d(printf ("Already loading store, nooping\n")); return; } -- cgit v1.2.3