aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-alert.c
diff options
context:
space:
mode:
authorJonathon Jongsma <jonathon@quotidian.org>2009-12-09 00:58:00 +0800
committerJonathon Jongsma <jonathon@quotidian.org>2009-12-09 01:00:00 +0800
commit5cdf3c8797a3a68d062a65f45c464a7c6e581c9e (patch)
treedd2a7f082951accd4bffe57a30ad50a1f8386a07 /e-util/e-alert.c
parent2fa4ec1334a90d22c9a54d150d6e4722be9bfe1c (diff)
downloadgsoc2013-evolution-5cdf3c8797a3a68d062a65f45c464a7c6e581c9e.tar.gz
gsoc2013-evolution-5cdf3c8797a3a68d062a65f45c464a7c6e581c9e.tar.zst
gsoc2013-evolution-5cdf3c8797a3a68d062a65f45c464a7c6e581c9e.zip
Handle the case where error definitions don't include certain fields
Some error definitions don't specify a title or secondary text. Handle these situations properly. This was a regression caused by my refactoring. Fixes bug #604085.
Diffstat (limited to 'e-util/e-alert.c')
-rw-r--r--e-util/e-alert.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/e-util/e-alert.c b/e-util/e-alert.c
index ff8801ff9e..bc116f07ef 100644
--- a/e-util/e-alert.c
+++ b/e-util/e-alert.c
@@ -608,8 +608,11 @@ e_alert_get_title (EAlert *alert)
g_return_val_if_fail (alert && alert->priv && alert->priv->definition, NULL);
formatted = g_string_new ("");
- e_alert_format_string (formatted, alert->priv->definition->title,
- alert->priv->args, FALSE);
+ if (alert->priv->definition->title) {
+ e_alert_format_string (formatted,
+ alert->priv->definition->title,
+ alert->priv->args, FALSE);
+ }
return g_string_free (formatted, FALSE);
}
@@ -621,8 +624,15 @@ e_alert_get_primary_text (EAlert *alert)
formatted = g_string_new ("");
if (alert->priv->definition)
- e_alert_format_string (formatted, alert->priv->definition->primary,
- alert->priv->args, FALSE);
+ if (alert->priv->definition->primary) {
+ e_alert_format_string (formatted,
+ alert->priv->definition->primary,
+ alert->priv->args, FALSE);
+ } else {
+ char *title = e_alert_get_title (alert);
+ g_string_append (formatted, title);
+ g_free (title);
+ }
else {
g_string_append_printf(formatted,
_("Internal error, unknown error '%s' requested"),
@@ -639,8 +649,11 @@ e_alert_get_secondary_text (EAlert *alert)
g_return_val_if_fail (alert && alert->priv && alert->priv->definition, NULL);
formatted = g_string_new ("");
- e_alert_format_string (formatted, alert->priv->definition->secondary,
- alert->priv->args, TRUE);
+ if (alert->priv->definition->secondary) {
+ e_alert_format_string (formatted,
+ alert->priv->definition->secondary,
+ alert->priv->args, TRUE);
+ }
return g_string_free (formatted, FALSE);
}