[Commits] [SCM] claws branch, master, updated. 3.14.1-235-g8baab85

ticho at claws-mail.org ticho at claws-mail.org
Sat Mar 18 22:00:24 CET 2017


The branch, master has been updated
       via  8baab85304bedfa49864054301a8ea35f02de60d (commit)
      from  81b66ecc887e55d7947f4cb2f21bf7ecd5d5dff4 (commit)

Summary of changes:
 src/folderview.c                      |    2 +-
 src/mainwindow.c                      |   13 ++-
 src/plugins/att_remover/att_remover.c |    4 +-
 src/plugins/vcalendar/common-views.c  |    3 +-
 src/prefs_common.c                    |   16 +++-
 src/prefs_common.h                    |   24 ++++--
 src/prefs_summaries.c                 |  150 ++++++++++++++++++++++-----------
 src/prefs_summary_open.c              |   15 ----
 src/summary_search.c                  |   11 +--
 src/summaryview.c                     |   92 ++++++++++----------
 src/summaryview.h                     |    7 +-
 11 files changed, 196 insertions(+), 141 deletions(-)


- Log -----------------------------------------------------------------
commit 8baab85304bedfa49864054301a8ea35f02de60d
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sat Mar 18 21:53:17 2017 +0100

    Add more granular options on when to open a selected message.
    
    There are now several checkboxes in Display/Summaries page.
    The checkbox in folder open selection dialog has been removed,
    since that checkbox is among the new ones.
    
    The option "always_show_message_when_selected" is now boolean,
    instead of a tri-state.
    
    This commit also removes function summary_display_by_msgnum(),
    and its functionality was moved to summary_select_by_msgnum(), which
    has a new boolean argument to control whether or not to display the
    selected message.

diff --git a/src/folderview.c b/src/folderview.c
index d48a8de..31a8cea 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -932,7 +932,7 @@ static void folderview_select_node(FolderView *folderview, GtkCMCTreeNode *node)
 	    folderview->summaryview->folder_item->total_msgs > 0) ||
 	     prefs_common.layout_mode == SMALL_LAYOUT)
 		summary_select_node(folderview->summaryview,
-				    folderview->summaryview->selected, -1);
+				    folderview->summaryview->selected, OPEN_SELECTED_ON_FOLDER_OPEN);
 	else
 		gtk_widget_grab_focus(folderview->ctree);
 }
