aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@novell.com>2004-08-28 02:12:26 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2004-08-28 02:12:26 +0800
commit66398c9e17e3fbe53d429e79fab1fd1e1bbe99fc (patch)
tree28a449706eeef816255cb416e16984c3495e84ec
parent5c2e292a57bbdd2465f1580d6fa9401b6a8b614a (diff)
downloadgsoc2013-evolution-66398c9e17e3fbe53d429e79fab1fd1e1bbe99fc.tar.gz
gsoc2013-evolution-66398c9e17e3fbe53d429e79fab1fd1e1bbe99fc.tar.zst
gsoc2013-evolution-66398c9e17e3fbe53d429e79fab1fd1e1bbe99fc.zip
use the new 'has-alarms-in-range' query. (alarm_queue_add_client): make
2004-08-27 Rodrigo Moya <rodrigo@novell.com> * gui/alarm-notify/alarm-queue.c (load_alarms): use the new 'has-alarms-in-range' query. (alarm_queue_add_client): make sure we don't add twice the same alarm. svn path=/trunk/; revision=27044
-rw-r--r--calendar/ChangeLog6
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c47
2 files changed, 38 insertions, 15 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 47f87e44ff..f36910bb57 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,9 @@
+2004-08-27 Rodrigo Moya <rodrigo@novell.com>
+
+ * gui/alarm-notify/alarm-queue.c (load_alarms): use the
+ new 'has-alarms-in-range' query.
+ (alarm_queue_add_client): make sure we don't add twice the same alarm.
+
2004-08-27 JP Rosevear <jpr@novell.com>
Fixes #62911, #54101
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index 08d3033dcb..433f121e55 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -390,20 +390,38 @@ load_alarms (ClientAlarms *ca, time_t start, time_t end)
{
/* create the live query */
if (!ca->query) {
- /* FIXME: handle errors */
- if (!e_cal_get_query (ca->client, "(has-alarms?)", &ca->query, NULL)) {
- g_warning (G_STRLOC ": Could not get query for client");
+ char *str_query, *iso_start, *iso_end;
+
+ iso_start = isodate_from_time_t (start);
+ if (!iso_start)
+ return;
+
+ iso_end = isodate_from_time_t (end);
+ if (!iso_end) {
+ g_free (iso_start);
return;
}
- g_signal_connect (G_OBJECT (ca->query), "objects_added",
- G_CALLBACK (query_objects_changed_cb), ca);
- g_signal_connect (G_OBJECT (ca->query), "objects_modified",
- G_CALLBACK (query_objects_changed_cb), ca);
- g_signal_connect (G_OBJECT (ca->query), "objects_removed",
- G_CALLBACK (query_objects_removed_cb), ca);
+ str_query = g_strdup_printf ("(has-alarms-in-range? (make-time \"%s\") (make-time \"%s\"))",
+ iso_start, iso_end);
+ g_free (iso_start);
+ g_free (iso_end);
+
+ /* FIXME: handle errors */
+ if (!e_cal_get_query (ca->client, str_query, &ca->query, NULL)) {
+ g_warning (G_STRLOC ": Could not get query for client");
+ } else {
+ g_signal_connect (G_OBJECT (ca->query), "objects_added",
+ G_CALLBACK (query_objects_changed_cb), ca);
+ g_signal_connect (G_OBJECT (ca->query), "objects_modified",
+ G_CALLBACK (query_objects_changed_cb), ca);
+ g_signal_connect (G_OBJECT (ca->query), "objects_removed",
+ G_CALLBACK (query_objects_removed_cb), ca);
+
+ e_cal_view_start (ca->query);
+ }
- e_cal_view_start (ca->query);
+ g_free (str_query);
}
}
@@ -1292,14 +1310,13 @@ alarm_queue_add_client (ECal *client)
ca->uid_alarms_hash = g_hash_table_new (g_str_hash, g_str_equal);
- if (e_cal_get_load_state (client) != E_CAL_LOAD_LOADED)
+ if (e_cal_get_load_state (client) != E_CAL_LOAD_LOADED) {
+ load_alarms_for_today (ca);
+ load_missed_alarms (ca);
+ } else {
g_signal_connect (client, "cal_opened",
G_CALLBACK (cal_opened_cb),
ca);
-
- if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED) {
- load_alarms_for_today (ca);
- load_missed_alarms (ca);
}
}