[Commits] mainwindow.c 1.274.2.358 1.274.2.359 mainwindow.h 1.39.2.65 1.39.2.66 summaryview.c 1.395.2.458 1.395.2.459 toolbar.c 1.43.2.132 1.43.2.133

wwp at claws-mail.org wwp at claws-mail.org
Wed Nov 28 16:33:15 CET 2012


Update of /home/claws-mail/claws/src
In directory srv:/tmp/cvs-serv21524/src

Modified Files:
      Tag: gtk2
	mainwindow.c mainwindow.h summaryview.c toolbar.c 
Log Message:
2012-11-28 [wwp]	3.9.0cvs29

	* src/mainwindow.c
	* src/mainwindow.h
	* src/summaryview.c
	* src/toolbar.c
	Rework SensitiveCond enum to allow more than 32 flags for GUI status checking.
	Complete toolbar_init(), which was missing few inits.

Index: summaryview.c
===================================================================
RCS file: /home/claws-mail/claws/src/summaryview.c,v
retrieving revision 1.395.2.458
retrieving revision 1.395.2.459
diff -u -d -r1.395.2.458 -r1.395.2.459
--- summaryview.c	15 Nov 2012 15:23:12 -0000	1.395.2.458
+++ summaryview.c	28 Nov 2012 15:33:13 -0000	1.395.2.459
@@ -1713,68 +1713,79 @@
 	gboolean sensitive;
 	gint i;
 