diff --git a/src/mainwindow.c b/src/mainwindow.c
index e015642..3d58e7c 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -4899,8 +4899,8 @@ static void prev_history_cb(GtkAction *action, gpointer data)
 	if (info) {
 		if (info->folder != mainwin->summaryview->folder_item)
 			folderview_select(mainwin->folderview, info->folder);
-		summary_display_by_msgnum(mainwin->summaryview, info->msgnum);
-		summary_display_msg_selected(mainwin->summaryview, FALSE);
+		summary_select_by_msgnum(mainwin->summaryview, info->msgnum,
+				OPEN_SELECTED_ON_PREVNEXT);
 		procmsg_msginfo_free(&info);
 		main_window_set_menu_sensitive(mainwindow_get_mainwindow());
 		toolbar_main_set_sensitive(mainwindow_get_mainwindow());
@@ -4914,7 +4914,8 @@ static void next_history_cb(GtkAction *action, gpointer data)
 	if (info) {
 		if (info->folder != mainwin->summaryview->folder_item)
 			folderview_select(mainwin->folderview, info->folder);
-		summary_display_by_msgnum(mainwin->summaryview, info->msgnum);
+		summary_select_by_msgnum(mainwin->summaryview, info->msgnum,
+				OPEN_SELECTED_ON_PREVNEXT);
 		procmsg_msginfo_free(&info);
 		main_window_set_menu_sensitive(mainwindow_get_mainwindow());
 		toolbar_main_set_sensitive(mainwindow_get_mainwindow());
@@ -5454,8 +5455,7 @@ void mainwindow_jump_to(const gchar *target, gboolean popup)
 		}
 		if (item && msg && atoi(msg)) {
 			g_print("selecting message %d\n", atoi(msg));
-			summary_select_by_msgnum(mainwin->summaryview, atoi(msg));
-			summary_display_msg_selected(mainwin->summaryview, FALSE);
+			summary_select_by_msgnum(mainwin->summaryview, atoi(msg), TRUE);
 			if (popup)
 				main_window_popup(mainwin);
 			g_free(tmp);
@@ -5467,8 +5467,7 @@ void mainwindow_jump_to(const gchar *target, gboolean popup)
 			msginfo = folder_item_get_msginfo_by_msgid(item, msg);
 			if (msginfo) {
 				g_print("selecting message %s\n", msg);
-				summary_select_by_msgnum(mainwin->summaryview, msginfo->msgnum);
-				summary_display_msg_selected(mainwin->summaryview, FALSE);
+				summary_select_by_msgnum(mainwin->summaryview, msginfo->msgnum, TRUE);
 				if (popup)
 					main_window_popup(mainwin);
 				g_free(tmp);
diff --git a/src/plugins/att_remover/att_remover.c b/src/plugins/att_remover/att_remover.c
index a76f2a8..1092c15 100644
--- a/src/plugins/att_remover/att_remover.c
+++ b/src/plugins/att_remover/att_remover.c
@@ -246,7 +246,7 @@ static void remove_attachments_cb(GtkWidget *widget, AttRemover *attremover)
 	main_window_cursor_normal(mainwin);
 
 	if (msgnum > 0)
-		summary_select_by_msgnum(summaryview, msgnum);
+		summary_select_by_msgnum(summaryview, msgnum, TRUE);
 
 	gtk_widget_destroy(attremover->window);
 }
@@ -456,7 +456,7 @@ static void remove_attachments(GSList *msglist)
 	main_window_cursor_normal(summaryview->mainwin);
 
 	if (msgnum > 0) {
-		summary_select_by_msgnum(summaryview, msgnum);
+		summary_select_by_msgnum(summaryview, msgnum, TRUE);
 	}
 }
 
diff --git a/src/plugins/vcalendar/common-views.c b/src/plugins/vcalendar/common-views.c
index ad1e80d..32717a4 100644
--- a/src/plugins/vcalendar/common-views.c
+++ b/src/plugins/vcalendar/common-views.c
@@ -207,8 +207,7 @@ void vcal_view_select_event (const gchar *uid, FolderItem *item, gboolean edit,
 			   summaryview = mainwindow_get_mainwindow()->summaryview;
 			   g_signal_handlers_block_by_func(G_OBJECT(summaryview->ctree),
 					       G_CALLBACK(block_cb), block_data);
-			   summary_select_by_msgnum(summaryview, info->msgnum);
-			   summary_display_msg_selected(summaryview, FALSE);
+			   summary_select_by_msgnum(summaryview, info->msgnum, TRUE);
 			   procmsg_msginfo_free(&info);
 			   g_signal_handlers_unblock_by_func(G_OBJECT(summaryview->ctree),
 					       G_CALLBACK(block_cb), block_data);
diff --git a/src/prefs_common.c b/src/prefs_common.c
index da80d2c..d8d7196 100644
--- a/src/prefs_common.c
+++ b/src/prefs_common.c
@@ -806,9 +806,21 @@ static PrefParam param[] = {
 	{"open_selected_message_on_folder_open", "FALSE",
 	 &prefs_common.open_selected_on_folder_open,
 	 P_BOOL, NULL, NULL, NULL},
-	{"always_show_message_when_selected", "0",
+	{"open_selected_message_on_search_results", "FALSE",
+	 &prefs_common.open_selected_on_search_results,
+	 P_BOOL, NULL, NULL, NULL},
+	{"open_selected_message_on_prevnext", "FALSE",
+	 &prefs_common.open_selected_on_prevnext,
+	 P_BOOL, NULL, NULL, NULL},
+	{"open_selected_message_on_deletemove", "FALSE",
+	 &prefs_common.open_selected_on_deletemove,
+	 P_BOOL, NULL, NULL, NULL},
+	{"open_selected_message_on_directional", "FALSE",
+	 &prefs_common.open_selected_on_directional,
+	 P_BOOL, NULL, NULL, NULL},
+	{"always_show_message_when_selected", "FALSE",
 	 &prefs_common.always_show_msg,
-	 P_ENUM, NULL, NULL, NULL},
+	 P_BOOL, NULL, NULL, NULL},
 	{"select_on_entry", "3", &prefs_common.select_on_entry,
 	 P_ENUM, NULL, NULL, NULL},
 	{"show_tooltips", "TRUE", &prefs_common.show_tooltips,
diff --git a/src/prefs_common.h b/src/prefs_common.h
index f4b6e1d..2085aad 100644
--- a/src/prefs_common.h
+++ b/src/prefs_common.h
@@ -92,13 +92,6 @@ typedef enum
 
 typedef enum
 {
-	OPENMSG_NO = 0,
-	OPENMSG_YES = 1,
-	OPENMSG_WHEN_VIEW_VISIBLE
-} ShowMsgPolicy;
-
-typedef enum
-{
 	SHOW_NAME,
 	SHOW_ADDR,
 	SHOW_BOTH
@@ -370,8 +363,14 @@ struct _PrefsCommon
 
 	gint statusbar_update_step;
 	gboolean emulate_emacs;
+
 	gboolean open_selected_on_folder_open;
-	ShowMsgPolicy always_show_msg;
+	gboolean open_selected_on_search_results;
+	gboolean open_selected_on_prevnext;
+	gboolean open_selected_on_deletemove;
+	gboolean open_selected_on_directional;
+	gboolean always_show_msg;
+
 	gboolean mark_as_read_on_new_window;
 	gboolean mark_as_read_delay;
 	gboolean immediate_exec;
@@ -578,4 +577,13 @@ gchar *pref_get_pref_from_entry(GtkEntry *entry);
 const gchar *prefs_common_translated_header_name(const gchar *header_name);
 const gchar *prefs_common_get_uri_cmd(void);
 const gchar *prefs_common_get_ext_editor_cmd(void);
+
+#define OPEN_SELECTED(when) (prefs_common.always_show_msg || prefs_common.when)
+
+#define OPEN_SELECTED_ON_FOLDER_OPEN OPEN_SELECTED(open_selected_on_folder_open)
+#define OPEN_SELECTED_ON_SEARCH_RESULTS OPEN_SELECTED(open_selected_on_search_results)
+#define OPEN_SELECTED_ON_PREVNEXT OPEN_SELECTED(open_selected_on_prevnext)
+#define OPEN_SELECTED_ON_DELETEMOVE OPEN_SELECTED(open_selected_on_deletemove)
+#define OPEN_SELECTED_ON_DIRECTIONAL OPEN_SELECTED(open_selected_on_directional)
+
 #endif /* __PREFS_COMMON_H__ */
diff --git a/src/prefs_summaries.c b/src/prefs_summaries.c
index 3b2b3a2..ed345c2 100644
--- a/src/prefs_summaries.c
+++ b/src/prefs_summaries.c
@@ -64,7 +64,12 @@ typedef struct _SummariesPage
 	GtkWidget *entry_datefmt;
 
 	GtkWidget *checkbtn_reopen_last_folder;
-	GtkWidget *optmenu_always_show_msg;
+	GtkWidget *checkbtn_always_show_msg;
+	GtkWidget *checkbtn_show_on_folder_open;
+	GtkWidget *checkbtn_show_on_search_results;
+	GtkWidget *checkbtn_show_on_prevnext;
+	GtkWidget *checkbtn_show_on_deletemove;
+	GtkWidget *checkbtn_show_on_directional;
 	GtkWidget *checkbtn_mark_as_read_on_newwin;
 	GtkWidget *spinbtn_mark_as_read_delay;
 	GtkWidget *checkbtn_immedexec;
@@ -99,6 +104,8 @@ static void date_format_select_row	        (GtkTreeView *list_view,
 						 GtkWidget *date_format);
 static void mark_as_read_toggled		(GtkToggleButton *button,
 						 GtkWidget *spinbtn);
+static void always_show_msg_toggled		(GtkToggleButton *button,
+						 gpointer user_data);
 
 static GtkWidget *date_format_create(GtkButton *button, void *data)
 {
@@ -313,16 +320,13 @@ static void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window,
 {
 	SummariesPage *prefs_summaries = (SummariesPage *) _page;
 	
-	GtkWidget *vbox1;
 	GtkWidget *checkbtn_transhdr;
-	GtkWidget *hbox0;
+	GtkWidget *hbox0, *hbox1, *hbox2;
+	GtkWidget *vbox1, *vbox2, *vbox3, *vbox4;
 	GtkWidget *optmenu_folder_unread;
-	GtkWidget *hbox1;
 	GtkWidget *label_ng_abbrev;
 	GtkWidget *spinbtn_ng_abbrev_len;
 	GtkAdjustment *spinbtn_ng_abbrev_len_adj;
-	GtkWidget *vbox2;
-	GtkWidget *vbox3;
 	GtkWidget *checkbtn_useaddrbook;
 	GtkWidget *checkbtn_show_tooltips;
 	GtkWidget *checkbtn_threadsubj;
@@ -331,9 +335,13 @@ static void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window,
 	GtkWidget *entry_datefmt;
 	GtkWidget *hbox_dispitem;
 	GtkWidget *button_dispitem;
-	GtkWidget *hbox2;
 	GtkWidget *checkbtn_reopen_last_folder;
-	GtkWidget *optmenu_always_show_msg;
+	GtkWidget *checkbtn_always_show_msg;
+	GtkWidget *checkbtn_show_on_folder_open;
+	GtkWidget *checkbtn_show_on_search_results;
+	GtkWidget *checkbtn_show_on_prevnext;
+	GtkWidget *checkbtn_show_on_deletemove;
+	GtkWidget *checkbtn_show_on_directional;
 	GtkWidget *spinbtn_mark_as_read_delay;
 	GtkAdjustment *spinbtn_mark_as_read_delay_adj;
 	GtkWidget *checkbtn_immedexec;
@@ -490,22 +498,20 @@ static void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window,
 	gtk_box_pack_start(GTK_BOX(hbox1), optmenu_nextunreadmsgdialog, FALSE, FALSE, 0);
 
 	/* Open message on select policy */
-	hbox1 = gtk_hbox_new (FALSE, 10);
-	gtk_widget_show (hbox1);
-	gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);	
-	label = gtk_label_new (_("Open message when selected"));
-	gtk_widget_show (label);
-	gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 0);
-
-	optmenu_always_show_msg = gtkut_sc_combobox_create(NULL, FALSE);
-	menu = GTK_LIST_STORE(gtk_combo_box_get_model(
-				GTK_COMBO_BOX(optmenu_always_show_msg)));
-	gtk_widget_show (optmenu_always_show_msg);
-	COMBOBOX_ADD (menu, _("No"), OPENMSG_NO);
-	COMBOBOX_ADD (menu, _("Yes"), OPENMSG_YES);
-	COMBOBOX_ADD (menu, _("Only when message view is visible"),
-			OPENMSG_WHEN_VIEW_VISIBLE);
-	gtk_box_pack_start(GTK_BOX(hbox1), optmenu_always_show_msg, FALSE, FALSE, 0);
+	vbox4 = gtkut_get_options_frame(vbox2, NULL, _("Open message when selected"));
+
+	PACK_CHECK_BUTTON(vbox4, checkbtn_always_show_msg,
+			_("Always"));
+	PACK_CHECK_BUTTON(vbox4, checkbtn_show_on_folder_open,
+			_("When opening a folder"));
+	PACK_CHECK_BUTTON(vbox4, checkbtn_show_on_search_results,
+			_("When displaying search results"));
+	PACK_CHECK_BUTTON(vbox4, checkbtn_show_on_prevnext,
+			_("When selecting next or previous message using shortcuts"));
+	PACK_CHECK_BUTTON(vbox4, checkbtn_show_on_deletemove,
+			_("When deleting or moving messages"));
+	PACK_CHECK_BUTTON(vbox4, checkbtn_show_on_directional,
+			_("When using directional keys"));
 
 	PACK_CHECK_BUTTON
 		(vbox2, checkbtn_threadsubj,
@@ -608,6 +614,34 @@ static void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window,
 	gtk_widget_show (hbox2);
 	gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, FALSE, 0);
 
+	prefs_summaries->checkbtn_transhdr = checkbtn_transhdr;
+	prefs_summaries->optmenu_folder_unread = optmenu_folder_unread;
+	prefs_summaries->spinbtn_ng_abbrev_len = spinbtn_ng_abbrev_len;
+	prefs_summaries->checkbtn_useaddrbook = checkbtn_useaddrbook;
+	prefs_summaries->checkbtn_show_tooltips = checkbtn_show_tooltips;
+	prefs_summaries->checkbtn_threadsubj = checkbtn_threadsubj;
+	prefs_summaries->entry_datefmt = entry_datefmt;
+	prefs_summaries->checkbtn_reopen_last_folder = checkbtn_reopen_last_folder;
+
+	prefs_summaries->checkbtn_always_show_msg = checkbtn_always_show_msg;
+	prefs_summaries->checkbtn_show_on_folder_open = checkbtn_show_on_folder_open;
+	prefs_summaries->checkbtn_show_on_search_results = checkbtn_show_on_search_results;
+	prefs_summaries->checkbtn_show_on_prevnext = checkbtn_show_on_prevnext;
+	prefs_summaries->checkbtn_show_on_deletemove = checkbtn_show_on_deletemove;
+	prefs_summaries->checkbtn_show_on_directional = checkbtn_show_on_directional;
+
+		prefs_summaries->checkbtn_mark_as_read_on_newwin = radio_mark_as_read_on_new_win;
+	prefs_summaries->spinbtn_mark_as_read_delay = spinbtn_mark_as_read_delay;
+	prefs_summaries->checkbtn_immedexec = checkbtn_immedexec;
+	prefs_summaries->checkbtn_ask_mark_all_read = checkbtn_ask_mark_all_read;
+	prefs_summaries->optmenu_sort_key = optmenu_sort_key;
+	prefs_summaries->optmenu_sort_type = optmenu_sort_type;
+	prefs_summaries->optmenu_nextunreadmsgdialog = optmenu_nextunreadmsgdialog;
+
+	prefs_summaries->page.widget = vbox1;
+	g_signal_connect(G_OBJECT(checkbtn_always_show_msg), "toggled",
+			G_CALLBACK(always_show_msg_toggled), prefs_summaries);
+
 	g_signal_connect(G_OBJECT(radio_mark_as_read_on_select), "toggled",
 			 G_CALLBACK(mark_as_read_toggled),
 			 spinbtn_mark_as_read_delay);
@@ -628,11 +662,22 @@ static void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window,
 			prefs_common.ng_abbrev_len);
 	gtk_entry_set_text(GTK_ENTRY(entry_datefmt), 
 			prefs_common.date_format?prefs_common.date_format:"");	
-
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_reopen_last_folder),
 			prefs_common.goto_last_folder_on_startup);
-	combobox_select_by_data(GTK_COMBO_BOX(optmenu_always_show_msg),
+
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_always_show_msg),
 			prefs_common.always_show_msg);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_folder_open),
