diff options
author | Milan Crha <mcrha@src.gnome.org> | 2007-08-02 19:12:39 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2007-08-02 19:12:39 +0800 |
commit | dd734afc66b781ac1ac5fb15ef4a4207ad04eb6a (patch) | |
tree | 017a70d0edaa7a0d87ff7f112ad19b9e52aebac3 /calendar/gui | |
parent | 0c7f584760ab79d65f52a40844c10fed1564f1f5 (diff) | |
download | gsoc2013-evolution-dd734afc66b781ac1ac5fb15ef4a4207ad04eb6a.tar.gz 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/gui')
-rw-r--r-- | calendar/gui/alarm-notify/alarm-queue.c | 45 |
1 files changed, 45 insertions, 0 deletions
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)))); |