-	static const struct {
-		gchar *const entry;
-		SensitiveCond cond;
-	} entry[] = {
-		{"Menus/SummaryViewPopup/Reply"			, M_HAVE_ACCOUNT|M_TARGET_EXIST},
+#define N_ENTRIES 38
+	static struct {
+		const gchar *entry;
+		SensitiveCondMask cond;
+	} entry[N_ENTRIES];
+
+	i = 0;
+#define FILL_TABLE(entry_str, ...) \
+do { \
+	entry[i].entry = (const gchar *) entry_str; entry[i++].cond = main_window_get_mask(__VA_ARGS__, -1); \
+} while (0)
+
+	FILL_TABLE("Menus/SummaryViewPopup/Reply", M_HAVE_ACCOUNT, M_TARGET_EXIST);
 #ifndef GENERIC_UMPC
-		{"Menus/SummaryViewPopup/ReplyTo"			, M_HAVE_ACCOUNT|M_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/ReplyTo/All"		, M_HAVE_ACCOUNT|M_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/ReplyTo/Sender"             , M_HAVE_ACCOUNT|M_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/ReplyTo/MailingList"       , M_HAVE_ACCOUNT|M_TARGET_EXIST},
+	FILL_TABLE("Menus/SummaryViewPopup/ReplyTo", M_HAVE_ACCOUNT, M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/ReplyTo/All", M_HAVE_ACCOUNT, M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/ReplyTo/Sender", M_HAVE_ACCOUNT, M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/ReplyTo/MailingList", M_HAVE_ACCOUNT, M_TARGET_EXIST);
 #endif
 
-		{"Menus/SummaryViewPopup/Forward"			, M_HAVE_ACCOUNT|M_TARGET_EXIST},
+	FILL_TABLE("Menus/SummaryViewPopup/Forward", M_HAVE_ACCOUNT, M_TARGET_EXIST);
 #ifndef GENERIC_UMPC
-		{"Menus/SummaryViewPopup/ForwardAtt"	, M_HAVE_ACCOUNT|M_TARGET_EXIST},
-        	{"Menus/SummaryViewPopup/Redirect"			, M_HAVE_ACCOUNT|M_TARGET_EXIST},
+	FILL_TABLE("Menus/SummaryViewPopup/ForwardAtt", M_HAVE_ACCOUNT, M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/Redirect", M_HAVE_ACCOUNT, M_TARGET_EXIST);
 #endif
 
-		{"Menus/SummaryViewPopup/Move"			, M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS},
-		{"Menus/SummaryViewPopup/Copy"			, M_TARGET_EXIST|M_EXEC},
-		{"Menus/SummaryViewPopup/Trash"		, M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS|M_NOT_TRASH},
+	FILL_TABLE("Menus/SummaryViewPopup/Move", M_TARGET_EXIST, M_ALLOW_DELETE, M_NOT_NEWS);
+	FILL_TABLE("Menus/SummaryViewPopup/Copy", M_TARGET_EXIST, M_EXEC);
+	FILL_TABLE("Menus/SummaryViewPopup/Trash", M_TARGET_EXIST, M_ALLOW_DELETE, M_NOT_NEWS, M_NOT_TRASH);
 #ifndef GENERIC_UMPC
-		{"Menus/SummaryViewPopup/Delete"			, M_TARGET_EXIST|M_ALLOW_DELETE},
+	FILL_TABLE("Menus/SummaryViewPopup/Delete", M_TARGET_EXIST, M_ALLOW_DELETE);
 #endif
 
-		{"Menus/SummaryViewPopup/Mark"			, M_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/Mark/Mark"   		, M_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/Mark/Unmark"   		, M_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/Mark/MarkUnread"   	, M_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/Mark/MarkRead"   	, M_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/Mark/MarkAllRead"   	, M_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/Mark/IgnoreThread"   	, M_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/Mark/UnignoreThread"   	, M_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/Mark/WatchThread"   		, M_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/Mark/UnwatchThread"   	, M_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/Mark/Unlock"   		, M_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/Mark/Lock"   		, M_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/Mark/MarkSpam"	  	, M_TARGET_EXIST|M_CAN_LEARN_SPAM},
-		{"Menus/SummaryViewPopup/Mark/MarkHam" 		, M_TARGET_EXIST|M_CAN_LEARN_SPAM},
-		{"Menus/SummaryViewPopup/ColorLabel"			, M_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/Tags"			, M_TARGET_EXIST},
+	FILL_TABLE("Menus/SummaryViewPopup/Mark", M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/Mark/Mark", M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/Mark/Unmark", M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/Mark/MarkUnread", M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/Mark/MarkRead", M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/Mark/MarkAllRead", M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/Mark/IgnoreThread", M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/Mark/UnignoreThread", M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/Mark/WatchThread", M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/Mark/UnwatchThread", M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/Mark/Unlock", M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/Mark/Lock", M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/Mark/MarkSpam", M_TARGET_EXIST, M_CAN_LEARN_SPAM);
+	FILL_TABLE("Menus/SummaryViewPopup/Mark/MarkHam", M_TARGET_EXIST, M_CAN_LEARN_SPAM);
+	FILL_TABLE("Menus/SummaryViewPopup/ColorLabel", M_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/Tags", M_TARGET_EXIST);
 
 #ifndef GENERIC_UMPC
-		{"Menus/SummaryViewPopup/AddSenderToAB"	, M_SINGLE_TARGET_EXIST},
+	FILL_TABLE("Menus/SummaryViewPopup/AddSenderToAB", M_SINGLE_TARGET_EXIST);
 #endif
-		{"Menus/SummaryViewPopup/CreateFilterRule"		, M_SINGLE_TARGET_EXIST|M_UNLOCKED},
+	FILL_TABLE("Menus/SummaryViewPopup/CreateFilterRule", M_SINGLE_TARGET_EXIST, M_UNLOCKED);
 #ifndef GENERIC_UMPC
-		{"Menus/SummaryViewPopup/CreateProcessingRule"	, M_SINGLE_TARGET_EXIST|M_UNLOCKED},
+	FILL_TABLE("Menus/SummaryViewPopup/CreateProcessingRule", M_SINGLE_TARGET_EXIST, M_UNLOCKED);
 #endif
 
-		{"Menus/SummaryViewPopup/View"			, M_SINGLE_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/View/OpenNewWindow"     , M_SINGLE_TARGET_EXIST},
-		{"Menus/SummaryViewPopup/View/MessageSource"		, M_SINGLE_TARGET_EXIST},
+	FILL_TABLE("Menus/SummaryViewPopup/View", M_SINGLE_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/View/OpenNewWindow", M_SINGLE_TARGET_EXIST);
+	FILL_TABLE("Menus/SummaryViewPopup/View/MessageSource", M_SINGLE_TARGET_EXIST);
 #ifndef GENERIC_UMPC
-		{"Menus/SummaryViewPopup/View/AllHeaders"		, M_SINGLE_TARGET_EXIST},
+	FILL_TABLE("Menus/SummaryViewPopup/View/AllHeaders", M_SINGLE_TARGET_EXIST);
 #endif
-		{"Menus/SummaryViewPopup/SaveAs"			, M_TARGET_EXIST},
+	FILL_TABLE("Menus/SummaryViewPopup/SaveAs", M_TARGET_EXIST);
 #ifndef GENERIC_UMPC
-		{"Menus/SummaryViewPopup/Print"			, M_TARGET_EXIST},
+	FILL_TABLE("Menus/SummaryViewPopup/Print", M_TARGET_EXIST);
 #endif
-		{NULL, 0}
-	};
+	FILL_TABLE(NULL, 0);
+#undef FILL_TABLE
+	if (i != N_ENTRIES)
+		g_error("summaryview menu entry table size mismatch (%d/%d)", i, N_ENTRIES);
+#undef ENTRIES
 
 	main_window_set_menu_sensitive(summaryview->mainwin);
 

Index: toolbar.c
===================================================================
RCS file: /home/claws-mail/claws/src/toolbar.c,v
retrieving revision 1.43.2.132
retrieving revision 1.43.2.133
diff -u -d -r1.43.2.132 -r1.43.2.133
--- toolbar.c	16 Nov 2012 23:42:14 -0000	1.43.2.132
+++ toolbar.c	28 Nov 2012 15:33:13 -0000	1.43.2.133
@@ -2357,26 +2357,27 @@
 	typedef struct _Entry Entry;
 	struct _Entry {
 		GtkWidget *widget;
-		SensitiveCond cond;
+		SensitiveCondMask cond;
 		gboolean empty;
 	};
 
-#define SET_WIDGET_COND(w, c)     \
-{ \
+#define SET_WIDGET_COND(w, ...)     \
+do { \
 	Entry *e = g_new0(Entry, 1); \
 	e->widget = w; \
-	e->cond   = c; \
+	e->cond = main_window_get_mask(__VA_ARGS__, -1); \
 	entry_list = g_slist_append(entry_list, e); \
-}
-
+} while (0)
 	
+	/* match all bit flags */
+
 	if (toolbar->get_btn)
 		SET_WIDGET_COND(toolbar->get_btn, 
-			M_HAVE_ACCOUNT|M_UNLOCKED|M_HAVE_RETRIEVABLE_ACCOUNT);
+			M_HAVE_ACCOUNT, M_UNLOCKED, M_HAVE_RETRIEVABLE_ACCOUNT);
 
 	if (toolbar->getall_btn) {
 		SET_WIDGET_COND(toolbar->getall_btn, 
-			M_HAVE_ACCOUNT|M_UNLOCKED|M_HAVE_ANY_RETRIEVABLE_ACCOUNT);
+			M_HAVE_ACCOUNT, M_UNLOCKED, M_HAVE_ANY_RETRIEVABLE_ACCOUNT);
 	}
 	if (toolbar->send_btn) {
 		SET_WIDGET_COND(toolbar->send_btn,
@@ -2392,42 +2393,42 @@
 	}
 	if (toolbar->open_mail_btn) {
 		SET_WIDGET_COND(toolbar->open_mail_btn, 
-			M_TARGET_EXIST|M_SUMMARY_ISLIST);
+			M_TARGET_EXIST, M_SUMMARY_ISLIST);
 	}
 	if (toolbar->reply_btn) {
 		SET_WIDGET_COND(toolbar->reply_btn,
-			M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST);
+			M_HAVE_ACCOUNT, M_TARGET_EXIST, M_SUMMARY_ISLIST);
 	}
 	if (toolbar->replyall_btn) {
 		SET_WIDGET_COND(toolbar->replyall_btn,
-			M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST);
+			M_HAVE_ACCOUNT, M_TARGET_EXIST, M_SUMMARY_ISLIST);
 	}
 	if (toolbar->replylist_btn) {
 		SET_WIDGET_COND(toolbar->replylist_btn,
-			M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST);
+			M_HAVE_ACCOUNT, M_TARGET_EXIST, M_SUMMARY_ISLIST);
 	}
 	if (toolbar->replysender_btn) {
 		SET_WIDGET_COND(toolbar->replysender_btn,
-			M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST);
+			M_HAVE_ACCOUNT, M_TARGET_EXIST, M_SUMMARY_ISLIST);
 	}
 	if (toolbar->fwd_btn) {
 		SET_WIDGET_COND(toolbar->fwd_btn, 
-			M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST);
+			M_HAVE_ACCOUNT, M_TARGET_EXIST, M_SUMMARY_ISLIST);
 	}
 
 	if (prefs_common.next_unread_msg_dialog == NEXTUNREADMSGDIALOG_ASSUME_NO) {
-		SET_WIDGET_COND(toolbar->next_btn, M_MSG_EXIST|M_SUMMARY_ISLIST);
+		SET_WIDGET_COND(toolbar->next_btn, M_MSG_EXIST, M_SUMMARY_ISLIST);
 	} else {
 		SET_WIDGET_COND(toolbar->next_btn, 0);
 	}
 	
 	if (toolbar->trash_btn)
 		SET_WIDGET_COND(toolbar->trash_btn,
-			M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS);
+			M_TARGET_EXIST, M_ALLOW_DELETE, M_NOT_NEWS);
 
 	if (toolbar->delete_btn)
 		SET_WIDGET_COND(toolbar->delete_btn,
-			M_TARGET_EXIST|M_ALLOW_DELETE);
+			M_TARGET_EXIST, M_ALLOW_DELETE);
 
 	if (toolbar->exec_btn)
 		SET_WIDGET_COND(toolbar->exec_btn, 
@@ -2435,7 +2436,7 @@
 	
 	if (toolbar->learn_spam_btn)
 		SET_WIDGET_COND(toolbar->learn_spam_btn, 
-			M_TARGET_EXIST|M_CAN_LEARN_SPAM|M_SUMMARY_ISLIST);
+			M_TARGET_EXIST, M_CAN_LEARN_SPAM, M_SUMMARY_ISLIST);
 
 	if (toolbar->cancel_inc_btn)
 		SET_WIDGET_COND(toolbar->cancel_inc_btn,
@@ -2444,11 +2445,9 @@
 	for (cur = toolbar->action_list; cur != NULL;  cur = cur->next) {
 		ToolbarClawsActions *act = (ToolbarClawsActions*)cur->data;
 		
-		SET_WIDGET_COND(act->widget, M_TARGET_EXIST|M_UNLOCKED);
+		SET_WIDGET_COND(act->widget, M_TARGET_EXIST, M_UNLOCKED);
 	}
 
-#undef SET_WIDGET_COND
-
 	state = main_window_get_current_state(mainwin);
 
 	for (cur = entry_list; cur != NULL; cur = cur->next) {
@@ -2467,12 +2466,33 @@
 		entry_list = g_slist_remove(entry_list, e);
 	}
 
+	/* match any bit flags */
+
+	/*
+	for (cur = entry_list; cur != NULL; cur = cur->next) {
+		Entry *e = (Entry*) cur->data;
+
+		if (e->widget != NULL) {
+			sensitive = ((e->cond & state) != 0);
+			GTK_BUTTON_SET_SENSITIVE(e->widget, sensitive);	
+		}
+	}
+	*/
+
+	while (entry_list != NULL) {
+		Entry *e = (Entry*) entry_list->data;
+
+		g_free(e);
+		entry_list = g_slist_remove(entry_list, e);
+	}
+
 	g_slist_free(entry_list);
 
 	activate_compose_button(toolbar, 
 				prefs_common.toolbar_style,
 				toolbar->compose_btn_type);
 	
+#undef SET_WIDGET_COND
 }
 
 void toolbar_comp_set_sensitive(gpointer data, gboolean sensitive)
