[evolution-patches] patch for #59904



This avoids running queries for individual objects (that is, so we don't
call get_object_list for each object when expanding recurrences)
-- 
Rodrigo Moya <rodrigo novell com>
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.324.2.5
diff -u -p -r1.324.2.5 ChangeLog
--- ChangeLog	28 Sep 2004 15:57:45 -0000	1.324.2.5
+++ ChangeLog	29 Sep 2004 13:51:17 -0000
@@ -1,3 +1,10 @@
+2004-09-29  Rodrigo Moya <rodrigo novell com>
+
+	Fixes #59904
+
+	* libecal/e-cal.c (generate_instances): if we have an UID, don't run a
+	query, get the object directly.
+
 2004-09-28  Rodrigo Moya <rodrigo novell com>
 
 	Fixes #66230
Index: libecal/e-cal.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal.c,v
retrieving revision 1.75.2.2
diff -u -p -r1.75.2.2 e-cal.c
--- libecal/e-cal.c	24 Sep 2004 14:24:03 -0000	1.75.2.2
+++ libecal/e-cal.c	29 Sep 2004 13:51:19 -0000
@@ -2883,30 +2883,45 @@ generate_instances (ECal *ecal, time_t s
 
 	priv = ecal->priv;
 
-	iso_start = isodate_from_time_t (start);
-	if (!iso_start)
-		return;
+	/* Generate objects */
+	if (uid && *uid) {
+		icalcomponent *icalcomp;
+		ECalComponent *comp;
 
-	iso_end = isodate_from_time_t (end);
-	if (!iso_end) {
-		g_free (iso_start);
-		return;
-	}
+		if (!e_cal_get_object (ecal, uid, NULL, &icalcomp, NULL))
+			return;
+
+		comp = e_cal_component_new ();
+		if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
+			g_object_unref (comp);
+			icalcomponent_free (icalcomp);
+			return;
+		}
+
+		objects = g_list_append (NULL, comp);
+	} else {
+		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;
+		}
 
-	/* Generate objects */
-	if (uid && *uid)
-		query = g_strdup_printf ("(and (occur-in-time-range? (make-time \"%s\") (make-time \"%s\")) (uid? \"%s\"))",
-					 iso_start, iso_end, uid);
-	else
 		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 (iso_start);
+		g_free (iso_end);
+
+		if (!e_cal_get_object_list_as_comp (ecal, query, &objects, NULL)) {
+			g_free (query);
+			return;
+		}
 		g_free (query);
-		return;
-	}	
-	g_free (query);
+	}
 
 	instances = NULL;
 


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