[evolution-patches] Re: [Evolution-hackers] e_cal_get_object_list query



JP Rosevear wrote:
Using l != NULL is inconsistent with the code in the rest of the method,
better just to leave the check the same I think.


OK.

+		e_cal_recur_generate_instances (l->data, start, end, add_instance, &instances,
					      e_cal_resolve_tzid_cb, ecal,
					      priv->default_zone);
-		g_object_unref (G_OBJECT (comp));


Why did you remove the unref?  I believe this is a leak.

Right.

Updated patch attached.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.30
diff -u -r1.30 ChangeLog
--- ChangeLog	1 Dec 2003 19:25:23 -0000	1.30
+++ ChangeLog	1 Dec 2003 21:56:26 -0000
@@ -1,3 +1,8 @@
+2003-12-01  William Jon McCann  <mccann jhu edu>
+ 
+        * libecal/e-cal.c (e_cal_generate_instances): Fix query and
+        get object list as components.
+ 
 2003-12-01  Rodrigo Moya <rodrigo ximian com>
 
 	* libedata-cal/e-cal-backend-cache.[ch]: changed to be based on the
Index: libecal/e-cal.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal.c,v
retrieving revision 1.8
diff -u -r1.8 e-cal.c
--- libecal/e-cal.c	27 Nov 2003 02:30:09 -0000	1.8
+++ libecal/e-cal.c	1 Dec 2003 21:56:32 -0000
@@ -2627,6 +2627,7 @@
 	GList *instances;
 	GList *l;
 	char *query;
+	char *iso_start, *iso_end;
 	
 	g_return_if_fail (ecal != NULL);
 	g_return_if_fail (E_IS_CAL (ecal));
@@ -2638,9 +2639,14 @@
 	g_return_if_fail (start <= end);
 	g_return_if_fail (cb != NULL);
 
+	iso_start = isodate_from_time_t (start);
+	iso_end   = isodate_from_time_t (end);
 	/* Generate objects */
-	query = g_strdup_printf ("(occur-in-time-range? (%lu) (%lu))", start, end);
-	if (!e_cal_get_object_list (ecal, query, &objects, NULL)) {
+	query = g_strdup_printf ("(occur-in-time-range? (make-time \"%s\") (make-time \"%s\"))",
+                                 iso_start, iso_end);
+	g_free (iso_start);
+	g_free (iso_end);
+	if (!e_cal_get_object_list_as_comp (ecal, query, &objects, NULL)) {
 		g_free (query);
 		return;
 	}	
@@ -2649,13 +2655,10 @@
 	instances = NULL;
 
 	for (l = objects; l; l = l->next) {
-		ECalComponent *comp;
-
-		comp = l->data;
-		e_cal_recur_generate_instances (comp, start, end, add_instance, &instances,
-					      e_cal_resolve_tzid_cb, ecal,
-					      priv->default_zone);
-		g_object_unref (G_OBJECT (comp));
+		e_cal_recur_generate_instances (l->data, start, end, add_instance, &instances,
+						e_cal_resolve_tzid_cb, ecal,
+						priv->default_zone);
+		g_object_unref (G_OBJECT (l->data));
 	}
 
 	g_list_free (objects);


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