@@ -2516,38 +2536,51 @@
 static void toolbar_init(Toolbar * toolbar)
 {
 
-	toolbar->toolbar          	= NULL;
-	toolbar->folders_btn		= NULL;
-	toolbar->get_btn          	= NULL;
-	toolbar->getall_btn       	= NULL;
-	toolbar->send_btn         	= NULL;
-	toolbar->compose_mail_btn 	= NULL;
-	toolbar->compose_mail_icon 	= NULL;
-	toolbar->compose_news_icon 	= NULL;
-	toolbar->reply_btn        	= NULL;
-	toolbar->replysender_btn  	= NULL;
-	toolbar->replyall_btn     	= NULL;
-	toolbar->replylist_btn    	= NULL;
-	toolbar->fwd_btn          	= NULL;
-	toolbar->trash_btn       	= NULL;
-	toolbar->delete_btn       	= NULL;
-	toolbar->prev_btn         	= NULL;
-	toolbar->next_btn         	= NULL;
-	toolbar->exec_btn         	= NULL;
-	toolbar->open_mail_btn		= NULL;
-	toolbar->close_window_btn	= NULL;
+	toolbar->toolbar           = NULL;
+	toolbar->folders_btn       = NULL;
+	toolbar->get_btn           = NULL;
+	toolbar->getall_btn        = NULL;
+	toolbar->send_btn          = NULL;
+	toolbar->compose_mail_btn  = NULL;
+	toolbar->compose_mail_icon = NULL;
+	toolbar->compose_news_icon = NULL;
+	toolbar->reply_btn         = NULL;
+	toolbar->replysender_btn   = NULL;
+	toolbar->replyall_btn      = NULL;
+	toolbar->replylist_btn     = NULL;
+	toolbar->fwd_btn           = NULL;
+	toolbar->trash_btn         = NULL;
+	toolbar->delete_btn        = NULL;
+	toolbar->prev_btn          = NULL;
+	toolbar->next_btn          = NULL;
+	toolbar->exec_btn          = NULL;
+	toolbar->separator         = NULL;
+	toolbar->learn_spam_btn    = NULL;
+	toolbar->learn_spam_icon   = NULL;
+	toolbar->learn_ham_icon    = NULL;
+	toolbar->cancel_inc_btn    = NULL;
+
 	/* compose buttons */ 
-	toolbar->sendl_btn        	= NULL;
-	toolbar->draft_btn        	= NULL;
-	toolbar->insert_btn       	= NULL;
-	toolbar->attach_btn       	= NULL;
-	toolbar->sig_btn          	= NULL;	
-	toolbar->exteditor_btn    	= NULL;	
-	toolbar->linewrap_current_btn	= NULL;	
-	toolbar->linewrap_all_btn     	= NULL;	
-	toolbar->addrbook_btn     	= NULL;	
+	toolbar->sendl_btn         = NULL;
+	toolbar->draft_btn         = NULL;
+	toolbar->insert_btn        = NULL;
+	toolbar->attach_btn        = NULL;
+	toolbar->sig_btn           = NULL; 
+	toolbar->exteditor_btn     = NULL; 
+	toolbar->linewrap_current_btn = NULL;	
+	toolbar->linewrap_all_btn  = NULL;	
+	toolbar->addrbook_btn      = NULL; 
+
+	toolbar->open_mail_btn     = NULL;
+	toolbar->close_window_btn  = NULL;
+	toolbar->preferences_btn   = NULL;
+	toolbar->action_list       = NULL;
+	toolbar->item_list         = NULL;
 #ifdef USE_ENCHANT
-	toolbar->spellcheck_btn   	= NULL;
+	toolbar->spellcheck_btn    = NULL;
+#endif
+#if !GTK_CHECK_VERSION(2,12,0)
+	toolbar->tooltips          = NULL;
 #endif
 
 	toolbar_destroy(toolbar);

Index: mainwindow.c
===================================================================
RCS file: /home/claws-mail/claws/src/mainwindow.c,v
retrieving revision 1.274.2.358
retrieving revision 1.274.2.359
diff -u -d -r1.274.2.358 -r1.274.2.359
--- mainwindow.c	28 Nov 2012 11:11:40 -0000	1.274.2.358
+++ mainwindow.c	28 Nov 2012 15:33:12 -0000	1.274.2.359
@@ -23,6 +23,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 #include <string.h>
+#include <stdarg.h>
 
 #include "main.h"
 #include "mainwindow.h"
@@ -3122,88 +3123,93 @@
 	
 	selection = summary_get_selection_type(mainwin->summaryview);
 
+#define UPDATE_STATE(...) \
+	do { \
+		state |= main_window_get_mask(__VA_ARGS__, -1); \
+	} while (0)
+
 	if (mainwin->lock_count == 0 && !claws_is_starting())
-		state |= M_UNLOCKED;
+		UPDATE_STATE(M_UNLOCKED);
 	if (selection != SUMMARY_NONE)
-		state |= M_MSG_EXIST;
+		UPDATE_STATE(M_MSG_EXIST);
 	if (item && item->path && folder_item_parent(item) && !item->no_select) {
-		state |= M_EXEC;
+		UPDATE_STATE(M_EXEC);
 		/*		if (item->folder->type != F_NEWS) */
-		state |= M_ALLOW_DELETE;
+		UPDATE_STATE(M_ALLOW_DELETE);
 
 		if (prefs_common.immediate_exec == 0
 		    && mainwin->lock_count == 0)
-			state |= M_DELAY_EXEC;
+			UPDATE_STATE(M_DELAY_EXEC);
 
 		if ((selection == SUMMARY_NONE && item->hide_read_msgs)
 		    || selection != SUMMARY_NONE)
-			state |= M_HIDE_READ_MSG;
+			UPDATE_STATE(M_HIDE_READ_MSG);
 
 		if ((selection == SUMMARY_NONE && item->hide_read_threads)
 		    || selection != SUMMARY_NONE)
-			state |= M_HIDE_READ_THREADS;
+			UPDATE_STATE(M_HIDE_READ_THREADS);
 	}		
 	if (mainwin->summaryview->threaded)
-		state |= M_THREADED;
+		UPDATE_STATE(M_THREADED);
 	else
-		state |= M_UNTHREADED;	
+		UPDATE_STATE(M_UNTHREADED);
 	if (selection == SUMMARY_SELECTED_SINGLE ||
 	    selection == SUMMARY_SELECTED_MULTIPLE)
-		state |= M_TARGET_EXIST;
+		UPDATE_STATE(M_TARGET_EXIST);
 	if (selection == SUMMARY_SELECTED_SINGLE)
-		state |= M_SINGLE_TARGET_EXIST;
+		UPDATE_STATE(M_SINGLE_TARGET_EXIST);
 	if (mainwin->summaryview->folder_item &&
 	    mainwin->summaryview->folder_item->folder->klass->type == F_NEWS)
-		state |= M_NEWS;
+		UPDATE_STATE(M_NEWS);
 	else
-		state |= M_NOT_NEWS;
+		UPDATE_STATE(M_NOT_NEWS);
 	if (mainwin->summaryview->folder_item &&
 	    (mainwin->summaryview->folder_item->stype != F_TRASH ||
 	     !folder_has_parent_of_type(mainwin->summaryview->folder_item, F_TRASH)))
-		state |= M_NOT_TRASH;
+		UPDATE_STATE(M_NOT_TRASH);
 
 	if (prefs_common.actions_list && g_slist_length(prefs_common.actions_list))
-		state |= M_ACTIONS_EXIST;
+		UPDATE_STATE(M_ACTIONS_EXIST);
 
 	tmp = tags_get_list();
 	if (tmp && g_slist_length(tmp))
-		state |= M_TAGS_EXIST;
+		UPDATE_STATE(M_TAGS_EXIST);
 	g_slist_free(tmp);
 
 	if (procmsg_have_queued_mails_fast() && !procmsg_is_sending())
-		state |= M_HAVE_QUEUED_MAILS;
+		UPDATE_STATE(M_HAVE_QUEUED_MAILS);
 
 	if (selection == SUMMARY_SELECTED_SINGLE &&
 	    (item &&
 	     (folder_has_parent_of_type(item, F_DRAFT) ||
 	      folder_has_parent_of_type(item, F_OUTBOX) ||
 	      folder_has_parent_of_type(item, F_QUEUE))))
-		state |= M_ALLOW_REEDIT;
+		UPDATE_STATE(M_ALLOW_REEDIT);
 	if (cur_account)
-		state |= M_HAVE_ACCOUNT;
+		UPDATE_STATE(M_HAVE_ACCOUNT);
 	
 	if (cur_account && cur_account->protocol != A_NONE)
-		state |= M_HAVE_RETRIEVABLE_ACCOUNT;
+		UPDATE_STATE(M_HAVE_RETRIEVABLE_ACCOUNT);
 
 	if (any_folder_want_synchronise())
-		state |= M_WANT_SYNC;
+		UPDATE_STATE(M_WANT_SYNC);
 
 	if (item && item->prefs->processing && selection != SUMMARY_NONE)
-		state |= M_HAVE_PROCESSING;
+		UPDATE_STATE(M_HAVE_PROCESSING);
 
 	if (g_list_length(account_list) > 1)
-		state |= M_HAVE_MULTI_ACCOUNT;
+		UPDATE_STATE(M_HAVE_MULTI_ACCOUNT);
 
 	for ( ; account_list != NULL; account_list = account_list->next) {
 		if (((PrefsAccount*)account_list->data)->protocol != A_NONE) {
-			state |= M_HAVE_ANY_RETRIEVABLE_ACCOUNT;
+			UPDATE_STATE(M_HAVE_ANY_RETRIEVABLE_ACCOUNT);
 			break;
 		}
 	}
 
 	for ( ; account_list != NULL; account_list = account_list->next) {
 		if (((PrefsAccount*)account_list->data)->protocol == A_NNTP) {
-			state |= M_HAVE_NEWS_ACCOUNT;
+			UPDATE_STATE(M_HAVE_NEWS_ACCOUNT);
 			break;
 		}
 	}
@@ -3212,44 +3218,67 @@
 	    (mainwin->summaryview->folder_item &&
 	     mainwin->summaryview->folder_item->folder->klass->type != F_UNKNOWN &&
 	     mainwin->summaryview->folder_item->folder->klass->type != F_NEWS)) {
-		state |= M_CAN_LEARN_SPAM;
+		UPDATE_STATE(M_CAN_LEARN_SPAM);
 	}
 
 	if (mainwin->summaryview->folder_item) {
-		state |= M_FOLDER_SELECTED;
+		UPDATE_STATE(M_FOLDER_SELECTED);
 	}
 
 	if (inc_is_active())
