aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2003-03-18 22:17:16 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2003-03-18 22:17:16 +0800
commitb2da9f93edf316bbd6103c7635e1451305bac942 (patch)
tree702b4391fafc287c99d03fa8b1743cca06067018 /calendar/gui
parentef8e2ea6e20209bbdbac1d2944e9027a6c37a0cb (diff)
downloadgsoc2013-evolution-b2da9f93edf316bbd6103c7635e1451305bac942.tar.gz
gsoc2013-evolution-b2da9f93edf316bbd6103c7635e1451305bac942.tar.zst
gsoc2013-evolution-b2da9f93edf316bbd6103c7635e1451305bac942.zip
Fixes #34505
2003-03-18 Rodrigo Moya <rodrigo@ximian.com> Fixes #34505 * gui/alarm-notify/alarm-queue.c (remove_queued_alarm): added removal of the alarm itself in the calendar if the (new) argument says so. Also, set expecting_update flag to TRUE. (add_component_alarms): initialize expecting_update to FALSE. (remove_alarms): don't remove the component if expecting_update is TRUE. (obj_updated_cb, notify_dialog_cb, procedure_notification): adapted to changes in remove_queued_alarm. svn path=/trunk/; revision=20335
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index 58f3429ab6..fc52172851 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -22,6 +22,7 @@
#include <config.h>
#endif
+#include <string.h>
#include <glib.h>
#include <bonobo-activation/bonobo-activation.h>
#include <bonobo/bonobo-object.h>
@@ -86,6 +87,9 @@ typedef struct {
/* List of QueuedAlarm structures */
GSList *queued_alarms;
+
+ /* Flags */
+ gboolean expecting_update;
} CompQueuedAlarms;
/* Pair of a queued alarm ID and the alarm trigger instance it refers to */
@@ -192,7 +196,8 @@ lookup_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id)
* the last one listed for the component, it removes the component itself.
*/
static void
-remove_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id, gboolean free_object)
+remove_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id,
+ gboolean free_object, gboolean remove_alarm)
{
QueuedAlarm *qa;
const char *uid;
@@ -212,6 +217,13 @@ remove_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id, gboolean free_obj
cqa->queued_alarms = g_slist_remove_link (cqa->queued_alarms, l);
g_slist_free_1 (l);
+ if (remove_alarm) {
+ cal_component_remove_alarm (cqa->alarms->comp, qa->instance->auid);
+ cqa->expecting_update = TRUE;
+ cal_client_update_object (cqa->parent_client->client, cqa->alarms->comp);
+ cqa->expecting_update = FALSE;
+ }
+
g_free (qa);
/* If this was the last queued alarm for this component, remove the
@@ -307,6 +319,7 @@ add_component_alarms (ClientAlarms *ca, CalComponentAlarms *alarms)
cqa = g_new (CompQueuedAlarms, 1);
cqa->parent_client = ca;
cqa->alarms = alarms;
+ cqa->expecting_update = FALSE;
cqa->queued_alarms = NULL;
@@ -442,7 +455,7 @@ remove_alarms (CompQueuedAlarms *cqa, gboolean free_object)
l = l->next;
alarm_remove (qa->alarm_id);
- remove_queued_alarm (cqa, qa->alarm_id, free_object);
+ remove_queued_alarm (cqa, qa->alarm_id, free_object, FALSE);
}
}
@@ -532,9 +545,10 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data)
cqa->queued_alarms = g_slist_prepend (cqa->queued_alarms, qa);
}
- if (cqa->queued_alarms == NULL)
- remove_comp (ca, uid);
- else
+ if (cqa->queued_alarms == NULL) {
+ if (!cqa->expecting_update)
+ remove_comp (ca, uid);
+ } else
cqa->queued_alarms = g_slist_reverse (cqa->queued_alarms);
}
}
@@ -704,7 +718,7 @@ notify_dialog_cb (AlarmNotifyResult result, int snooze_mins, gpointer data)
}
if (c->cqa != NULL)
- remove_queued_alarm (c->cqa, c->alarm_id, TRUE);
+ remove_queued_alarm (c->cqa, c->alarm_id, TRUE, TRUE);
g_object_unref (c->comp);
g_object_unref (c->client);
g_free (c);
@@ -941,7 +955,7 @@ procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id
if (result < 0)
goto fallback;
- remove_queued_alarm (cqa, alarm_id, TRUE);
+ remove_queued_alarm (cqa, alarm_id, TRUE, TRUE);
return;
fallback: