aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMilan Crha <mcrha@src.gnome.org>2007-08-02 19:12:39 +0800
committerMilan Crha <mcrha@src.gnome.org>2007-08-02 19:12:39 +0800
commitdd734afc66b781ac1ac5fb15ef4a4207ad04eb6a (patch)
tree017a70d0edaa7a0d87ff7f112ad19b9e52aebac3 /calendar
parent0c7f584760ab79d65f52a40844c10fed1564f1f5 (diff)
downloadgsoc2013-evolution-dd734afc66b781ac1ac5fb15ef4a4207ad04eb6a.tar
gsoc2013-evolution-dd734afc66b781ac1ac5fb15ef4a4207ad04eb6a.tar.gz
gsoc2013-evolution-dd734afc66b781ac1ac5fb15ef4a4207ad04eb6a.tar.bz2
gsoc2013-evolution-dd734afc66b781ac1ac5fb15ef4a4207ad04eb6a.tar.lz
gsoc2013-evolution-dd734afc66b781ac1ac5fb15ef4a4207ad04eb6a.tar.xz
gsoc2013-evolution-dd734afc66b781ac1ac5fb15ef4a4207ad04eb6a.tar.zst
gsoc2013-evolution-dd734afc66b781ac1ac5fb15ef4a4207ad04eb6a.zip
2007-08-02 mcrha Fix for bug #322624
svn path=/trunk/; revision=33927
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog8
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c45
2 files changed, 53 insertions, 0 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index e85059c2c6..946b2eed06 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,11 @@
+2007-08-02 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #322624
+
+ * gui/alarm-notify/alarm-queue.c: (has_known_notification),
+ (add_component_alarms), (query_objects_changed_async):
+ Don't add alarms for types with unknown/none notification method.
+
2007-07-31 Matthew Barnes <mbarnes@redhat.com>
* common/authentication.c: Include <libedataserver/e-source.h>
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index 01c7d7d7f6..06d1d3b4cd 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -341,6 +341,41 @@ remove_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id,
return TRUE;
}
+/**
+ * has_known_notification:
+ * Test for notification method and returns if it knows it or not.
+ * @param comp Component with an alarm.
+ * @param alarm_uid ID of the alarm in the comp to test.
+ * @return TRUE when we know the notification type, FALSE otherwise.
+ */
+static gboolean
+has_known_notification (ECalComponent *comp, const gchar *alarm_uid)
+{
+ ECalComponentAlarm *alarm;
+ ECalComponentAlarmAction action;
+
+ g_return_val_if_fail (comp != NULL, FALSE);
+ g_return_val_if_fail (alarm_uid != NULL, FALSE);
+
+ alarm = e_cal_component_get_alarm (comp, alarm_uid);
+ if (!alarm)
+ return FALSE;
+
+ e_cal_component_alarm_get_action (alarm, &action);
+ e_cal_component_alarm_free (alarm);
+
+ switch (action) {
+ case E_CAL_COMPONENT_ALARM_AUDIO:
+ case E_CAL_COMPONENT_ALARM_DISPLAY:
+ case E_CAL_COMPONENT_ALARM_EMAIL:
+ case E_CAL_COMPONENT_ALARM_PROCEDURE:
+ return TRUE;
+ default:
+ break;
+ }
+ return FALSE;
+}
+
/* Callback used when an alarm triggers */
static void
alarm_trigger_cb (gpointer alarm_id, time_t trigger, gpointer data)
@@ -436,6 +471,11 @@ add_component_alarms (ClientAlarms *ca, ECalComponentAlarms *alarms)
instance = l->data;
+ if (!has_known_notification (cqa->alarms->comp, instance->auid)) {
+ g_debug ("Could not recognize alarm's notification type, discarding.");
+ continue;
+ }
+
alarm_id = alarm_add (instance->trigger, alarm_trigger_cb, cqa, NULL);
if (!alarm_id) {
d(printf("%s:%d (add_component_alarms) - Could not schedule a trigger for %s. Discarding \n",__FILE__, __LINE__, ctime(&(instance->trigger))));
@@ -735,6 +775,11 @@ query_objects_changed_async (EThread *e, AlarmMsg *msg, void *data)
instance = sl->data;
+ if (!has_known_notification (cqa->alarms->comp, instance->auid)) {
+ g_debug ("Could not recognize alarm's notification type, discarding.");
+ continue;
+ }
+
alarm_id = alarm_add (instance->trigger, alarm_trigger_cb, cqa, NULL);
if (!alarm_id) {
d(printf("%s:%d (query_objects_changed_async) -Unable to schedule trigger for %s \n",__FILE__, __LINE__, ctime(&(instance->trigger))));