commit a1fddbf2dd4be1962f0378d3546240e1f491d2bf
parent 442757e8684b6684932fab4b7804850612575c71
Author: Andrej Kacian <ticho@claws-mail.org>
Date: Mon, 26 Feb 2018 22:06:27 +0100
Fix summary_select_all when there is nothing selected.
Due to how GtkCMCList works, we first need to focus and
select a row.
Fixes bug #3973, ''select all' in summaryview does not
automatically focus the summaryview'
Diffstat:
1 file changed, 15 insertions(+), 0 deletions(-)
diff --git a/src/summaryview.c b/src/summaryview.c
@@ -4819,11 +4819,26 @@ void summary_add_address(SummaryView *summaryview)
void summary_select_all(SummaryView *summaryview)
{
+ GtkCMCTreeNode *node;
+
if (!summaryview->folder_item) return;
+ if (GTK_CMCLIST(summaryview->ctree)->focus_row < 0) {
+ /* If no row is selected, select (but do not open) the first
+ * row, to get summaryview into correct state for selecting all. */
+ debug_print("summary_select_all: no row selected, selecting first one\n");
+ if (GTK_CMCLIST(summaryview->ctree)->row_list != NULL) {
+ node = gtk_cmctree_node_nth(GTK_CMCTREE(summaryview->ctree), 0);
+ summary_select_node(summaryview, node, FALSE);
+ }
+ }
+
+ /* Now select all rows while locking the summaryview for
+ * faster performance. */
summary_lock(summaryview);
gtk_cmclist_select_all(GTK_CMCLIST(summaryview->ctree));
summary_unlock(summaryview);
+
summary_status_show(summaryview);
}