+			prefs_common.open_selected_on_folder_open);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_search_results),
+			prefs_common.open_selected_on_search_results);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_prevnext),
+			prefs_common.open_selected_on_prevnext);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_deletemove),
+			prefs_common.open_selected_on_deletemove);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_directional),
+			prefs_common.open_selected_on_directional);
+
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_mark_as_read_on_new_win),
 			prefs_common.mark_as_read_on_new_window);
 	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_mark_as_read_delay),
@@ -649,26 +694,6 @@ static void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window,
 
 	combobox_select_by_data(GTK_COMBO_BOX(optmenu_nextunreadmsgdialog),
 			prefs_common.next_unread_msg_dialog);
-
-	prefs_summaries->checkbtn_transhdr = checkbtn_transhdr;
-	prefs_summaries->optmenu_folder_unread = optmenu_folder_unread;
-	prefs_summaries->spinbtn_ng_abbrev_len = spinbtn_ng_abbrev_len;
-	prefs_summaries->checkbtn_useaddrbook = checkbtn_useaddrbook;
-	prefs_summaries->checkbtn_show_tooltips = checkbtn_show_tooltips;
-	prefs_summaries->checkbtn_threadsubj = checkbtn_threadsubj;
-	prefs_summaries->entry_datefmt = entry_datefmt;
-
-	prefs_summaries->checkbtn_reopen_last_folder = checkbtn_reopen_last_folder;
-	prefs_summaries->optmenu_always_show_msg = optmenu_always_show_msg;
-	prefs_summaries->checkbtn_mark_as_read_on_newwin = radio_mark_as_read_on_new_win;
-	prefs_summaries->spinbtn_mark_as_read_delay = spinbtn_mark_as_read_delay;
-	prefs_summaries->checkbtn_immedexec = checkbtn_immedexec;
-	prefs_summaries->checkbtn_ask_mark_all_read = checkbtn_ask_mark_all_read;
-	prefs_summaries->optmenu_sort_key = optmenu_sort_key;
-	prefs_summaries->optmenu_sort_type = optmenu_sort_type;
-	prefs_summaries->optmenu_nextunreadmsgdialog = optmenu_nextunreadmsgdialog;
-
-	prefs_summaries->page.widget = vbox1;
 }
 
 static void prefs_summaries_save(PrefsPage *_page)
