aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2008-05-14 23:11:16 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-05-14 23:11:16 +0800
commit6d741eea43bd5285080eb7a24e5ac4e9e7e6a23b (patch)
tree1ff06d7122f6097abafc9139678d593defed5960
parent7d213ee0c25ac231789aa68b3f60ea3960707fea (diff)
downloadgsoc2013-evolution-6d741eea43bd5285080eb7a24e5ac4e9e7e6a23b.tar
gsoc2013-evolution-6d741eea43bd5285080eb7a24e5ac4e9e7e6a23b.tar.gz
gsoc2013-evolution-6d741eea43bd5285080eb7a24e5ac4e9e7e6a23b.tar.bz2
gsoc2013-evolution-6d741eea43bd5285080eb7a24e5ac4e9e7e6a23b.tar.lz
gsoc2013-evolution-6d741eea43bd5285080eb7a24e5ac4e9e7e6a23b.tar.xz
gsoc2013-evolution-6d741eea43bd5285080eb7a24e5ac4e9e7e6a23b.tar.zst
gsoc2013-evolution-6d741eea43bd5285080eb7a24e5ac4e9e7e6a23b.zip
** Fixes bug #531592
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(). svn path=/trunk/; revision=35500
-rw-r--r--e-util/ChangeLog11
-rw-r--r--e-util/e-error.c22
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 <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().
+
2008-05-08 Matthew Barnes <mbarnes@redhat.com>
** 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, "<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);
}