talons

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

commit 6b9aa3dd1772f5aa5df322c8034c9f1e9ded81ab
parent c09f3d7dba4e5d556152cc941dc3c8071068b933
Author: wwp <wwp@free.fr>
Date:   Wed, 25 Apr 2018 15:48:12 +0200

Fix sensitivity of the main window's 'View/Message part/View as text' entry
according to the selected mime part.

Diffstat:
Msrc/mainwindow.c | 12++++++++++++
Msrc/mimeview.c | 9++++++++-
2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/mainwindow.c b/src/mainwindow.c @@ -3362,6 +3362,18 @@ do { \ cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/CheckSignature", mimepart_selected && mainwin->messageview->mimeview->signed_part); + sensitive = TRUE; + if (mimepart_selected) { + MimeInfo *partinfo = messageview_get_selected_mime_part(mainwin->messageview); + + if (partinfo && (partinfo->type == MIMETYPE_MESSAGE || + partinfo->type == MIMETYPE_IMAGE || + partinfo->type == MIMETYPE_MULTIPART)) { + sensitive = FALSE; + } + } + cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Part/AsText", sensitive); + main_window_menu_callback_unblock(mainwin); } diff --git a/src/mimeview.c b/src/mimeview.c @@ -1397,6 +1397,7 @@ static void mimeview_selected(GtkTreeSelection *selection, MimeView *mimeview) GtkTreeIter iter; GtkTreePath *path; MimeInfo *partinfo; + MainWindow *mainwin; selection = gtk_tree_view_get_selection(ctree); if (!gtk_tree_selection_get_selected(selection, &model, &iter)) @@ -1444,6 +1445,9 @@ static void mimeview_selected(GtkTreeSelection *selection, MimeView *mimeview) break; } } + mainwin = mainwindow_get_mainwindow(); + if (mainwin) + main_window_set_menu_sensitive(mainwin); if (mimeview->siginfo && privacy_auto_check_signatures(mimeview->siginfo) && privacy_mimeinfo_get_sig_status(mimeview->siginfo) == SIGNATURE_UNCHECKED) { @@ -1499,6 +1503,8 @@ static gboolean part_button_pressed(MimeView *mimeview, GdkEventButton *event, mimeview_launch(mimeview, partinfo); return TRUE; } else if (event->button == 3) { + MainWindow *mainwin = mainwindow_get_mainwindow(); + if (partinfo && (partinfo->type == MIMETYPE_MESSAGE || partinfo->type == MIMETYPE_IMAGE || partinfo->type == MIMETYPE_MULTIPART)) @@ -1513,7 +1519,8 @@ static gboolean part_button_pressed(MimeView *mimeview, GdkEventButton *event, else #endif cm_menu_set_sensitive_full(mimeview->ui_manager, "Menus/MimeView/Open", TRUE); - + if (mainwin) + main_window_set_menu_sensitive(mainwin); g_object_set_data(G_OBJECT(mimeview->popupmenu), "pop_partinfo", partinfo);