From 6d741eea43bd5285080eb7a24e5ac4e9e7e6a23b Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 14 May 2008 15:11:16 +0000 Subject: ** Fixes bug #531592 2008-05-14 Matthew Barnes ** 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(). svn path=/trunk/; revision=35500 --- e-util/ChangeLog | 11 +++++++++++ e-util/e-error.c | 22 +++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 9d4197b337..41721887d6 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,14 @@ +2008-05-14 Matthew Barnes + + ** 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(). + 2008-05-08 Matthew Barnes ** Fixes part of bug #525241 (EPluginUI) diff --git a/e-util/e-error.c b/e-util/e-error.c index e47869f32a..ed6369a184 100644 --- a/e-util/e-error.c +++ b/e-util/e-error.c @@ -376,7 +376,8 @@ ee_append_text(GString *out, const char *text) } 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 @@ ee_build_label(GString *out, const char *fmt, GPtrArray *args) && (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 @@ e_error_newv(GtkWindow *parent, const char *tag, const char *arg0, va_list ap) 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 @@ e_error_newv(GtkWindow *parent, const char *tag, const char *arg0, va_list ap) if (e->primary) { g_string_append(out, ""); - 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, "\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); } -- cgit v1.2.3