evolution r35500 - trunk/e-util



Author: mbarnes
Date: Wed May 14 15:11:16 2008
New Revision: 35500
URL: http://svn.gnome.org/viewvc/evolution?rev=35500&view=rev

Log:
2008-05-14  Matthew Barnes  <mbarnes redhat com>

	** Fixes bug #531592

	* e-error.c (ee_build_label):
	Add an 'escape_args' parameter for strings that should /not/ be
	escaped, such as window titles and status bar messages.

	* e-error.c (e_error_newv):
	Pass an appropriate 'escape_args' value to ee_build_label().



Modified:
   trunk/e-util/ChangeLog
   trunk/e-util/e-error.c

Modified: trunk/e-util/e-error.c
==============================================================================
--- trunk/e-util/e-error.c	(original)
+++ trunk/e-util/e-error.c	Wed May 14 15:11:16 2008
@@ -376,7 +376,8 @@
 }
 
 static void
-ee_build_label(GString *out, const char *fmt, GPtrArray *args)
+ee_build_label(GString *out, const char *fmt, GPtrArray *args,
+               gboolean escape_args)
 {
 	const char *end, *newstart;
 	int id;
@@ -386,9 +387,12 @@
 	       && (end = strchr(newstart+1, '}'))) {
 		g_string_append_len(out, fmt, newstart-fmt);
 		id = atoi(newstart+1);
-		if (id < args->len)
-			ee_append_text(out, args->pdata[id]);
-		else
+		if (id < args->len) {
+			if (escape_args)
+				ee_append_text(out, args->pdata[id]);
+			else
+				g_string_append(out, args->pdata[id]);
+		} else
 			g_warning("Error references argument %d not supplied by caller", id);
 		fmt = end+1;
 	}
@@ -518,7 +522,7 @@
 	out = g_string_new("");
 
 	if (e->title) {
-		ee_build_label(out, dgettext(table->translation_domain, e->title), args);
+		ee_build_label(out, dgettext(table->translation_domain, e->title), args, FALSE);
 		gtk_window_set_title((GtkWindow *)dialog, out->str);
 		g_string_truncate(out, 0);
 	} else
@@ -527,19 +531,19 @@
 
 	if (e->primary) {
 		g_string_append(out, "<span weight=\"bold\" size=\"larger\">");
-		ee_build_label(out, dgettext(table->translation_domain, e->primary), args);
+		ee_build_label(out, dgettext(table->translation_domain, e->primary), args, TRUE);
 		g_string_append(out, "</span>\n\n");
 		oerr = g_string_new("");
-		ee_build_label(oerr, dgettext(table->translation_domain, e->primary), args);
+		ee_build_label(oerr, dgettext(table->translation_domain, e->primary), args, FALSE);
 		perr = g_strdup (oerr->str);
 		g_string_free (oerr, TRUE);
 	} else
 		perr = g_strdup (gtk_window_get_title (GTK_WINDOW (dialog)));
 	
 	if (e->secondary) {
-		ee_build_label(out, dgettext(table->translation_domain, e->secondary), args);
+		ee_build_label(out, dgettext(table->translation_domain, e->secondary), args, TRUE);
 		oerr = g_string_new("");
-		ee_build_label(oerr, dgettext(table->translation_domain, e->secondary), args);
+		ee_build_label(oerr, dgettext(table->translation_domain, e->secondary), args, TRUE);
 		serr = g_strdup (oerr->str);
 		g_string_free (oerr, TRUE);
 	}



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