@@ -697,8 +722,20 @@ static void prefs_summaries_save(PrefsPage *_page)
 
 	prefs_common.goto_last_folder_on_startup = gtk_toggle_button_get_active(
 		GTK_TOGGLE_BUTTON(page->checkbtn_reopen_last_folder));
-	prefs_common.always_show_msg = combobox_get_active_data(
-		GTK_COMBO_BOX(page->optmenu_always_show_msg));
+
+	prefs_common.always_show_msg = gtk_toggle_button_get_active(
+		GTK_TOGGLE_BUTTON(page->checkbtn_always_show_msg));
+	prefs_common.open_selected_on_folder_open = gtk_toggle_button_get_active(
+		GTK_TOGGLE_BUTTON(page->checkbtn_show_on_folder_open));
+	prefs_common.open_selected_on_search_results = gtk_toggle_button_get_active(
+		GTK_TOGGLE_BUTTON(page->checkbtn_show_on_search_results));
+	prefs_common.open_selected_on_prevnext = gtk_toggle_button_get_active(
+		GTK_TOGGLE_BUTTON(page->checkbtn_show_on_prevnext));
+	prefs_common.open_selected_on_deletemove = gtk_toggle_button_get_active(
+		GTK_TOGGLE_BUTTON(page->checkbtn_show_on_deletemove));
+	prefs_common.open_selected_on_directional = gtk_toggle_button_get_active(
+		GTK_TOGGLE_BUTTON(page->checkbtn_show_on_directional));
+
 	prefs_common.mark_as_read_on_new_window = gtk_toggle_button_get_active(
 		GTK_TOGGLE_BUTTON(page->checkbtn_mark_as_read_on_newwin));
 	prefs_common.immediate_exec = gtk_toggle_button_get_active(
@@ -865,6 +902,23 @@ static void date_format_select_row(GtkTreeView *list_view,
 	g_free(new_format);
 }
 
+static void always_show_msg_toggled(GtkToggleButton *button,
+		gpointer user_data)
+{
+	const SummariesPage *prefs_summaries = (SummariesPage *)user_data;
+	gboolean state;
+
+	cm_return_if_fail(prefs_summaries != NULL);
+
+	state = gtk_toggle_button_get_active(button);
+
+	gtk_widget_set_sensitive(prefs_summaries->checkbtn_show_on_folder_open, !state);
+	gtk_widget_set_sensitive(prefs_summaries->checkbtn_show_on_search_results, !state);
+	gtk_widget_set_sensitive(prefs_summaries->checkbtn_show_on_prevnext, !state);
+	gtk_widget_set_sensitive(prefs_summaries->checkbtn_show_on_deletemove, !state);
+	gtk_widget_set_sensitive(prefs_summaries->checkbtn_show_on_directional, !state);
+}
+
 static void mark_as_read_toggled(GtkToggleButton *button, GtkWidget *spinbtn)
 {
        gtk_widget_set_sensitive(spinbtn,
diff --git a/src/prefs_summary_open.c b/src/prefs_summary_open.c
index b1c235d..961afb2 100644
--- a/src/prefs_summary_open.c
+++ b/src/prefs_summary_open.c
@@ -56,8 +56,6 @@ static struct SummaryOpen {
 
 	GtkWidget *possible_actions_list_view;
 	GtkWidget *actions_list_view;
-
-	GtkWidget *open_on_select;
 } summaryopen;
 
 /* widget creating functions */
@@ -161,7 +159,6 @@ static void prefs_summary_open_create(void)
 	GtkWidget *list_view_scrolledwin;
 	GtkWidget *possible_actions_list_view;
 	GtkWidget *actions_list_view;
-	GtkWidget *checkbtn_open_on_select;
 	
 	window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_summary_open");
 	gtk_container_set_border_width (GTK_CONTAINER (window), 8);
@@ -299,9 +296,6 @@ static void prefs_summary_open_create(void)
 	g_signal_connect (G_OBJECT (down_btn), "clicked",
 			  G_CALLBACK (prefs_summary_open_down), NULL);
 
-	PACK_CHECK_BUTTON(vbox, checkbtn_open_on_select,
-			_("Open the selected message"));
-
 	gtk_widget_show_all(window);
 
 	summaryopen.window        = window;
@@ -310,7 +304,6 @@ static void prefs_summary_open_create(void)
 
 	summaryopen.possible_actions_list_view        = possible_actions_list_view;
 	summaryopen.actions_list_view = actions_list_view;
-	summaryopen.open_on_select = checkbtn_open_on_select;
 }
 
 /* do it SUMMARY_OPEN_ACTIONS-1 times */
@@ -386,10 +379,6 @@ fill:
 					(model_poss), action_name[i], i);	
 		}
 	}
