aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog17
-rw-r--r--mail/folder-browser.c3
-rw-r--r--mail/mail-callbacks.c18
-rw-r--r--mail/message-list.c13
4 files changed, 37 insertions, 14 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 6caf961a81..8746e2a868 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,20 @@
+2001-05-10 Dan Winship <danw@ximian.com>
+
+ * 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.)
+
2001-05-09 Dan Winship <danw@ximian.com>
* mail-offline-handler.c: New file, started by Ettore, finished by
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index c070dd2072..09da831955 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -839,9 +839,6 @@ on_key_press (GtkWidget *widget, GdkEventKey *key, gpointer data)
case GDK_Delete:
case GDK_KP_Delete:
delete_msg (NULL, fb);
- message_list_select (fb->message_list, row,
- MESSAGE_LIST_SELECT_NEXT,
- 0, CAMEL_MESSAGE_DELETED);
return TRUE;
case 'n':
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
diff --git a/mail/message-list.c b/mail/message-list.c
index 1c241efd1b..f42707e807 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -370,7 +370,7 @@ get_message_info (MessageList *message_list, ETreePath node)
* %MESSAGE_LIST_SELECT_NEXT if it should find the next matching
* message, or %MESSAGE_LIST_SELECT_PREVIOUS if it should find the
* previous. If no suitable row is found, the selection will be
- * unchanged but the message display will be cleared.
+ * unchanged.
**/
void
message_list_select (MessageList *message_list, int base_row,
@@ -417,11 +417,6 @@ message_list_select (MessageList *message_list, int base_row,
}
vrow += direction;
}
-
- g_free (message_list->cursor_uid);
- message_list->cursor_uid = NULL;
-
- gtk_signal_emit(GTK_OBJECT (message_list), message_list_signals [MESSAGE_SELECTED], NULL);
}
@@ -448,7 +443,7 @@ message_list_select_uid (MessageList *message_list, const char *uid)
} else {
g_free (message_list->cursor_uid);
message_list->cursor_uid = NULL;
- gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals [MESSAGE_SELECTED], uid);
+ gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals [MESSAGE_SELECTED], NULL);
}
}
@@ -1473,6 +1468,10 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c
e_tree_set_cursor(ml->tree, node);
}
g_free(saveuid);
+ } else if (ml->cursor_uid && !g_hash_table_lookup(ml->uid_nodemap, ml->cursor_uid)) {
+ g_free(ml->cursor_uid);
+ ml->cursor_uid = NULL;
+ gtk_signal_emit((GtkObject *)ml, message_list_signals[MESSAGE_SELECTED], NULL);
}
#ifdef TIMEIT