-		state |= M_INC_ACTIVE;
+		UPDATE_STATE(M_INC_ACTIVE);
 	if (imap_cancel_all_enabled())
-		state |= M_INC_ACTIVE;
+		UPDATE_STATE(M_INC_ACTIVE);
 
 	if (mainwin->summaryview->deleted > 0)
-		state |= M_DELETED_EXISTS;
+		UPDATE_STATE(M_DELETED_EXISTS);
 
 	if (mainwin->summaryview->deleted > 0 ||
 	    mainwin->summaryview->moved > 0 ||
 	    mainwin->summaryview->copied > 0)
-		state |= M_DELAY_EXEC;
+		UPDATE_STATE(M_DELAY_EXEC);
 
 	if (summary_is_list(mainwin->summaryview))
-		state |= M_SUMMARY_ISLIST;
+		UPDATE_STATE(M_SUMMARY_ISLIST);
 
 	if (prefs_common.layout_mode != SMALL_LAYOUT || mainwin->in_folder)
-		state |= M_IN_MSGLIST;
+		UPDATE_STATE(M_IN_MSGLIST);
 
 	for (account_list = account_get_list(); account_list != NULL; account_list = account_list->next) {
 		PrefsAccount *account = account_list->data;
 		if (account->session_passwd || account->session_smtp_passwd) {
-			state |= M_SESSION_PASSWORDS;
+			UPDATE_STATE(M_SESSION_PASSWORDS);
 			break;
 		}
 	}
