aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-12-04 04:33:01 +0800
committerMilan Crha <mcrha@redhat.com>2010-12-04 04:33:01 +0800
commitab0430a3f37b01f104d8a4556fdb527c0bd92116 (patch)
tree2210ef2d1263ec3ca3dc2f2f88310266cdf9dc74 /widgets
parenta63688f4e72be7b2b93312e4af0403a4a3e0517b (diff)
downloadgsoc2013-evolution-ab0430a3f37b01f104d8a4556fdb527c0bd92116.tar.gz
gsoc2013-evolution-ab0430a3f37b01f104d8a4556fdb527c0bd92116.tar.zst
gsoc2013-evolution-ab0430a3f37b01f104d8a4556fdb527c0bd92116.zip
Show calendar backend errors in an alert sink
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/e-alert-bar.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/widgets/misc/e-alert-bar.c b/widgets/misc/e-alert-bar.c
index cae1bc0172..c20a74e4d0 100644
--- a/widgets/misc/e-alert-bar.c
+++ b/widgets/misc/e-alert-bar.c
@@ -243,13 +243,45 @@ e_alert_bar_new (void)
return g_object_new (E_TYPE_ALERT_BAR, NULL);
}
+struct DuplicateData
+{
+ gboolean found;
+ EAlert *looking_for;
+};
+
+static void
+find_duplicate_cb (gpointer data, gpointer user_data)
+{
+ EAlert *alert = data;
+ struct DuplicateData *dd = user_data;
+
+ g_return_if_fail (alert != NULL);
+ g_return_if_fail (dd != NULL);
+ g_return_if_fail (dd->looking_for != NULL);
+
+ dd->found = dd->found || (
+ e_alert_get_message_type (alert) == e_alert_get_message_type (dd->looking_for) &&
+ g_strcmp0 (e_alert_get_primary_text (alert), e_alert_get_primary_text (dd->looking_for)) == 0 &&
+ g_strcmp0 (e_alert_get_secondary_text (alert), e_alert_get_secondary_text (dd->looking_for)) == 0);
+}
+
void
e_alert_bar_add_alert (EAlertBar *alert_bar,
EAlert *alert)
{
+ struct DuplicateData dd;
+
g_return_if_fail (E_IS_ALERT_BAR (alert_bar));
g_return_if_fail (E_IS_ALERT (alert));
+ dd.found = FALSE;
+ dd.looking_for = alert;
+
+ g_queue_foreach (&alert_bar->priv->alerts, find_duplicate_cb, &dd);
+
+ if (dd.found)
+ return;
+
g_signal_connect (
alert, "response",
G_CALLBACK (alert_bar_response_cb), alert_bar);