From dd04e750f24f2e0300bc45e4916dddf6d492024c Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 10 May 2001 16:16:06 +0000 Subject: Don't advance to the next undeleted message after "Delete"... * folder-browser.c (on_key_press): Don't advance to the next undeleted message after "Delete"... * mail-callbacks.c (delete_msg): ...instead, do it here, whether the user used Delete, Alt+D, or the toolbar. (But only if they only deleted a single message.) * message-list.c (message_list_select): Don't clear the display on failure. (build_tree): Clear the display when the currently-selected message stops existing and we don't have an obvious message to select instead of it. (Eg, when deleting the last message with "hide deleted messages" set, or expunging while a deleted message is selected.) svn path=/trunk/; revision=9744 --- mail/mail-callbacks.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'mail/mail-callbacks.c') diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 4e1741db63..0f60037da5 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -945,8 +945,8 @@ invert_selection (BonoboUIComponent *uih, void *user_data, const char *path) e_tree_invert_selection (ml->tree); } -/* flag all selected messages */ -static void +/* flag all selected messages. Return number flagged */ +static int flag_messages(FolderBrowser *fb, guint32 mask, guint32 set) { MessageList *ml = fb->message_list; @@ -954,7 +954,7 @@ flag_messages(FolderBrowser *fb, guint32 mask, guint32 set) int i; if (ml->folder == NULL) - return; + return 0; /* could just use specific callback but i'm lazy */ uids = g_ptr_array_new (); @@ -967,6 +967,8 @@ flag_messages(FolderBrowser *fb, guint32 mask, guint32 set) camel_folder_thaw (ml->folder); g_ptr_array_free (uids, TRUE); + + return i; } void @@ -1338,7 +1340,15 @@ save_msg (GtkWidget *widget, gpointer user_data) void delete_msg (GtkWidget *button, gpointer user_data) { - flag_messages(FOLDER_BROWSER(user_data), CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN); + FolderBrowser *fb = FOLDER_BROWSER (user_data); + int deleted, row; + + deleted = flag_messages (fb, CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN, + CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN); + if (deleted == 1) { + row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree)); + message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_DELETED); + } } void -- cgit