talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit dca37632f4c6775be95392cd802c58e3ea39c175
parent e0db6026a22b084f296c004f48ab86d3ab5a3e8e
Author: Colin Leroy <colin@colino.net>
Date:   Wed,  3 Oct 2018 09:15:30 +0200

Fix Reply from mainwindow menu and toolbar when mainwindow's
messageview is hidden.

Diffstat:
Msrc/mainwindow.c | 4+++-
Msrc/summaryview.c | 17+++++++++++++++--
Msrc/summaryview.h | 1+
Msrc/toolbar.c | 7++++++-
4 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/src/mainwindow.c b/src/mainwindow.c @@ -4121,7 +4121,9 @@ static void main_window_reply_cb(GtkAction *gaction, gpointer data) msginfo_list = summary_get_selection(mainwin->summaryview); cm_return_if_fail(msginfo_list != NULL); - if (summary_is_opened_message_selected(mainwin->summaryview)) { + if (!summary_has_opened_message(mainwin->summaryview)) { + compose_reply_from_messageview(NULL, msginfo_list, action); + } else if (summary_is_opened_message_selected(mainwin->summaryview)) { compose_reply_from_messageview(msgview, msginfo_list, action); } else { compose_reply_from_messageview(msgview, NULL, action); diff --git a/src/summaryview.c b/src/summaryview.c @@ -8433,12 +8433,14 @@ static void summary_reply_cb(GtkAction *gaction, gpointer data) gboolean summary_is_opened_message_selected(SummaryView *summaryview) { GList *sel = NULL; - + cm_return_val_if_fail(summaryview != NULL, FALSE); sel = GTK_CMCLIST(summaryview->ctree)->selection; - cm_return_val_if_fail(sel != NULL, FALSE); + if (summaryview->displayed == NULL || sel == NULL) { + return FALSE; + } for ( ; sel != NULL; sel = sel->next) { if (summaryview->displayed == GTK_CMCTREE_NODE(sel->data)) { @@ -8448,3 +8450,14 @@ gboolean summary_is_opened_message_selected(SummaryView *summaryview) return FALSE; } +gboolean summary_has_opened_message(SummaryView *summaryview) +{ + GList *sel = NULL; + + cm_return_val_if_fail(summaryview != NULL, FALSE); + + sel = GTK_CMCLIST(summaryview->ctree)->selection; + + return (summaryview->displayed != NULL); +} + diff --git a/src/summaryview.h b/src/summaryview.h @@ -336,4 +336,5 @@ void summary_update_unread(SummaryView *summaryview, FolderItem *removed_item); gboolean summary_is_list(SummaryView *summaryview); gboolean summaryview_search_root_progress(gpointer data, guint at, guint matched, guint total); gboolean summary_is_opened_message_selected(SummaryView *summaryview); +gboolean summary_has_opened_message(SummaryView *summaryview); #endif /* __SUMMARY_H__ */ diff --git a/src/toolbar.c b/src/toolbar.c @@ -2967,6 +2967,7 @@ static void toolbar_reply(gpointer data, guint action) MessageView *msgview; GSList *msginfo_list = NULL; gboolean msg_is_selected = FALSE; + gboolean msg_is_opened = FALSE; cm_return_if_fail(toolbar_item != NULL); @@ -2975,12 +2976,14 @@ static void toolbar_reply(gpointer data, guint action) mainwin = (MainWindow*)toolbar_item->parent; msginfo_list = summary_get_selection(mainwin->summaryview); msgview = (MessageView*)mainwin->messageview; + msg_is_opened = summary_has_opened_message(mainwin->summaryview); msg_is_selected = summary_is_opened_message_selected(mainwin->summaryview); break; case TOOLBAR_MSGVIEW: msgview = (MessageView*)toolbar_item->parent; cm_return_if_fail(msgview != NULL); msginfo_list = g_slist_append(msginfo_list, msgview->msginfo); + msg_is_opened = TRUE; msg_is_selected = TRUE; break; default: @@ -2989,7 +2992,9 @@ static void toolbar_reply(gpointer data, guint action) cm_return_if_fail(msgview != NULL); cm_return_if_fail(msginfo_list != NULL); - if (msg_is_selected) { + if (!msg_is_opened) { + compose_reply_from_messageview(NULL, msginfo_list, action); + } else if (msg_is_selected) { compose_reply_from_messageview(msgview, msginfo_list, action); } else { compose_reply_from_messageview(msgview, NULL, action);