aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-02-18 01:15:48 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-02-18 01:15:48 +0800
commitb5a4e10a04b653109991aa30a07f4a14bf1fa787 (patch)
treecc70c5b5d07a671ed6b13ae6271d9dc7f9724951
parent65737b99914b7e26049ce052e06e7a7299b38eed (diff)
downloadgsoc2013-evolution-b5a4e10a04b653109991aa30a07f4a14bf1fa787.tar.gz
gsoc2013-evolution-b5a4e10a04b653109991aa30a07f4a14bf1fa787.tar.zst
gsoc2013-evolution-b5a4e10a04b653109991aa30a07f4a14bf1fa787.zip
Add option to escape EAlert strings.
EAlertDialog wants the primary and secondary strings escaped for use in markup text, EActivityProxy does not use markup. So make it an explicit part of the EAlert API.
-rw-r--r--e-util/e-alert-activity.c4
-rw-r--r--e-util/e-alert-dialog.c6
-rw-r--r--e-util/e-alert.c56
-rw-r--r--e-util/e-alert.h6
4 files changed, 42 insertions, 30 deletions
diff --git a/e-util/e-alert-activity.c b/e-util/e-alert-activity.c
index b279b87248..d27a400206 100644
--- a/e-util/e-alert-activity.c
+++ b/e-util/e-alert-activity.c
@@ -113,8 +113,8 @@ alert_activity_constructed (GObject *object)
message_dialog = e_alert_activity_get_message_dialog (alert_activity);
alert = e_alert_dialog_get_alert (E_ALERT_DIALOG (message_dialog));
- primary_text = e_alert_get_primary_text (alert);
- secondary_text = e_alert_get_secondary_text (alert);
+ primary_text = e_alert_get_primary_text (alert, FALSE);
+ secondary_text = e_alert_get_secondary_text (alert, FALSE);
g_object_unref (alert);
activity = E_ACTIVITY (alert_activity);
diff --git a/e-util/e-alert-dialog.c b/e-util/e-alert-dialog.c
index d39d60dd4a..9a49a76223 100644
--- a/e-util/e-alert-dialog.c
+++ b/e-util/e-alert-dialog.c
@@ -193,18 +193,18 @@ e_alert_dialog_constructed (GObject *obj)
gtk_misc_set_alignment((GtkMisc *)w, 0.0, 0.0);
gtk_box_pack_start((GtkBox *)hbox, w, FALSE, FALSE, 12);
- title = e_alert_get_title (alert);
+ title = e_alert_get_title (alert, FALSE);
gtk_window_set_title((GtkWindow *)self, title);
out = g_string_new ("");
- primary = e_alert_get_primary_text (alert);
+ primary = e_alert_get_primary_text (alert, TRUE);
if (primary) {
g_string_append_printf (out,
"<span weight=\"bold\" size=\"larger\">%s</span>\n\n",
primary);
}
- secondary = e_alert_get_secondary_text (alert);
+ secondary = e_alert_get_secondary_text (alert, TRUE);
if (secondary) {
g_string_append (out, secondary);
}
diff --git a/e-util/e-alert.c b/e-util/e-alert.c
index 7a08c30e83..b3a7859da5 100644
--- a/e-util/e-alert.c
+++ b/e-util/e-alert.c
@@ -589,58 +589,70 @@ e_alert_get_default_response (EAlert *alert)
}
gchar *
-e_alert_get_title (EAlert *alert)
+e_alert_get_title (EAlert *alert,
+ gboolean escaped)
{
GString *formatted;
+
g_return_val_if_fail (alert && alert->priv && alert->priv->definition, NULL);
formatted = g_string_new ("");
- if (alert->priv->definition->title) {
- e_alert_format_string (formatted,
- alert->priv->definition->title,
- alert->priv->args, FALSE);
- }
+
+ if (alert->priv->definition->title != NULL)
+ e_alert_format_string (
+ formatted, alert->priv->definition->title,
+ alert->priv->args, escaped);
+
return g_string_free (formatted, FALSE);
}
gchar *
-e_alert_get_primary_text (EAlert *alert)
+e_alert_get_primary_text (EAlert *alert,
+ gboolean escaped)
{
GString *formatted;
+
g_return_val_if_fail (alert && alert->priv, NULL);
formatted = g_string_new ("");
- if (alert->priv->definition)
- if (alert->priv->definition->primary) {
- e_alert_format_string (formatted,
- alert->priv->definition->primary,
- alert->priv->args, TRUE);
+
+ if (alert->priv->definition != NULL)
+ if (alert->priv->definition->primary != NULL) {
+ e_alert_format_string (
+ formatted, alert->priv->definition->primary,
+ alert->priv->args, escaped);
} else {
- gchar *title = e_alert_get_title (alert);
+ gchar *title;
+
+ title = e_alert_get_title (alert, escaped);
g_string_append (formatted, title);
g_free (title);
}
else {
- g_string_append_printf(formatted,
- _("Internal error, unknown error '%s' requested"),
- alert->priv->tag);
+ g_string_append_printf(
+ formatted,
+ _("Internal error, unknown error '%s' requested"),
+ alert->priv->tag);
}
return g_string_free (formatted, FALSE);
}
gchar *
-e_alert_get_secondary_text (EAlert *alert)
+e_alert_get_secondary_text (EAlert *alert,
+ gboolean escaped)
{
GString *formatted;
+
g_return_val_if_fail (alert && alert->priv && alert->priv->definition, NULL);
formatted = g_string_new ("");
- if (alert->priv->definition->secondary) {
- e_alert_format_string (formatted,
- alert->priv->definition->secondary,
- alert->priv->args, TRUE);
- }
+
+ if (alert->priv->definition->secondary != NULL)
+ e_alert_format_string (
+ formatted, alert->priv->definition->secondary,
+ alert->priv->args, escaped);
+
return g_string_free (formatted, FALSE);
}
diff --git a/e-util/e-alert.h b/e-util/e-alert.h
index 700f6bed59..743db9761f 100644
--- a/e-util/e-alert.h
+++ b/e-util/e-alert.h
@@ -104,9 +104,9 @@ EAlert *e_alert_new_array(const gchar *tag, GPtrArray *args);
guint32 e_alert_get_flags (EAlert *alert);
const gchar *e_alert_peek_stock_image (EAlert *alert);
gint e_alert_get_default_response (EAlert *alert);
-gchar *e_alert_get_title (EAlert *alert);
-gchar *e_alert_get_primary_text (EAlert *alert);
-gchar *e_alert_get_secondary_text (EAlert *alert);
+gchar *e_alert_get_title (EAlert *alert, gboolean escaped);
+gchar *e_alert_get_primary_text (EAlert *alert, gboolean escaped);
+gchar *e_alert_get_secondary_text (EAlert *alert, gboolean escaped);
const gchar *e_alert_peek_help_uri (EAlert *alert);
gboolean e_alert_get_scroll (EAlert *alert);
struct _e_alert_button *e_alert_peek_buttons (EAlert *alert);