-
-	gtk_toggle_button_set_active
-		(GTK_TOGGLE_BUTTON(summaryopen.open_on_select),
-		 prefs_common.open_selected_on_folder_open);
 }
 
 static void prefs_summary_open_set_list(void)
@@ -553,10 +542,6 @@ static void prefs_summary_open_ok(void)
 	for (i = 0; i < SUMMARY_OPEN_ACTIONS-1; i++)
 		saved_summary_select_prio[i] = prefs_common.summary_select_prio[i];
 
-	prefs_common.open_selected_on_folder_open =
-		gtk_toggle_button_get_active
-		(GTK_TOGGLE_BUTTON(summaryopen.open_on_select));
-
 	gtk_widget_hide(summaryopen.window);
 	gtk_window_set_modal(GTK_WINDOW(summaryopen.window), FALSE);
 }
diff --git a/src/summary_search.c b/src/summary_search.c
index 226aab7..ce7b727 100644
--- a/src/summary_search.c
+++ b/src/summary_search.c
@@ -874,13 +874,10 @@ static void summary_search_execute(gboolean backward, gboolean search_all)
 			if (search_all) {
 				gtk_cmctree_select(ctree, node);
 			} else {
-				if (messageview_is_visible(summaryview->messageview)) {
-					summary_unlock(summaryview);
-					summary_select_node(summaryview, node, 1);
-					summary_lock(summaryview);
-				} else {
-					summary_select_node(summaryview, node, 0);
-				}
+				summary_unlock(summaryview);
+				summary_select_node(summaryview, node,
+						OPEN_SELECTED_ON_SEARCH_RESULTS);
+				summary_lock(summaryview);
 				break;
 			}
 		}
