[Commits] [SCM] claws branch, master, updated. 4.1.0-40-g885cd5ebe

paul at claws-mail.org paul at claws-mail.org
Wed Jun 22 13:23:04 CET 2022


The branch, master has been updated
       via  885cd5ebe526d9d946fb5807536d0c512c1c026e (commit)
      from  cb87cf1ddffddb6d19c37cd30b273d53baaab352 (commit)

Summary of changes:
 src/mimeview.c     | 62 ++++++++++++++++++++++++++++++++----------------------
 src/prefs_common.c |  8 +++++--
 src/prefs_common.h |  8 ++++---
 3 files changed, 48 insertions(+), 30 deletions(-)


- Log -----------------------------------------------------------------
commit 885cd5ebe526d9d946fb5807536d0c512c1c026e
Author: Paul <paul at claws-mail.org>
Date:   Wed Jun 22 14:23:00 2022 +0100

    fix 'save all' dialogues
    
    * don't treat not overwriting a file as an error
    * add checkboxes/hidden prefs to not show the post-saving informational dialogues
    * fix counts in informational dialogues
    * improvements to dialogue labels

diff --git a/src/mimeview.c b/src/mimeview.c
index 54303293f..e782dce76 100644
--- a/src/mimeview.c
+++ b/src/mimeview.c
@@ -78,9 +78,9 @@ static void mimeview_change_view_type		(MimeView	*mimeview,
 static gchar *mimeview_get_filename_for_part	(MimeInfo	*partinfo,
 						 const gchar	*basedir,
 						 gint		 number);
-static gboolean mimeview_write_part		(const gchar	*filename,
-						 MimeInfo	*partinfo,
-						 gboolean	 handle_error);
+static gint mimeview_write_part		(const gchar	*filename,
+					 MimeInfo	*partinfo,
+					 gboolean	 handle_error);
 
 static void mimeview_selected		(GtkTreeSelection	*selection,
 					 MimeView	*mimeview);
@@ -1790,9 +1790,9 @@ static gchar *mimeview_get_filename_for_part(MimeInfo *partinfo,
  * \param filename Filename with path
  * \param partinfo Attachment to save
  */
-static gboolean mimeview_write_part(const gchar *filename,
-				    MimeInfo *partinfo,
-				    gboolean handle_error)
+static gint mimeview_write_part(const gchar *filename,
+				MimeInfo *partinfo,
+				gboolean handle_error)
 {
 	gchar *dir;
 	gint err;
@@ -1815,10 +1815,11 @@ static gboolean mimeview_write_part(const gchar *filename,
 		res = g_strdup_printf(_("Overwrite existing file '%s'?"),
 				      tmp);
 		g_free(tmp);
-		aval = alertpanel(_("Overwrite"), res, NULL, _("_Cancel"),
-				  NULL, _("_OK"), NULL, NULL, ALERTFOCUS_FIRST);
+		aval = alertpanel(_("Overwrite"), res, NULL, _("_No"),
+				  NULL, _("_Yes"), NULL, NULL, ALERTFOCUS_FIRST);
 		g_free(res);
-		if (G_ALERTALTERNATE != aval) return FALSE;
+		if (G_ALERTALTERNATE != aval)
+			return 2;
 	}
 
 	if ((err = procmime_get_part(filename, partinfo)) < 0) {
@@ -1827,20 +1828,20 @@ static gboolean mimeview_write_part(const gchar *filename,
 			alertpanel_error
 				(_("Couldn't save the part of multipart message: %s"),
 				 g_strerror(-err));
-		return FALSE;
+		return 0;
 	}
 
-	return TRUE;
+	return 1;
 }
 
 static AlertValue mimeview_save_all_error_ask(gint n)
 {
 	gchar *message = g_strdup_printf(
-		_("An error has occurred while saving message part #%d. "
-		"Do you want to cancel operation or skip error and "
+		_("An error has occurred while saving message part %d. "
+		"Do you want to cancel saving or ignore error and "
 		"continue?"), n);
-	AlertValue av = alertpanel_full(_("Error saving all message parts"),
-		message, NULL, _("_Cancel"), NULL, _("Skip"), NULL, _("Skip all"),
+	AlertValue av = alertpanel_full(_("Error saving message part"),
+		message, NULL, _("_Cancel"), NULL, _("Ignore"), NULL, _("Ignore all"),
 		ALERTFOCUS_FIRST, FALSE, NULL, ALERT_WARNING);
 	g_free(message);
 	return av;
@@ -1848,15 +1849,21 @@ static AlertValue mimeview_save_all_error_ask(gint n)
 
 static void mimeview_save_all_info(gint errors, gint total)
 {
-	if (!errors) {
+	AlertValue aval;
+
+	if (!errors && prefs_common.show_save_all_success) {
 		gchar *msg = g_strdup_printf(
 				ngettext("%d file saved successfully.",
 					"%d files saved successfully.",
 					total),
 				total);
-		alertpanel_notice("%s", msg);
+		aval = alertpanel_full(_("Notice"), msg, NULL, _("_Close"),
+				       NULL, NULL, NULL, NULL, ALERTFOCUS_FIRST,
+				       TRUE, NULL, ALERT_NOTICE);
 		g_free(msg);
-	} else {
+		if (aval & G_ALERTDISABLE)
+			prefs_common.show_save_all_success = FALSE;
+	} else if (prefs_common.show_save_all_failure) {
 		gchar *msg1 = g_strdup_printf(
 				ngettext("%d file saved successfully",
 					"%d files saved successfully",
@@ -1867,9 +1874,13 @@ static void mimeview_save_all_info(gint errors, gint total)
 					"%s, %d files failed.",
 					errors),
 				msg1, errors);
-		alertpanel_warning("%s", msg2);
+		aval = alertpanel_full(_("Warning"), msg2, NULL, _("_Close"),
+				       NULL, NULL, NULL, NULL, ALERTFOCUS_FIRST,
+				       TRUE, NULL, ALERT_WARNING);
 		g_free(msg2);
 		g_free(msg1);
+		if (aval & G_ALERTDISABLE)
+			prefs_common.show_save_all_failure = FALSE;
 	}
 }
 
@@ -1882,7 +1893,7 @@ static void mimeview_save_all(MimeView *mimeview)
 	MimeInfo *partinfo;
 	gchar *dirname;
 	gchar *startdir = NULL;
-	gint number = 1, errors = 0;
+	gint number = 0, errors = 0;
 	gboolean skip_errors = FALSE;
 
 	if (!mimeview->opened) return;
@@ -1929,17 +1940,18 @@ static void mimeview_save_all(MimeView *mimeview)
 			gchar *filename = mimeview_get_filename_for_part(
 				partinfo, dirname, number++);
 
-			gboolean ok = mimeview_write_part(filename, partinfo, FALSE);
+			gint ok = mimeview_write_part(filename, partinfo, FALSE);
 			g_free(filename);
-			if (!ok) {
+			if (ok < 1) {
 				++errors;
 				if (!skip_errors) {
-					AlertValue av = mimeview_save_all_error_ask(number - 1);
+					AlertValue av = mimeview_save_all_error_ask(number);
 					skip_errors = (av == G_ALERTOTHER);
 					if (av == G_ALERTDEFAULT) /* cancel */
 						break;
 				}
-			}
+			} else if (ok == 2)
+				number--;
 		}
 		partinfo = procmime_mimeinfo_next(partinfo);
 	}
@@ -1950,7 +1962,7 @@ static void mimeview_save_all(MimeView *mimeview)
 					-1, NULL, NULL, NULL);
 	g_free(dirname);
 
-	mimeview_save_all_info(errors, number - 1);
+	mimeview_save_all_info(errors, number);
 }
 
 static MimeInfo *mimeview_get_part_to_use(MimeView *mimeview)
diff --git a/src/prefs_common.c b/src/prefs_common.c
index f61f6a9e3..fddb5bdd7 100644
--- a/src/prefs_common.c
+++ b/src/prefs_common.c
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2021 the Claws Mail team and Hiroyuki Yamamoto
+ * Copyright (C) 1999-2022 the Claws Mail team and Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1168,7 +1168,11 @@ static PrefParam param[] = {
 	 NULL, NULL, NULL},
 	{"warn_dnd", "1", &prefs_common.warn_dnd, P_INT,
 	 NULL, NULL, NULL},
-	{"utf8_instead_of_locale_for_broken_mail", "0", 
+	{"show_save_all_success", "1", &prefs_common.show_save_all_success, P_INT,
+	 NULL, NULL, NULL},
+	{"show_save_all_failure", "1", &prefs_common.show_save_all_failure, P_INT,
+	 NULL, NULL, NULL},
+	{"utf8_instead_of_locale_for_broken_mail", "0",
 	 &prefs_common.broken_are_utf8, P_INT,
 	 NULL, NULL, NULL},
 	{"enable_swap_from", "FALSE", &prefs_common.swap_from, P_BOOL,
diff --git a/src/prefs_common.h b/src/prefs_common.h
index 7175cc68f..0d4cf465d 100644
--- a/src/prefs_common.h
+++ b/src/prefs_common.h
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2021 the Claws Mail team and Hiroyuki Yamamoto
+ * Copyright (C) 1999-2022 the Claws Mail team and Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -537,7 +537,7 @@ struct _PrefsCommon
 	gint news_subscribe_width;
 	gint news_subscribe_height;
 
-    gint imap_scan_tree_recurs_limit;
+	gint imap_scan_tree_recurs_limit;
 	gint warn_dnd;
 	gint broken_are_utf8;
 	gint skip_ssl_cert_check;
@@ -547,7 +547,9 @@ struct _PrefsCommon
 	gint hide_quotes;
 	gboolean unsafe_ssl_certs;
 	gboolean real_time_sync;
-	
+	gboolean show_save_all_success;
+	gboolean show_save_all_failure;
+
 	gchar *print_paper_type;
 	gint print_paper_orientation;
 	gint print_margin_top;

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list