[evolution] Bug #302742 - The mail error messages is difficult to understand/translate



commit 125573b8fd62f4d0d38907c95c70168ca984d3c4
Author: Milan Crha <mcrha redhat com>
Date:   Thu Apr 1 20:00:36 2010 +0200

    Bug #302742 - The mail error messages is difficult to understand/translate

 mail/mail-autofilter.c |   33 +++++++++++++++++++++++++++------
 mail/mail-vfolder.c    |   30 +++++++++++++++++++++++++-----
 mail/mail.error.xml    |   12 ++----------
 3 files changed, 54 insertions(+), 21 deletions(-)
---
diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c
index 8117bfc..dd6e64a 100644
--- a/mail/mail-autofilter.c
+++ b/mail/mail-autofilter.c
@@ -424,18 +424,39 @@ mail_filter_delete_uri(CamelStore *store, const gchar *uri)
 	if (deleted) {
 		GtkWidget *dialog;
 		GString *s;
+		guint s_count;
+		gchar *info;
 		GList *l;
 
 		s = g_string_new("");
-		l = deleted;
-		while (l) {
-			g_string_append_printf (s, "    %s\n", (gchar *)l->data);
-			l = l->next;
+		s_count = 0;
+		for (l = deleted; l; l = l->next) {
+			const gchar *name = (const gchar *)l->data;
+
+			if (s_count == 0) {
+				g_string_append (s, name);
+			} else {
+				if (s_count == 1) {
+					g_string_prepend (s, "    ");
+					g_string_append (s, "\n");
+				}
+				g_string_append_printf (s, "    %s\n", name);
+			}
+			s_count++;
 		}
 
-		dialog = e_alert_dialog_new_for_args (e_shell_get_active_window (NULL), "mail:filter-updated", s->str, euri, NULL);
-		g_string_free(s, TRUE);
+		info = g_strdup_printf (ngettext (
+			/* Translators: The first %s is name of the affected filter rule(s),
+			   the second %s is uri of the removed folder. For more than one filter
+			   rule is each of them on a separate line, with four spaces in front
+			   of its name, without quotes. */
+			"The filter rule \"%s\" has been updated, because it used just removed folder\n\"%s\".",
+			"The following filter rules\n%s have been updated, because they used just removed folder\n\"%s\".",
+			s_count), s->str, euri);
+		dialog = e_alert_dialog_new_for_args (e_shell_get_active_window (NULL), "mail:filter-updated", info, NULL);
 		em_utils_show_info_silent (dialog);
+		g_string_free (s, TRUE);
+		g_free (info);
 
 		d(printf("Folder delete/rename '%s' changed filters, resaving\n", euri));
 		if (e_rule_context_save ((ERuleContext *) fc, user) == -1)
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 5d4dd44..2fe7a03 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -594,6 +594,7 @@ mail_vfolder_delete_uri(CamelStore *store, const gchar *curi)
 	const gchar *source;
 	CamelVeeFolder *vf;
 	GString *changed;
+	guint changed_count;
 	gchar *uri;
 	GList *link;
 
@@ -606,6 +607,7 @@ mail_vfolder_delete_uri(CamelStore *store, const gchar *curi)
 
 	g_return_if_fail (mail_in_main_thread());
 
+	changed_count = 0;
 	changed = g_string_new ("");
 
 	G_LOCK (vfolder);
@@ -638,7 +640,16 @@ mail_vfolder_delete_uri(CamelStore *store, const gchar *curi)
 								      0, NULL, rule_changed, vf);
 				em_vfolder_rule_remove_source ((EMVFolderRule *)rule, source);
 				g_signal_connect (rule, "changed", G_CALLBACK(rule_changed), vf);
-				g_string_append_printf (changed, "    %s\n", rule->name);
+				if (changed_count == 0) {
+					g_string_append (changed, rule->name);
+				} else {
+					if (changed_count == 1) {
+						g_string_prepend (changed, "    ");
+						g_string_append (changed, "\n");
+					}
+					g_string_append_printf (changed, "    %s\n", rule->name);
+				}
+				changed_count++;
 				source = NULL;
 			}
 			g_free(csource);
@@ -658,13 +669,22 @@ done:
 
 	G_UNLOCK (vfolder);
 
-	if (changed->str[0]) {
+	if (changed_count > 0) {
 		GtkWidget *dialog;
 		const gchar *data_dir;
-		gchar *user;
-
-		dialog = e_alert_dialog_new_for_args (e_shell_get_active_window (NULL), "mail:vfolder-updated", changed->str, uri, NULL);
+		gchar *user, *info;
+
+		info = g_strdup_printf (ngettext (
+			/* Translators: The first %s is name of the affected search folder(s),
+			   the second %s is uri of the removed folder. For more than one search
+			   folder is each of them on a separate line, with four spaces in front
+			   of its name, without quotes. */
+			"The Search Folder \"%s\" has been updated, because it used just removed folder\n\"%s\".",
+			"The following Search Folders\n%s have been updated, because they used just removed folder\n\"%s\".",
+			changed_count), changed->str, uri);
+		dialog = e_alert_dialog_new_for_args (e_shell_get_active_window (NULL), "mail:vfolder-updated", info, NULL);
 		em_utils_show_info_silent (dialog);
+		g_free (info);
 
 		data_dir = mail_session_get_data_dir ();
 		user = g_build_filename (data_dir, "vfolders.xml", NULL);
diff --git a/mail/mail.error.xml b/mail/mail.error.xml
index 2108ddd..1a1aef8 100644
--- a/mail/mail.error.xml
+++ b/mail/mail.error.xml
@@ -322,20 +322,12 @@ go to the Search Folder editor to add it explicitly, if required.</_secondary>
 
   <error id="vfolder-updated" type="info">
     <_primary>Search Folders automatically updated.</_primary>
-    <_secondary xml:space="preserve">The following Search Folder(s):
-{0}
-Used the now removed folder:
-    "{1}"
-And have been updated.</_secondary>
+    <secondary xml:space="preserve">{0}</secondary>
   </error>
 
   <error id="filter-updated" type="info">
     <_primary>Mail filters automatically updated.</_primary>
-    <_secondary xml:space="preserve">The following filter rule(s):
-{0}
-Used the now removed folder:
-    "{1}"
-And have been updated.</_secondary>
+    <secondary xml:space="preserve">{0}</secondary>
   </error>
 
   <error id="no-folder" type="error">



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]