diff --git a/src/summaryview.c b/src/summaryview.c
index 268047f..2bfb01d 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -1459,7 +1459,13 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
 			if (!summaryview->displayed)
 				messageview_clear(summaryview->messageview);
 			summary_unlock(summaryview);
-			summary_select_by_msgnum(summaryview, selected_msgnum);
+
+			if (quicksearch_is_running(summaryview->quicksearch))
+				summary_select_by_msgnum(summaryview, selected_msgnum,
+						OPEN_SELECTED_ON_SEARCH_RESULTS);
+			else
+				summary_select_by_msgnum(summaryview, selected_msgnum, FALSE);
+
 			summary_lock(summaryview);
 			if (!summaryview->selected) {
 				/* no selected message - select first unread
@@ -1472,7 +1478,13 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
 						 item->sort_type == SORT_DESCENDING
 						 ? 0 : GTK_CMCLIST(ctree)->rows - 1);
 				summary_unlock(summaryview);
-				summary_select_node(summaryview, node, 0);
+
+				if (quicksearch_is_running(summaryview->quicksearch))
+					summary_select_node(summaryview, node,
+							OPEN_SELECTED_ON_SEARCH_RESULTS);
+				else
+					summary_select_node(summaryview, node, FALSE);
+
 				summary_lock(summaryview);
 			}
 		} else {
@@ -1482,7 +1494,7 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
 					(ctree,
 					 item->sort_type == SORT_DESCENDING
 					 ? 0 : GTK_CMCLIST(ctree)->rows - 1);
-			summary_select_node(summaryview, node, -1);
+			summary_select_node(summaryview, node, OPEN_SELECTED_ON_SEARCH_RESULTS);
 		}
 	} else {
 		/* backward compat */
@@ -1553,7 +1565,7 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
 		if (node) {
 			gint open_selected = -1;
 			if (!is_refresh) {
-				if (prefs_common.open_selected_on_folder_open)
+				if (OPEN_SELECTED_ON_FOLDER_OPEN)
 					open_selected = 1;
 				else
 					open_selected = 0;
@@ -1820,7 +1832,7 @@ void summary_select_prev(SummaryView *summaryview)
 		node = gtkut_ctree_node_next(ctree, node);
 
 	if (node && node != summaryview->selected)
-		summary_select_node(summaryview, node, -1);
+		summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
 }
 
 void summary_select_next(SummaryView *summaryview)
@@ -1834,7 +1846,7 @@ void summary_select_next(SummaryView *summaryview)
 		node = gtkut_ctree_node_prev(ctree, node);
 
 	if (node && node != summaryview->selected)
-		summary_select_node(summaryview, node, -1);
+		summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
 }
 
 void summary_select_prev_unread(SummaryView *summaryview)
@@ -1880,7 +1892,7 @@ void summary_select_prev_unread(SummaryView *summaryview)
 	if (!node)
 		alertpanel_notice(_("No unread messages."));
 	else
-		summary_select_node(summaryview, node, -1);
+		summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
 }
 
 void summary_select_next_unread(SummaryView *summaryview)
