[Commits] [SCM] claws branch, gtk2, updated. 3.19.0-46-gdae9c4766

paul at claws-mail.org paul at claws-mail.org
Wed Jun 22 13:32:36 CET 2022


The branch, gtk2 has been updated
       via  dae9c4766dbd6b1f38cbf4f8426ad94a7bdc10ea (commit)
      from  cab58c90fbd6ac180ff21f1ff2fad91e6a50c05a (commit)

Summary of changes:
 src/mimeview.c     | 64 ++++++++++++++++++++++++++++++++----------------------
 src/prefs_common.c | 10 ++++++---
 src/prefs_common.h | 10 +++++----
 3 files changed, 51 insertions(+), 33 deletions(-)


- Log -----------------------------------------------------------------
commit dae9c4766dbd6b1f38cbf4f8426ad94a7bdc10ea
Author: paul <paul at claws-mail.org>
Date:   Wed Jun 22 14:32:33 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 451e8c169..1f0f3982e 100644
--- a/src/mimeview.c
+++ b/src/mimeview.c
@@ -1,6 +1,6 @@
 /*
- * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2015 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK based, lightweight, and fast e-mail client
+ * 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
@@ -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);
@@ -1766,9 +1766,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;
@@ -1791,10 +1791,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, GTK_STOCK_CANCEL,
-				  GTK_STOCK_OK, NULL, ALERTFOCUS_FIRST);
+		aval = alertpanel(_("Overwrite"), res, GTK_STOCK_NO,
+				  GTK_STOCK_YES, 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) {
@@ -1803,20 +1804,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, GTK_STOCK_CANCEL, _("Skip"), _("Skip all"),
+		message, GTK_STOCK_CANCEL, _("Ignore"), _("Ignore all"),
 		ALERTFOCUS_FIRST, FALSE, NULL, ALERT_WARNING);
 	g_free(message);
 	return av;
@@ -1824,15 +1825,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",
@@ -1843,9 +1850,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;
 	}
 }
 
@@ -1858,7 +1869,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;
@@ -1905,17 +1916,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);
 	}
@@ -1926,7 +1938,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 195bc6c50..1ee79992b 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
+ * Claws Mail -- a GTK based, lightweight, and fast e-mail client
+ * 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
@@ -1172,7 +1172,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 f0fbfe167..08df39967 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
+ * Claws Mail -- a GTK based, lightweight, and fast e-mail client
+ * 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
@@ -539,7 +539,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;
@@ -549,7 +549,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