Re: [evolution-patches] fix for bug #57090




actually this could be done better.

e.g. it could only enable 'not junk' if the list contains one junk message, not just always.

this would be more consistent with the way mark as read/not read do.

On Mon, 2004-07-12 at 21:07 +0000, Jeffrey Stedfast wrote:
http://bugzilla.ximian.com/show_bug.cgi?id=57090

sent on behalf of clahey

looks okay to me

Jeff

Plain text document attachment (trash.patch)
? trash.patch
? shell/Evolution-Addressbook-SelectNames-common.c
? shell/Evolution-Addressbook-SelectNames-skels.c
? shell/Evolution-Addressbook-SelectNames-stubs.c
? shell/Evolution-Addressbook-SelectNames.h
? shell/glade/Makefile
? shell/glade/Makefile.in
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3414
diff -u -p -r1.3414 ChangeLog
--- mail/ChangeLog	10 Jul 2004 01:31:04 -0000	1.3414
+++ mail/ChangeLog	12 Jul 2004 21:08:34 -0000
@@ -1,3 +1,13 @@
+2004-07-12  Christopher James Lahey  <clahey ximian com>
+
+	* em-folder-view.c (emfv_popup_mark_junk, emfv_popup_mark_nojunk,
+	emfv_popup_delete): Optimized these to not allocate and free a uid
+	list.
+	(emfv_popup_menu): Make the popup menus for marking as trash
+	always show up if there are mails selected.
+	(emfv_enable_map): Make the main menus for marking as trash always
+	be active if there are mails selected.
+
 2004-07-09  Not Zed  <NotZed Ximian com>
 
 	* em-folder-browser.c (emfb_folder_expunge): only call expunge if
Index: mail/em-folder-view.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-folder-view.c,v
retrieving revision 1.80
diff -u -p -r1.80 em-folder-view.c
--- mail/em-folder-view.c	23 Jun 2004 08:08:40 -0000	1.80
+++ mail/em-folder-view.c	12 Jul 2004 21:08:34 -0000
@@ -716,46 +716,38 @@ emfv_popup_mark_unimportant(GtkWidget *w
 static void
 emfv_popup_mark_junk (GtkWidget *w, EMFolderView *emfv)
 {
-	GPtrArray *uids;
+	int count;
 	
-	uids = message_list_get_selected(emfv->list);
-	em_folder_view_mark_selected(emfv,
-				     CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN,
-				     CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN);
-	if (uids->len == 1)
+	count = em_folder_view_mark_selected(emfv,
+					     CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN,
+					     CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN);
+	if (count == 1)
 		message_list_select(emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0, FALSE);
-
-	message_list_free_uids(emfv->list, uids);
 }
 
 static void
 emfv_popup_mark_nojunk (GtkWidget *w, EMFolderView *emfv)
 {
-	GPtrArray *uids;
+	int count;
 	
-	uids = message_list_get_selected(emfv->list);
-	em_folder_view_mark_selected(emfv,
-				     CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN,
-				     CAMEL_MESSAGE_JUNK_LEARN);
-	if (uids->len == 1)
+	count = em_folder_view_mark_selected(emfv,
+					     CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN,
+					     CAMEL_MESSAGE_JUNK_LEARN);
+	if (count == 1)
 		message_list_select(emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0, FALSE);
-
-	message_list_free_uids(emfv->list, uids);
 }
 
 static void
 emfv_popup_delete(GtkWidget *w, EMFolderView *emfv)
 {
-	GPtrArray *uids;
+	int count;
 	
-	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);
+	count = em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED);
 	
-	if (uids->len == 1) {
+	if (count == 1) {
 		if (!message_list_select (emfv->list, MESSAGE_LIST_SELECT_NEXT, 0, 0, FALSE) && emfv->hide_deleted)
 			message_list_select (emfv->list, MESSAGE_LIST_SELECT_PREVIOUS, 0, 0, FALSE);
 	}
-	em_utils_uids_free(uids);
 }
 
 static void
@@ -916,8 +908,8 @@ static EMPopupItem emfv_popup_menu[] = {
 	{ EM_POPUP_ITEM,  "30.emfv.01", N_("Mark as _Unread"), G_CALLBACK(emfv_popup_mark_unread), NULL, "stock_mail-unread", EM_POPUP_SELECT_MARK_UNREAD },
 	{ EM_POPUP_ITEM, "30.emfv.02", N_("Mark as _Important"), G_CALLBACK(emfv_popup_mark_important), NULL, "stock_mail-priority-high", EM_POPUP_SELECT_MARK_IMPORTANT },
 	{ EM_POPUP_ITEM, "30.emfv.03", N_("_Mark as Unimportant"), G_CALLBACK(emfv_popup_mark_unimportant), NULL, NULL, EM_POPUP_SELECT_MARK_UNIMPORTANT },
-	{ EM_POPUP_ITEM, "30.emfv.04", N_("Mark as _Junk"), G_CALLBACK(emfv_popup_mark_junk), NULL, "stock_spam", EM_POPUP_SELECT_MARK_JUNK },
-	{ EM_POPUP_ITEM, "30.emfv.05", N_("Mark as _Not Junk"), G_CALLBACK(emfv_popup_mark_nojunk), NULL, "stock_not-spam", EM_POPUP_SELECT_MARK_NOJUNK },
+	{ EM_POPUP_ITEM, "30.emfv.04", N_("Mark as _Junk"), G_CALLBACK(emfv_popup_mark_junk), NULL, "stock_spam", EM_POPUP_SELECT_MANY },
+	{ EM_POPUP_ITEM, "30.emfv.05", N_("Mark as _Not Junk"), G_CALLBACK(emfv_popup_mark_nojunk), NULL, "stock_not-spam", EM_POPUP_SELECT_MANY },
 	
 	{ EM_POPUP_BAR, "40.emfv" },
 	{ EM_POPUP_ITEM, "40.emfv.00", N_("_Delete"), G_CALLBACK(emfv_popup_delete), NULL, "stock_delete", EM_POPUP_SELECT_DELETE },
@@ -1574,8 +1566,8 @@ static const EMFolderViewEnable emfv_ena
 	{ "MessageMarkAsUnRead",      EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_UNREAD },
 	{ "MessageMarkAsImportant",   EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_IMPORTANT },
 	{ "MessageMarkAsUnimportant", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_UNIMPORTANT },
-	{ "MessageMarkAsJunk",        EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_JUNK },
-	{ "MessageMarkAsNotJunk",     EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_MARK_NOJUNK },
+	{ "MessageMarkAsJunk",        EM_POPUP_SELECT_MANY },
+	{ "MessageMarkAsNotJunk",     EM_POPUP_SELECT_MANY },
 	{ "MessageFollowUpFlag",      EM_POPUP_SELECT_MANY },
 	{ "MessageMove",              EM_POPUP_SELECT_MANY },
 	{ "MessageOpen",              EM_POPUP_SELECT_MANY },
--
Michael Zucchi <notzed ximian com>

Novell's Evolution and Free Software Developer


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