@@ -1895,7 +1907,7 @@ void summary_select_next_unread(SummaryView *summaryview)
 			(summaryview, node, MSG_UNREAD, TRUE);
 	
 	if (node)
-		summary_select_node(summaryview, node, -1);
+		summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
 	else {
 		AlertValue val = 0;
 
@@ -1965,7 +1977,7 @@ void summary_select_prev_new(SummaryView *summaryview)
 	if (!node)
 		alertpanel_notice(_("No new messages."));
 	else
-		summary_select_node(summaryview, node, -1);
+		summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
 }
 
 void summary_select_next_new(SummaryView *summaryview)
@@ -1980,7 +1992,7 @@ void summary_select_next_new(SummaryView *summaryview)
 			(summaryview, node, MSG_NEW, TRUE);
 	
 	if (node)
-		summary_select_node(summaryview, node, -1);
+		summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
 	else {
 		AlertValue val = 0;
 
@@ -2032,7 +2044,7 @@ void summary_select_prev_marked(SummaryView *summaryview)
 	if (!node)
 		alertpanel_notice(_("No marked messages."));
 	else
-		summary_select_node(summaryview, node, -1);
+		summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
 }
 
 void summary_select_next_marked(SummaryView *summaryview)
@@ -2047,7 +2059,7 @@ void summary_select_next_marked(SummaryView *summaryview)
 			(summaryview, node, MSG_MARKED, TRUE);
 	
 	if (node)
-		summary_select_node(summaryview, node, -1);
+		summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
 	else {
 		AlertValue val = 0;
 
@@ -2099,7 +2111,7 @@ void summary_select_prev_labeled(SummaryView *summaryview)
 	if (!node)
 		alertpanel_notice(_("No labeled messages."));
 	else
-		summary_select_node(summaryview, node, -1);
+		summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
 }
 
 void summary_select_next_labeled(SummaryView *summaryview)
@@ -2132,7 +2144,7 @@ void summary_select_next_labeled(SummaryView *summaryview)
 	if (!node)
 		alertpanel_notice(_("No labeled messages."));
 	else
-		summary_select_node(summaryview, node, -1);
+		summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
 }
 
 void summary_select_parent(SummaryView *summaryview)
@@ -2142,23 +2154,16 @@ void summary_select_parent(SummaryView *summaryview)
 	if (summaryview->selected)
 		node = GTK_CMCTREE_ROW(summaryview->selected)->parent;
 	if (node)
-		summary_select_node(summaryview, node, -1);
+		summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
 }
 
-void summary_select_by_msgnum(SummaryView *summaryview, guint msgnum)
+void summary_select_by_msgnum(SummaryView *summaryview, guint msgnum,
+		gboolean show)
 {
 	GtkCMCTreeNode *node;
 
 	node = summary_find_msg_by_msgnum(summaryview, msgnum);
-	summary_select_node(summaryview, node, 0);
-}
-
-void summary_display_by_msgnum(SummaryView *summaryview, guint msgnum)
-{
-	GtkCMCTreeNode *node;
-
-	node = summary_find_msg_by_msgnum(summaryview, msgnum);
-	summary_select_node(summaryview, node, 1);
+	summary_select_node(summaryview, node, show);
 }
 
 void summary_select_by_msg_list(SummaryView	*summaryview, GSList *msginfos)
@@ -2210,24 +2215,21 @@ static gboolean summary_select_retry(void *data)
  * summary_select_node:
  * @summaryview: Summary view.
  * @node: Summary tree node.
- * @force_display: -1 unset, 0 don't show the msg, 1 show the msg.
+ * @display_msg: whether to also display the message
  *
  * Select @node (bringing it into view by scrolling and expanding its
- * thread, if necessary) and unselect all others.  If @force_display is
- * 1, display the corresponding message in the message view, if
- * @force_display is -1, obey prefs_common.always_show_msg.
+ * thread, if necessary) and unselect all others.
  **/
 
 void summary_select_node(SummaryView *summaryview, GtkCMCTreeNode *node,
-			 gint force_display)
+			 gboolean display_msg)
 {
 	GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
-	gboolean display_msg;
-	
-	display_msg = force_display > -1? force_display :
-		(prefs_common.always_show_msg == OPENMSG_YES) ||
-		((prefs_common.always_show_msg == OPENMSG_WHEN_VIEW_VISIBLE &&
-				messageview_is_visible(summaryview->messageview)));
+
+	/* If msgview is hidden, we never want to automatically display
+	 * a selected message, since that would unhide the msgview. */
+	if (!messageview_is_visible(summaryview->messageview))
+		display_msg = FALSE;
 
 	if (summary_is_locked(summaryview)
 	&& !GTK_SCTREE(ctree)->selecting_range
@@ -4440,7 +4442,7 @@ void summary_delete(SummaryView *summaryview)
 		if (!node || prefs_common.next_on_delete == FALSE)
 			node = summary_find_next_msg(summaryview, sel_last,TRUE);
 	}
-	summary_select_node(summaryview, node, -1);
+	summary_select_node(summaryview, node, OPEN_SELECTED_ON_DELETEMOVE);
 	
 	if (prefs_common.immediate_exec || folder_has_parent_of_type(item, F_TRASH)) {
 		summary_execute(summaryview);
@@ -4597,7 +4599,7 @@ void summary_move_selected_to(SummaryView *summaryview, FolderItem *to_folder)
 			if (!node || prefs_common.next_on_delete == FALSE)
 				node = summary_find_next_msg(summaryview, sel_last,TRUE);
 		}
-		summary_select_node(summaryview, node, -1);
+		summary_select_node(summaryview, node, OPEN_SELECTED_ON_DELETEMOVE);
 		summary_status_show(summaryview);
 	}
 	
