Transferring messages



After transferring a message/messages using the `Transfer' menu item, no
message is selected in the preview window, whereas after trashing one or
more messages, the next remaining message is selected.  The attached patch
makes the behavior more consistent--specifically, it adds code to
transfer_messages_cb (in src/balsa-index.c) similar to that in do_delete.

Also, trashing (and now transferring) all messages from a mailbox, when
it contains more than 1, pops up a dialog box with a message about not
being
able to access some message's body. Current code seems to assume that only
one message is being transferred, and tries to select a zombie message. The
patch adds a message counter to improve the handling of trashing (or
transferring) multiple messages.

As always, all comments and suggestions are welcome.

diff -Nur balsa/src/balsa-index.c balsa-work/src/balsa-index.c
--- balsa/src/balsa-index.c	Wed Jun 20 04:55:41 2001
+++ balsa-work/src/balsa-index.c	Wed Jun 27 12:56:29 2001
@@ -1487,6 +1487,7 @@
     gboolean select_next = TRUE;
     GList *messages=NULL;
     LibBalsaMailbox *orig;
+    gint message_count = 0;
 
     /* select the previous message if we're at the bottom of the index */
     if (GTK_CLIST(index->ctree)->rows - 1 == 
@@ -1498,6 +1499,7 @@
 	message = gtk_ctree_node_get_row_data(index->ctree, list->data);
 	messages= g_list_append(messages, message);
 	orig = message->mailbox; /* sloppy way */
+	++message_count;
     }
     if(messages) {
 	if (move_to_trash && (index != trash)) {
@@ -1508,7 +1510,7 @@
     }
     
     /* select another message depending on where we are in the list */
-    if (GTK_CLIST(index->ctree)->rows > 1) {
+    if (GTK_CLIST(index->ctree)->rows > message_count) {
         if (select_next)
             balsa_index_select_next(index);
 	else
@@ -1967,6 +1969,8 @@
     GList *list, *messages;
     LibBalsaMessage* message;
     BalsaMailboxNode *mbnode;
+    gboolean select_next = TRUE;
+    gint message_count = 0;
 
     g_return_if_fail(data != NULL);
 
@@ -1981,17 +1985,32 @@
     if (bindex->mailbox_node->mailbox == mbnode->mailbox)
 	return;
 
+    /* select the previous message if we're at the bottom of the index */
+    if (clist->rows - 1 == bi_get_largest_selected(clist))
+        select_next = FALSE;
+
+
     messages=NULL;
     for (list = clist->selection; list;list = list->next) {
 	message = gtk_ctree_node_get_row_data(GTK_CTREE(bindex->ctree), 
 					      list->data);
 	messages=g_list_append(messages, message);
+	++message_count;
     }
 
     if(messages!=NULL) {
 	balsa_messages_move(messages, mbnode->mailbox);
 	g_list_free(messages);
     }
+   
+    /* select another message depending on where we are in the list */
+    if (clist->rows > message_count) {
+        if (select_next)
+            balsa_index_select_next(bindex);
+        else
+            balsa_index_select_previous(bindex);
+    }
+
 
     libbalsa_mailbox_sync_backend(bindex->mailbox_node->mailbox);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]