Re: [evolution-patches] patch for adding 'has-alarms-in-range' function to the SEXP language (calendar)



On Wed, 2004-08-18 at 13:46 +0200, Rodrigo Moya wrote:
> This adds the 'has-alarms-in-range' function, which will be used by the
> alarm daemon

attached is the alarm daemon part of this fix
-- 
Rodrigo Moya <rodrigo novell com>
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2490
diff -u -p -r1.2490 ChangeLog
--- ChangeLog	18 Aug 2004 14:42:19 -0000	1.2490
+++ ChangeLog	19 Aug 2004 14:11:17 -0000
@@ -1,3 +1,32 @@
+2004-08-19  Rodrigo Moya <rodrigo novell com>
+
+	* gui/alarm-notify/alarm-queue.c (load_alarms): use the
+	new 'has-alarms-in-range' query.
+
 2004-08-18  Sivaiah Nallagatla <snallagatla novell com>
 
 	* gui/alarm-notify/alarm-notify.c (alarm-notify_init) :
Index: gui/alarm-notify/alarm-queue.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/alarm-notify/alarm-queue.c,v
retrieving revision 1.69
diff -u -p -r1.69 alarm-queue.c
--- gui/alarm-notify/alarm-queue.c	10 Aug 2004 14:14:43 -0000	1.69
+++ gui/alarm-notify/alarm-queue.c	19 Aug 2004 14:11:18 -0000
@@ -390,20 +390,38 @@ load_alarms (ClientAlarms *ca, time_t st
 {
 	/* 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);
 	}
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]