@@ -4605,7 +4607,7 @@ void summary_move_selected_to(SummaryView *summaryview, FolderItem *to_folder)
 		GtkCMCTreeNode *node = gtk_cmctree_node_nth (GTK_CMCTREE(summaryview->ctree), 
 							 GTK_CMCLIST(summaryview->ctree)->rows - 1);
 		if (node)
-			summary_select_node(summaryview, node, -1);
+			summary_select_node(summaryview, node, OPEN_SELECTED_ON_DELETEMOVE);
 	}
 
 }
@@ -4986,7 +4988,7 @@ gboolean summary_execute(SummaryView *summaryview)
 
 	if (new_selected) {
 		summary_unlock(summaryview);
-		summary_select_node(summaryview, new_selected, -1);
+		summary_select_node(summaryview, new_selected, OPEN_SELECTED_ON_DELETEMOVE);
 		summary_lock(summaryview);
 	}
 
@@ -5086,7 +5088,7 @@ gboolean summary_expunge(SummaryView *summaryview)
 
 	if (new_selected) {
 		summary_unlock(summaryview);
-		summary_select_node(summaryview, new_selected, -1);
+		summary_select_node(summaryview, new_selected, OPEN_SELECTED_ON_DELETEMOVE);
 		summary_lock(summaryview);
 	}
 
@@ -5542,7 +5544,7 @@ void summary_collapse_threads(SummaryView *summaryview)
 	while (node && GTK_CMCTREE_ROW(node)->parent) {
 		focus_node = node = GTK_CMCTREE_ROW(node)->parent;
 	}
-	summary_select_node(summaryview, node, -1);
+	summary_select_node(summaryview, node, OPEN_SELECTED_ON_DIRECTIONAL);
 	node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list);
 	while (node) {
 		if (GTK_CMCTREE_ROW(node)->children) {
@@ -6601,7 +6603,7 @@ void summary_set_column_order(SummaryView *summaryview)
 
 	summary_show(summaryview, item);
 
-	summary_select_by_msgnum(summaryview, selected_msgnum);
+	summary_select_by_msgnum(summaryview, selected_msgnum, FALSE);
 
 	summaryview->selected = summary_find_msg_by_msgnum(summaryview, selected_msgnum);
 	summaryview->displayed = summary_find_msg_by_msgnum(summaryview, displayed_msgnum);
@@ -6823,7 +6825,7 @@ static gboolean summary_key_pressed(GtkWidget *widget, GdkEventKey *event,
 				if (gtk_cmctree_node_is_visible(GTK_CMCTREE(ctree), next) != GTK_VISIBILITY_FULL)
 					gtkut_ctree_node_move_if_on_the_edge(GTK_CMCTREE(ctree), next, -1);
 				if (!mod_pressed)
-					summary_select_node(summaryview, summaryview->selected, -1);
+					summary_select_node(summaryview, summaryview->selected, OPEN_SELECTED_ON_DIRECTIONAL);
 				summaryview->selected = next;
 			}
 		}
@@ -8163,7 +8165,7 @@ static void summary_find_answers (SummaryView *summaryview, MsgInfo *msg)
 
 	node = gtk_cmctree_node_nth(GTK_CMCTREE(summaryview->ctree), 0);
 	if (node)
-		summary_select_node(summaryview, node, 1);
+		summary_select_node(summaryview, node, OPEN_SELECTED_ON_SEARCH_RESULTS);
 }
 
 gint summaryview_export_mbox_list(SummaryView *summaryview)
diff --git a/src/summaryview.h b/src/summaryview.h
index 1174bf9..77ac05b 100644
--- a/src/summaryview.h
+++ b/src/summaryview.h
@@ -206,14 +206,13 @@ void summary_select_prev_labeled  (SummaryView		*summaryview);
 void summary_select_next_labeled  (SummaryView		*summaryview);
 void summary_select_parent        (SummaryView		*summaryview);
 void summary_select_by_msgnum	  (SummaryView		*summaryview,
-				   guint		 msgnum);
-void summary_display_by_msgnum	  (SummaryView		*summaryview,
-				   guint		 msgnum);
+				   guint		 msgnum,
+				   gboolean		 show);
 void summary_select_by_msg_list   (SummaryView		*summaryview, GSList *msginfos);
 guint summary_get_current_msgnum  (SummaryView		*summaryview);
 void summary_select_node	  (SummaryView		*summaryview,
 				   GtkCMCTreeNode	*node,
-				   gint		 	 force_display);
+				   gboolean	 	 display_msg);
 
 void summary_expand_threads	  (SummaryView		*summaryview);
 void summary_collapse_threads	  (SummaryView		*summaryview);

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list