aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-12-04 04:33:01 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:41:07 +0800
commit989c370729b764423d4528b314cb8490c3df2b3d (patch)
tree261c88b43904cd7027aa35de8d4e08a76be6acbc /widgets
parent8e848e505983e5fd61b057b38b862c2cc0781873 (diff)
downloadgsoc2013-evolution-989c370729b764423d4528b314cb8490c3df2b3d.tar
gsoc2013-evolution-989c370729b764423d4528b314cb8490c3df2b3d.tar.gz
gsoc2013-evolution-989c370729b764423d4528b314cb8490c3df2b3d.tar.bz2
gsoc2013-evolution-989c370729b764423d4528b314cb8490c3df2b3d.tar.lz
gsoc2013-evolution-989c370729b764423d4528b314cb8490c3df2b3d.tar.xz
gsoc2013-evolution-989c370729b764423d4528b314cb8490c3df2b3d.tar.zst
gsoc2013-evolution-989c370729b764423d4528b314cb8490c3df2b3d.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);