make /View/Go to/... respect the always_show_msg option, and refactor a bit

This commit is contained in:
Paul 2016-10-25 10:13:53 +01:00
parent dd8c448efa
commit 5f01319281
3 changed files with 36 additions and 40 deletions

View file

@ -818,10 +818,10 @@ static void summary_search_execute(gboolean backward, gboolean search_all)
} else {
if (messageview_is_visible(summaryview->messageview)) {
summary_unlock(summaryview);
summary_select_node(summaryview, node, TRUE, TRUE);
summary_select_node(summaryview, node, 1, TRUE);
summary_lock(summaryview);
} else {
summary_select_node(summaryview, node, FALSE, TRUE);
summary_select_node(summaryview, node, 0, TRUE);
}
break;
}

View file

@ -1468,7 +1468,7 @@ 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, FALSE, TRUE);
summary_select_node(summaryview, node, 0, TRUE);
summary_lock(summaryview);
}
} else {
@ -1547,12 +1547,8 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
}
summary_unlock(summaryview);
if (node) {
gboolean show = (prefs_common.always_show_msg == OPENMSG_ALWAYS) ||
(prefs_common.always_show_msg == OPENMSG_WHEN_VIEW_VISIBLE &&
messageview_is_visible(summaryview->messageview));
summary_select_node(summaryview, node, show, TRUE);
}
if (node)
summary_select_node(summaryview, node, -1, TRUE);
summary_lock(summaryview);
}
@ -1843,7 +1839,7 @@ void summary_select_prev_unread(SummaryView *summaryview)
if (!node)
alertpanel_notice(_("No unread messages."));
else
summary_select_node(summaryview, node, TRUE, FALSE);
summary_select_node(summaryview, node, -1, FALSE);
}
void summary_select_next_unread(SummaryView *summaryview)
@ -1858,12 +1854,11 @@ void summary_select_next_unread(SummaryView *summaryview)
skip_cur = TRUE;
}
node = summary_find_next_flagged_msg
(summaryview, node, MSG_UNREAD, skip_cur);
if (node)
summary_select_node(summaryview, node, TRUE, FALSE);
summary_select_node(summaryview, node, -1, FALSE);
else {
node = summary_find_next_flagged_msg
(summaryview, NULL, MSG_UNREAD, FALSE);
@ -1891,7 +1886,7 @@ void summary_select_next_unread(SummaryView *summaryview)
if (val == G_ALERTALTERNATE)
folderview_select_next_with_flag(summaryview->folderview, MSG_UNREAD, TRUE);
} else {
summary_select_node(summaryview, node, TRUE, FALSE);
summary_select_node(summaryview, node, -1, FALSE);
}
}
}
@ -1938,7 +1933,7 @@ void summary_select_prev_new(SummaryView *summaryview)
if (!node)
alertpanel_notice(_("No new messages."));
else
summary_select_node(summaryview, node, TRUE, FALSE);
summary_select_node(summaryview, node, -1, FALSE);
}
void summary_select_next_new(SummaryView *summaryview)
@ -1953,12 +1948,11 @@ void summary_select_next_new(SummaryView *summaryview)
skip_cur = TRUE;
}
node = summary_find_next_flagged_msg
(summaryview, node, MSG_NEW, skip_cur);
if (node)
summary_select_node(summaryview, node, TRUE, FALSE);
summary_select_node(summaryview, node, -1, FALSE);
else {
node = summary_find_next_flagged_msg
(summaryview, NULL, MSG_NEW, FALSE);
@ -1990,7 +1984,7 @@ void summary_select_next_new(SummaryView *summaryview)
else
return;
} else
summary_select_node(summaryview, node, TRUE, FALSE);
summary_select_node(summaryview, node, -1, FALSE);
}
}
@ -2017,7 +2011,7 @@ void summary_select_prev_marked(SummaryView *summaryview)
if (!node)
alertpanel_notice(_("No marked messages."));
else
summary_select_node(summaryview, node, TRUE, FALSE);
summary_select_node(summaryview, node, -1, FALSE);
}
void summary_select_next_marked(SummaryView *summaryview)
@ -2032,12 +2026,11 @@ void summary_select_next_marked(SummaryView *summaryview)
skip_cur = TRUE;
}
node = summary_find_next_flagged_msg
(summaryview, node, MSG_MARKED, skip_cur);
if (node)
summary_select_node(summaryview, node, TRUE, FALSE);
summary_select_node(summaryview, node, -1, FALSE);
else {
node = summary_find_next_flagged_msg
(summaryview, NULL, MSG_MARKED, FALSE);
@ -2069,7 +2062,7 @@ void summary_select_next_marked(SummaryView *summaryview)
else
return;
} else
summary_select_node(summaryview, node, TRUE, FALSE);
summary_select_node(summaryview, node, -1, FALSE);
}
}
@ -2096,7 +2089,7 @@ void summary_select_prev_labeled(SummaryView *summaryview)
if (!node)
alertpanel_notice(_("No labeled messages."));
else
summary_select_node(summaryview, node, TRUE, FALSE);
summary_select_node(summaryview, node, -1, FALSE);
}
void summary_select_next_labeled(SummaryView *summaryview)
@ -2121,7 +2114,7 @@ void summary_select_next_labeled(SummaryView *summaryview)
if (!node)
alertpanel_notice(_("No labeled messages."));
else
summary_select_node(summaryview, node, TRUE, FALSE);
summary_select_node(summaryview, node, -1, FALSE);
}
void summary_select_parent(SummaryView *summaryview)
@ -2131,7 +2124,7 @@ void summary_select_parent(SummaryView *summaryview)
if (summaryview->selected)
node = GTK_CMCTREE_ROW(summaryview->selected)->parent;
if (node)
summary_select_node(summaryview, node, TRUE, FALSE);
summary_select_node(summaryview, node, -1, FALSE);
}
void summary_select_by_msgnum(SummaryView *summaryview, guint msgnum)
@ -2139,7 +2132,7 @@ void summary_select_by_msgnum(SummaryView *summaryview, guint msgnum)
GtkCMCTreeNode *node;
node = summary_find_msg_by_msgnum(summaryview, msgnum);
summary_select_node(summaryview, node, FALSE, TRUE);
summary_select_node(summaryview, node, 0, TRUE);
}
void summary_display_by_msgnum(SummaryView *summaryview, guint msgnum)
@ -2147,7 +2140,7 @@ void summary_display_by_msgnum(SummaryView *summaryview, guint msgnum)
GtkCMCTreeNode *node;
node = summary_find_msg_by_msgnum(summaryview, msgnum);
summary_select_node(summaryview, node, TRUE, FALSE);
summary_select_node(summaryview, node, 1, FALSE);
}
void summary_select_by_msg_list(SummaryView *summaryview, GSList *msginfos)
@ -2202,18 +2195,25 @@ static gboolean summary_select_retry(void *data)
* summary_select_node:
* @summaryview: Summary view.
* @node: Summary tree node.
* @display_msg: TRUE to display the selected message.
* @force_display: -1 unset, 0 don't show the msg, 1 show the msg.
* @do_refresh: TRUE to refresh the widget.
*
* Select @node (bringing it into view by scrolling and expanding its
* thread, if necessary) and unselect all others. If @display_msg is
* TRUE, display the corresponding message in the message view.
* 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.
* If @do_refresh is TRUE, the widget is refreshed.
**/
void summary_select_node(SummaryView *summaryview, GtkCMCTreeNode *node,
gboolean display_msg, gboolean do_refresh)
gint force_display, gboolean do_refresh)
{
GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
gboolean display_msg;
display_msg = force_display > -1? force_display :
(prefs_common.always_show_msg == OPENMSG_ALWAYS) ||
((prefs_common.always_show_msg == OPENMSG_WHEN_VIEW_VISIBLE &&
messageview_is_visible(summaryview->messageview)));
if (summary_is_locked(summaryview)
&& !GTK_SCTREE(ctree)->selecting_range
@ -4434,7 +4434,7 @@ void summary_delete(SummaryView *summaryview)
if (!node || prefs_common.next_on_delete == FALSE)
node = summary_find_next_msg(summaryview, sel_last);
}
summary_select_node(summaryview, node, prefs_common.always_show_msg, TRUE);
summary_select_node(summaryview, node, -1, TRUE);
if (prefs_common.immediate_exec || folder_has_parent_of_type(item, F_TRASH)) {
summary_execute(summaryview);
@ -4578,10 +4578,6 @@ void summary_move_selected_to(SummaryView *summaryview, FolderItem *to_folder)
}
END_LONG_OPERATION(summaryview);
summaryview->display_msg = (prefs_common.always_show_msg == OPENMSG_ALWAYS) ||
((prefs_common.always_show_msg == OPENMSG_WHEN_VIEW_VISIBLE &&
messageview_is_visible(summaryview->messageview)));
if (prefs_common.immediate_exec) {
summary_execute(summaryview);
} else {
@ -4595,7 +4591,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);
}
summary_select_node(summaryview, node, summaryview->display_msg, TRUE);
summary_select_node(summaryview, node, -1, TRUE);
summary_status_show(summaryview);
}
@ -4603,7 +4599,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, summaryview->display_msg, TRUE);
summary_select_node(summaryview, node, -1, TRUE);
}
}
@ -8142,7 +8138,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, TRUE, TRUE);
summary_select_node(summaryview, node, 1, TRUE);
}
gint summaryview_export_mbox_list(SummaryView *summaryview)

View file

@ -210,8 +210,8 @@ void summary_display_by_msgnum (SummaryView *summaryview,
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,
gboolean display_msg,
GtkCMCTreeNode *node,
gint force_display,
gboolean do_refresh);
void summary_expand_threads (SummaryView *summaryview);