[Commits] [SCM] claws branch, gtk2, updated. 3.19.1-52-g707b42352

paul at claws-mail.org paul at claws-mail.org
Sat Jun 24 05:27:09 UTC 2023


The branch, gtk2 has been updated
       via  707b423521a72486f41599033d9fae96e1949860 (commit)
      from  00f7e896472f2d412723173da4a3cc62a524d179 (commit)

Summary of changes:
 src/mimeview.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)


- Log -----------------------------------------------------------------
commit 707b423521a72486f41599033d9fae96e1949860
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 1b5d8e11c..1f5cfa982 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) }
 };
@@ -443,6 +450,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);
@@ -1864,7 +1874,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;
@@ -1909,10 +1919,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