[evolution-patches] mail, bug 54259, delete last mail in message list cause focus disappear



Hi all,

The patch is for HEAD.

In most cases, when mail is deleted focus will move to next mail. The logic
is implemented in emfv_popup_delete().  But when the deleted mail happens
to be the last one,  the next mail returned by message_list_selecct() is -1.
So the focus lost.

My fix to this problem is when delete last mail, the focus should move to
previous mail.

It has been tested in my environment. Please review
Thanks

York



Index: em-folder-view.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-folder-view.c,v
retrieving revision 1.29
diff -u -r1.29 em-folder-view.c
--- em-folder-view.c	6 Feb 2004 17:44:54 -0000	1.29
+++ em-folder-view.c	12 Feb 2004 09:35:56 -0000
@@ -611,8 +611,11 @@
 	uids = message_list_get_selected(emfv->list);
 	em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED);
 	
-	if (uids->len == 1)
-		message_list_select(emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0, FALSE);
+	if (uids->len == 1) {
+		/* Delete last message cause focus move to previous message. */
+		if (!message_list_select(emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0, FALSE))
+			message_list_select(emfv->list, MESSAGE_LIST_SELECT_PREVIOUS, 0, 0, FALSE);
+	}
 	
 	em_utils_uids_free(uids);
 }
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3093
diff -u -r1.3093 ChangeLog
--- ChangeLog	11 Feb 2004 21:53:56 -0000	1.3093
+++ ChangeLog	12 Feb 2004 10:03:11 -0000
@@ -1,3 +1,8 @@
+2004-02-11  Yuedong Du <yuedong du sun com>
+
+	* em-folder-view.c: (emfv_popup_delete): If it is the last mail being
+	deleted, focus should move to previous mail.
+
 2004-02-11  Jeffrey Stedfast  <fejj ximian com>
 
 	* mail-component.c (mail_control_new): Disable the


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