[Commits] [SCM] claws branch, master, updated. 4.1.1-65-gda7ac9b35
paul at claws-mail.org
paul at claws-mail.org
Sat Jun 24 05:26:14 UTC 2023
The branch, master has been updated
via da7ac9b3557560cb9a0033994b6a83e684c336b2 (commit)
from c18a2f85c5680a0aaeefff4e949a25666aab13bd (commit)
Summary of changes:
src/mimeview.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
- Log -----------------------------------------------------------------
commit da7ac9b3557560cb9a0033994b6a83e684c336b2
Author: Paul <paul at claws-mail.org>
Date: Sat Jun 24 06:26:09 2023 +0100
allow saving attachments only, without other msg parts
diff --git a/src/mimeview.c b/src/mimeview.c
index ef12ed8f5..80402611c 100644
--- a/src/mimeview.c
+++ b/src/mimeview.c
@@ -102,7 +102,8 @@ static gboolean mimeview_scrolled (GtkWidget *widget,
GdkEventScroll *event,
MimeView *mimeview);
-static void mimeview_save_all (MimeView *mimeview);
+static void mimeview_save_all (MimeView *mimeview,
+ gboolean attachments_only);
#ifndef G_OS_WIN32
static void mimeview_open_part_with (MimeView *mimeview,
MimeInfo *partinfo,
@@ -203,7 +204,12 @@ static void mimeview_save_as_cb(GtkAction *action, gpointer data)
static void mimeview_save_all_cb(GtkAction *action, gpointer data)
{
- mimeview_save_all((MimeView *)data);
+ mimeview_save_all((MimeView *)data, FALSE);
+}
+
+static void mimeview_save_all_attachments_cb(GtkAction *action, gpointer data)
+{
+ mimeview_save_all((MimeView *)data, TRUE);
}
static void mimeview_select_next_part_cb(GtkAction *action, gpointer data)
@@ -227,6 +233,7 @@ static GtkActionEntry mimeview_menu_actions[] = {
{ "MimeView/DisplayAsText", NULL, N_("_Display as text"), NULL, "Display as text", G_CALLBACK(mimeview_display_as_text_cb) },
{ "MimeView/SaveAs", NULL, N_("_Save as..."), NULL, "Save as", G_CALLBACK(mimeview_save_as_cb) },
{ "MimeView/SaveAll", NULL, N_("Save _all..."), NULL, "Save all parts", G_CALLBACK(mimeview_save_all_cb) },
+ { "MimeView/SaveAllAttachments", NULL, N_("Save all attachments..."), NULL, "Save all attachments", G_CALLBACK(mimeview_save_all_attachments_cb) },
{ "MimeView/NextPart", NULL, N_("Next part"), NULL, "Next part", G_CALLBACK(mimeview_select_next_part_cb) },
{ "MimeView/PrevPart", NULL, N_("Previous part"), NULL, "Previous part", G_CALLBACK(mimeview_select_prev_part_cb) }
};
@@ -448,6 +455,9 @@ MimeView *mimeview_create(MainWindow *mainwin)
MENUITEM_ADDUI_MANAGER(mimeview->ui_manager,
"/Menus/MimeView/", "SaveAll", "MimeView/SaveAll",
GTK_UI_MANAGER_MENUITEM);
+ MENUITEM_ADDUI_MANAGER(mimeview->ui_manager,
+ "/Menus/MimeView/", "SaveAllAttachments", "MimeView/SaveAllAttachments",
+ GTK_UI_MANAGER_MENUITEM);
MENUITEM_ADDUI_MANAGER(mimeview->ui_manager,
"/Menus/MimeView/", "NextPart", "MimeView/NextPart",
GTK_UI_MANAGER_MENUITEM);
@@ -1888,7 +1898,7 @@ static void mimeview_save_all_info(gint errors, gint total)
* Menu callback: Save all attached files
* \param mimeview Current display
*/
-static void mimeview_save_all(MimeView *mimeview)
+static void mimeview_save_all(MimeView *mimeview, gboolean attachments_only)
{
MimeInfo *partinfo;
gchar *dirname;
@@ -1933,10 +1943,14 @@ static void mimeview_save_all(MimeView *mimeview)
}
while (partinfo != NULL) {
- if (partinfo->type != MIMETYPE_MESSAGE &&
- partinfo->type != MIMETYPE_MULTIPART &&
- (partinfo->disposition != DISPOSITIONTYPE_INLINE
- || get_real_part_name(partinfo) != NULL)) {
+ if (!attachments_only &&
+ (partinfo->type != MIMETYPE_MESSAGE &&
+ partinfo->type != MIMETYPE_MULTIPART &&
+ (partinfo->disposition != DISPOSITIONTYPE_INLINE ||
+ get_real_part_name(partinfo) != NULL)) ||
+ attachments_only &&
+ (partinfo->disposition == DISPOSITIONTYPE_ATTACHMENT &&
+ get_real_part_name(partinfo) != NULL)) {
gchar *filename = mimeview_get_filename_for_part(
partinfo, dirname, number++);
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list