+#undef UPDATE_STATE
 
 	return state;
 }
 
+SensitiveCondMask main_window_get_mask(SensitiveCond cond, ...)
+{
+	va_list args;
+	gint i;
+	SensitiveCondMask value;
+	static SensitiveCondMask SensitiveCond_table[M_MAX_RESERVED];
+	static gboolean first_time = TRUE;
+
+	if (first_time) {
+		for (i = 0; i < M_MAX_RESERVED; i++)
+			SensitiveCond_table[i] = (SensitiveCondMask) ((SensitiveCondMask)1 << i);
+		first_time = FALSE;
+	}
 
+	value = 0;
+
+	va_start(args, cond); 
+	for (i = (gint) cond; i >= 0; i = va_arg(args, gint))
+		value |= SensitiveCond_table[i];
+	va_end(args);
+
+	return value;
+}
 
 void main_window_set_menu_sensitive(MainWindow *mainwin)
 {
@@ -3262,103 +3291,108 @@
 	gint i;
 	gboolean mimepart_selected = FALSE;
 
-	static const struct {
-		gchar *const entry;
+#define N_ENTRIES 81
+	static struct {
+		const gchar *entry;
 		SensitiveCond cond;
-	} entry[] = {
-		{"Menu/File/SaveAs", M_TARGET_EXIST},
-		{"Menu/File/SavePartAs", M_SINGLE_TARGET_EXIST},
-		{"Menu/File/Print"  , M_TARGET_EXIST},
-		{"Menu/File/SynchroniseFolders", M_WANT_SYNC},
-		{"Menu/File/Exit"      , M_UNLOCKED},
+	} entry[N_ENTRIES];
 
-		{"Menu/Edit/SelectThread"		   , M_TARGET_EXIST|M_SUMMARY_ISLIST},
-		{"Menu/Edit/DeleteThread"		   , M_TARGET_EXIST|M_SUMMARY_ISLIST},
-		{"Menu/Edit/Find", M_SINGLE_TARGET_EXIST},
-		{"Menu/Edit/QuickSearch", 		     M_IN_MSGLIST},
+	i = 0;
+#define FILL_TABLE(entry_str, ...) \
+do { \
+	entry[i].entry = (const gchar *) entry_str; entry[i++].cond = main_window_get_mask(__VA_ARGS__, -1); \
+} while (0)
 
-		{"Menu/View/SetColumns/Folderlist"	, M_UNLOCKED|M_SUMMARY_ISLIST}, 
-		{"Menu/View/Sort"                      , M_EXEC|M_SUMMARY_ISLIST},
-		{"Menu/View/ThreadView"               , M_EXEC|M_SUMMARY_ISLIST},
-		{"Menu/View/ExpandThreads"        , M_MSG_EXIST|M_SUMMARY_ISLIST},
-		{"Menu/View/CollapseThreads"      , M_MSG_EXIST|M_SUMMARY_ISLIST},
-		{"Menu/View/HideReadThreads"	   , M_HIDE_READ_THREADS|M_SUMMARY_ISLIST},
-		{"Menu/View/HideReadMessages"	   , M_HIDE_READ_MSG|M_SUMMARY_ISLIST},
-		{"Menu/View/HideDelMessages"	   , M_SUMMARY_ISLIST},
-		{"Menu/View/Goto/Prev"        , M_MSG_EXIST},
-		{"Menu/View/Goto/Next"        , M_MSG_EXIST},
-		{"Menu/View/Goto/PrevUnread" , M_MSG_EXIST},
-		{"Menu/View/Goto/PrevNew"    , M_MSG_EXIST},
-		{"Menu/View/Goto/PrevMarked" , M_MSG_EXIST},
-		{"Menu/View/Goto/PrevLabeled", M_MSG_EXIST},
-		{"Menu/View/Goto/NextLabeled", M_MSG_EXIST},
-		{"Menu/View/Goto/ParentMessage"      , M_SINGLE_TARGET_EXIST},
-		{"Menu/View/Goto/NextPart"      , M_SINGLE_TARGET_EXIST},
-		{"Menu/View/Goto/PrevPart"      , M_SINGLE_TARGET_EXIST},
-		{"Menu/View/OpenNewWindow"        , M_SINGLE_TARGET_EXIST},
-		{"Menu/View/MessageSource"            , M_SINGLE_TARGET_EXIST},
-		{"Menu/View/Part"            , M_SINGLE_TARGET_EXIST},
-		{"Menu/View/AllHeaders"          	   , M_SINGLE_TARGET_EXIST},
-		{"Menu/View/Quotes"                    , M_SINGLE_TARGET_EXIST},
+	FILL_TABLE("Menu/File/SaveAs", M_TARGET_EXIST);
+	FILL_TABLE("Menu/File/SavePartAs", M_SINGLE_TARGET_EXIST);
+	FILL_TABLE("Menu/File/Print", M_TARGET_EXIST);
+	FILL_TABLE("Menu/File/SynchroniseFolders", M_WANT_SYNC);
+	FILL_TABLE("Menu/File/Exit", M_UNLOCKED);
 
-		{"Menu/Message/Receive/CurrentAccount"
-						 , M_HAVE_ACCOUNT|M_UNLOCKED|M_HAVE_RETRIEVABLE_ACCOUNT},
-		{"Menu/Message/Receive/AllAccounts"
-						 , M_HAVE_ACCOUNT|M_UNLOCKED|M_HAVE_ANY_RETRIEVABLE_ACCOUNT},
-		{"Menu/Message/Receive/CancelReceiving"
-						 , M_INC_ACTIVE},
-		{"Menu/Message/SendQueue"  , M_HAVE_ACCOUNT|M_HAVE_QUEUED_MAILS},
-		{"Menu/Message/ComposeEmail", M_HAVE_ACCOUNT},
-		{"Menu/Message/ComposeNews", M_HAVE_NEWS_ACCOUNT},
-		{"Menu/Message/Reply"                 , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
-		{"Menu/Message/ReplyTo"              , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
-		{"Menu/Message/FollowupReply", M_HAVE_ACCOUNT|M_TARGET_EXIST|M_NEWS|M_SUMMARY_ISLIST},
-		{"Menu/Message/Forward"               , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
-		{"Menu/Message/ForwardAtt" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
-        	{"Menu/Message/Redirect"		  , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
-		{"Menu/Message/Move"		  , M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS},
-		{"Menu/Message/Copy"		  , M_TARGET_EXIST|M_EXEC},
-		{"Menu/Message/Trash"	  , M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS|M_NOT_TRASH},
-		{"Menu/Message/Delete" 		  , M_TARGET_EXIST|M_ALLOW_DELETE},
-		{"Menu/Message/CancelNews" , M_TARGET_EXIST|M_ALLOW_DELETE|M_NEWS},
-		{"Menu/Message/Mark"   		  , M_TARGET_EXIST|M_SUMMARY_ISLIST},
-		{"Menu/Message/Mark/MarkSpam"	  , M_TARGET_EXIST|M_CAN_LEARN_SPAM},
-		{"Menu/Message/Mark/MarkHam" 	  , M_TARGET_EXIST|M_CAN_LEARN_SPAM},
-		{"Menu/Message/Mark/IgnoreThread"    , M_TARGET_EXIST},
-		{"Menu/Message/Mark/UnignoreThread"  , M_TARGET_EXIST},
-		{"Menu/Message/Mark/Lock"   	  , M_TARGET_EXIST},
-		{"Menu/Message/Mark/Unlock"   	  , M_TARGET_EXIST},
-		{"Menu/Message/ColorLabel"		  , M_TARGET_EXIST},
-		{"Menu/Message/Tags"		  , M_TARGET_EXIST},
-		{"Menu/Message/Reedit"               , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
-		{"Menu/Message/CheckSignature"               , M_SINGLE_TARGET_EXIST},
+	FILL_TABLE("Menu/Edit/SelectThread", M_TARGET_EXIST, M_SUMMARY_ISLIST);
+	FILL_TABLE("Menu/Edit/DeleteThread", M_TARGET_EXIST, M_SUMMARY_ISLIST);
+	FILL_TABLE("Menu/Edit/Find", M_SINGLE_TARGET_EXIST);
+	FILL_TABLE("Menu/Edit/QuickSearch", M_IN_MSGLIST);
 
-		{"Menu/Tools/AddSenderToAB"   , M_SINGLE_TARGET_EXIST},
-		{"Menu/Tools/CollectAddresses"            , M_FOLDER_SELECTED},
-		{"Menu/Tools/CollectAddresses/FromFolder"
-						       , M_FOLDER_SELECTED},
-		{"Menu/Tools/CollectAddresses/FromSelected"
-						       , M_TARGET_EXIST},
-		{"Menu/Tools/FilterFolder", M_MSG_EXIST|M_EXEC},
-		{"Menu/Tools/FilterSelected"     , M_TARGET_EXIST|M_EXEC},
-		{"Menu/Tools/RunProcessing"  , M_HAVE_PROCESSING},
-		{"Menu/Tools/CreateFilterRule"           , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
-		{"Menu/Tools/CreateProcessingRule"       , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
-		{"Menu/Tools/ListUrls"                 , M_TARGET_EXIST},
-		{"Menu/Tools/Actions"                      , M_TARGET_EXIST|M_ACTIONS_EXIST},
-		{"Menu/Tools/Execute"                      , M_DELAY_EXEC},
-		{"Menu/Tools/Expunge"                      , M_DELETED_EXISTS},
-		{"Menu/Tools/ForgetSessionPasswords"	   , M_SESSION_PASSWORDS},
-		{"Menu/Tools/DeleteDuplicates/SelFolder"   , M_MSG_EXIST|M_ALLOW_DELETE},
+	FILL_TABLE("Menu/View/SetColumns/Folderlist", M_UNLOCKED, M_SUMMARY_ISLIST);
+	FILL_TABLE("Menu/View/Sort", M_EXEC, M_SUMMARY_ISLIST);
+	FILL_TABLE("Menu/View/ThreadView", M_EXEC, M_SUMMARY_ISLIST);
+	FILL_TABLE("Menu/View/ExpandThreads", M_MSG_EXIST, M_SUMMARY_ISLIST);
+	FILL_TABLE("Menu/View/CollapseThreads", M_MSG_EXIST, M_SUMMARY_ISLIST);
+	FILL_TABLE("Menu/View/HideReadThreads", M_HIDE_READ_THREADS, M_SUMMARY_ISLIST);
+	FILL_TABLE("Menu/View/HideReadMessages", M_HIDE_READ_MSG, M_SUMMARY_ISLIST);
+	FILL_TABLE("Menu/View/HideDelMessages", M_SUMMARY_ISLIST);
+	FILL_TABLE("Menu/View/Goto/Prev", M_MSG_EXIST);
+	FILL_TABLE("Menu/View/Goto/Next", M_MSG_EXIST);
+	FILL_TABLE("Menu/View/Goto/PrevUnread", M_MSG_EXIST);
+	FILL_TABLE("Menu/View/Goto/PrevNew", M_MSG_EXIST);
+	FILL_TABLE("Menu/View/Goto/PrevMarked", M_MSG_EXIST);
+	FILL_TABLE("Menu/View/Goto/PrevLabeled", M_MSG_EXIST);
+	FILL_TABLE("Menu/View/Goto/NextLabeled", M_MSG_EXIST);
+	FILL_TABLE("Menu/View/Goto/ParentMessage", M_SINGLE_TARGET_EXIST);
+	FILL_TABLE("Menu/View/Goto/NextPart", M_SINGLE_TARGET_EXIST);
+	FILL_TABLE("Menu/View/Goto/PrevPart", M_SINGLE_TARGET_EXIST);
+	FILL_TABLE("Menu/View/OpenNewWindow", M_SINGLE_TARGET_EXIST);
+	FILL_TABLE("Menu/View/MessageSource", M_SINGLE_TARGET_EXIST);
+	FILL_TABLE("Menu/View/Part", M_SINGLE_TARGET_EXIST);
+	FILL_TABLE("Menu/View/AllHeaders", M_SINGLE_TARGET_EXIST);
+	FILL_TABLE("Menu/View/Quotes", M_SINGLE_TARGET_EXIST);
 
-		{"Menu/Configuration", M_UNLOCKED},
-		{"Menu/Configuration/ChangeAccount", M_HAVE_MULTI_ACCOUNT},
-		{"Menu/Configuration/AccountPrefs", M_UNLOCKED},
-		{"Menu/Configuration/CreateAccount", M_UNLOCKED},
-		{"Menu/Configuration/EditAccounts", M_UNLOCKED},
+	FILL_TABLE("Menu/Message/Receive/CurrentAccount", M_HAVE_ACCOUNT, M_UNLOCKED, M_HAVE_RETRIEVABLE_ACCOUNT);
+	FILL_TABLE("Menu/Message/Receive/AllAccounts", M_HAVE_ACCOUNT, M_UNLOCKED, M_HAVE_ANY_RETRIEVABLE_ACCOUNT);
+	FILL_TABLE("Menu/Message/Receive/CancelReceiving", M_INC_ACTIVE);
+	FILL_TABLE("Menu/Message/SendQueue", M_HAVE_ACCOUNT, M_HAVE_QUEUED_MAILS);
+	FILL_TABLE("Menu/Message/ComposeEmail", M_HAVE_ACCOUNT);
+	FILL_TABLE("Menu/Message/ComposeNews", M_HAVE_NEWS_ACCOUNT);
+	FILL_TABLE("Menu/Message/Reply", M_HAVE_ACCOUNT, M_TARGET_EXIST, M_SUMMARY_ISLIST);
+	FILL_TABLE("Menu/Message/ReplyTo", M_HAVE_ACCOUNT, M_TARGET_EXIST, M_SUMMARY_ISLIST);
+	FILL_TABLE("Menu/Message/FollowupReply", M_HAVE_ACCOUNT, M_TARGET_EXIST, M_NEWS, M_SUMMARY_ISLIST);
+	FILL_TABLE("Menu/Message/Forward", M_HAVE_ACCOUNT, M_TARGET_EXIST, M_SUMMARY_ISLIST);
+	FILL_TABLE("Menu/Message/ForwardAtt", M_HAVE_ACCOUNT, M_TARGET_EXIST, M_SUMMARY_ISLIST);
+    FILL_TABLE("Menu/Message/Redirect", M_HAVE_ACCOUNT, M_TARGET_EXIST, M_SUMMARY_ISLIST);
+	FILL_TABLE("Menu/Message/Move", M_TARGET_EXIST, M_ALLOW_DELETE, M_NOT_NEWS);
+	FILL_TABLE("Menu/Message/Copy", M_TARGET_EXIST, M_EXEC);
+	FILL_TABLE("Menu/Message/Trash", M_TARGET_EXIST, M_ALLOW_DELETE, M_NOT_NEWS, M_NOT_TRASH);
+	FILL_TABLE("Menu/Message/Delete", M_TARGET_EXIST, M_ALLOW_DELETE);
+	FILL_TABLE("Menu/Message/CancelNews", M_TARGET_EXIST, M_ALLOW_DELETE, M_NEWS);
+	FILL_TABLE("Menu/Message/Mark", M_TARGET_EXIST, M_SUMMARY_ISLIST);
+	FILL_TABLE("Menu/Message/Mark/MarkSpam", M_TARGET_EXIST, M_CAN_LEARN_SPAM);
+	FILL_TABLE("Menu/Message/Mark/MarkHam", M_TARGET_EXIST, M_CAN_LEARN_SPAM);
+	FILL_TABLE("Menu/Message/Mark/IgnoreThread", M_TARGET_EXIST);
+	FILL_TABLE("Menu/Message/Mark/UnignoreThread", M_TARGET_EXIST);
+	FILL_TABLE("Menu/Message/Mark/Lock", M_TARGET_EXIST);
+	FILL_TABLE("Menu/Message/Mark/Unlock", M_TARGET_EXIST);
+	FILL_TABLE("Menu/Message/ColorLabel", M_TARGET_EXIST);
+	FILL_TABLE("Menu/Message/Tags", M_TARGET_EXIST);
+	FILL_TABLE("Menu/Message/Reedit", M_HAVE_ACCOUNT, M_ALLOW_REEDIT);
+	FILL_TABLE("Menu/Message/CheckSignature", M_SINGLE_TARGET_EXIST);
 
-		{NULL, 0}
-	};
+	FILL_TABLE("Menu/Tools/AddSenderToAB", M_SINGLE_TARGET_EXIST);
+	FILL_TABLE("Menu/Tools/CollectAddresses", M_FOLDER_SELECTED);
+	FILL_TABLE("Menu/Tools/CollectAddresses/FromFolder", M_FOLDER_SELECTED);
+	FILL_TABLE("Menu/Tools/CollectAddresses/FromSelected", M_TARGET_EXIST);
+	FILL_TABLE("Menu/Tools/FilterFolder", M_MSG_EXIST, M_EXEC);
+	FILL_TABLE("Menu/Tools/FilterSelected", M_TARGET_EXIST, M_EXEC);
+	FILL_TABLE("Menu/Tools/RunProcessing", M_HAVE_PROCESSING);
+	FILL_TABLE("Menu/Tools/CreateFilterRule", M_SINGLE_TARGET_EXIST, M_UNLOCKED);
+	FILL_TABLE("Menu/Tools/CreateProcessingRule", M_SINGLE_TARGET_EXIST, M_UNLOCKED);
+	FILL_TABLE("Menu/Tools/ListUrls", M_TARGET_EXIST);
+	FILL_TABLE("Menu/Tools/Actions", M_TARGET_EXIST, M_ACTIONS_EXIST);
+	FILL_TABLE("Menu/Tools/Execute", M_DELAY_EXEC);
+	FILL_TABLE("Menu/Tools/Expunge", M_DELETED_EXISTS);
+	FILL_TABLE("Menu/Tools/ForgetSessionPasswords", M_SESSION_PASSWORDS);
+	FILL_TABLE("Menu/Tools/DeleteDuplicates/SelFolder", M_MSG_EXIST, M_ALLOW_DELETE);
+
+	FILL_TABLE("Menu/Configuration", M_UNLOCKED);
+	FILL_TABLE("Menu/Configuration/ChangeAccount", M_HAVE_MULTI_ACCOUNT);
+	FILL_TABLE("Menu/Configuration/AccountPrefs", M_UNLOCKED);
+	FILL_TABLE("Menu/Configuration/CreateAccount", M_UNLOCKED);
+	FILL_TABLE("Menu/Configuration/EditAccounts", M_UNLOCKED);
+	FILL_TABLE(NULL, 0);
+#undef FILL_TABLE
+	if (i > N_ENTRIES)
+		g_error("main window menu entry table overrun (%d/%d)", i, N_ENTRIES);
+#undef ENTRIES
 
 	state = main_window_get_current_state(mainwin);
 

Index: mainwindow.h
===================================================================
RCS file: /home/claws-mail/claws/src/mainwindow.h,v
retrieving revision 1.39.2.65
retrieving revision 1.39.2.66
diff -u -d -r1.39.2.65 -r1.39.2.66
--- mainwindow.h	8 Sep 2012 20:23:10 -0000	1.39.2.65
+++ mainwindow.h	28 Nov 2012 15:33:13 -0000	1.39.2.66
@@ -36,45 +36,50 @@
 #define THEME_CHANGED_HOOKLIST "theme_changed"
 typedef enum
 {
-	M_UNLOCKED            = 1 << 0,
-	M_MSG_EXIST           = 1 << 1,
-	M_TARGET_EXIST        = 1 << 2,
-	M_SINGLE_TARGET_EXIST = 1 << 3,
-	M_EXEC                = 1 << 4,
-	M_ALLOW_REEDIT        = 1 << 5,
-	M_HAVE_ACCOUNT        = 1 << 6,
-	M_THREADED	      = 1 << 7,
-	M_UNTHREADED	      = 1 << 8,
-	M_ALLOW_DELETE	      = 1 << 9,
-	M_INC_ACTIVE	      = 1 << 10,
-	M_NEWS                = 1 << 11,
-	M_HAVE_NEWS_ACCOUNT   = 1 << 12,
-	M_HIDE_READ_MSG	      = 1 << 13,
-	M_DELAY_EXEC	      = 1 << 14,
-	M_NOT_NEWS	      = 1 << 15,
-	M_CAN_LEARN_SPAM      = 1 << 16,
-	M_ACTIONS_EXIST       = 1 << 17,
-	M_HAVE_QUEUED_MAILS   = 1 << 18,
-	M_WANT_SYNC	      = 1 << 19,
-	M_TAGS_EXIST	      = 1 << 20,
-	M_HAVE_PROCESSING     = 1 << 21,
-	M_SUMMARY_ISLIST      = 1 << 22,
-	M_IN_MSGLIST	      = 1 << 23,
-	M_HAVE_MULTI_ACCOUNT  = 1 << 24,
-	M_FOLDER_SELECTED     = 1 << 25,
-	M_SESSION_PASSWORDS   = 1 << 26,
-	M_DELETED_EXISTS      = 1 << 27,
-	M_NOT_TRASH	      = 1 << 28,
-	M_HIDE_READ_THREADS   = 1 << 29,
-	M_HAVE_RETRIEVABLE_ACCOUNT = 1 << 30,
-	M_HAVE_ANY_RETRIEVABLE_ACCOUNT = 1 << 31
+	M_UNLOCKED,
+	M_MSG_EXIST,
+	M_TARGET_EXIST,
+	M_SINGLE_TARGET_EXIST,
+	M_EXEC,
+	M_ALLOW_REEDIT,
+	M_HAVE_ACCOUNT,
+	M_THREADED,
+	M_UNTHREADED,
+	M_ALLOW_DELETE,
+	M_INC_ACTIVE,
+	M_NEWS,
+	M_HAVE_NEWS_ACCOUNT,
+	M_HIDE_READ_MSG,
+	M_DELAY_EXEC,
+	M_NOT_NEWS,
+	M_CAN_LEARN_SPAM,
+	M_ACTIONS_EXIST,
+	M_HAVE_QUEUED_MAILS,
+	M_WANT_SYNC,
+	M_TAGS_EXIST,
+	M_HAVE_PROCESSING,
+	M_SUMMARY_ISLIST,
+	M_IN_MSGLIST,
+	M_HAVE_MULTI_ACCOUNT,
+	M_FOLDER_SELECTED,
+	M_SESSION_PASSWORDS,
+	M_DELETED_EXISTS,
+	M_NOT_TRASH,
+	M_HIDE_READ_THREADS,
+	M_HAVE_RETRIEVABLE_ACCOUNT,
+	M_HAVE_ANY_RETRIEVABLE_ACCOUNT,
+
+/* reserved */
+    M_MAX_RESERVED
 } SensitiveCond;
 
+typedef guint64 SensitiveCondMask;
+
 typedef enum
 {
-	NORMAL_LAYOUT	 = 0,
-	VERTICAL_LAYOUT	 = 1 << 0,
-	WIDE_LAYOUT = 1 << 1,
+	NORMAL_LAYOUT       = 0,
+	VERTICAL_LAYOUT     = 1 << 0,
+	WIDE_LAYOUT         = 1 << 1,
 	WIDE_MSGLIST_LAYOUT = 1 << 2,
 	SMALL_LAYOUT
 } LayoutType;
@@ -183,6 +188,8 @@
 					 gboolean	 confirm,
 					 gboolean 	 for_quit);
 
+guint64 main_window_get_mask(SensitiveCond cond, ...);
+
 void main_window_set_menu_sensitive	(MainWindow	*mainwin);
 
 



More information about the Commits mailing list