← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~ken-vandine/indicator-datetime/simplify_cal_query into lp:indicator-datetime

 

Ken VanDine has proposed merging lp:~ken-vandine/indicator-datetime/simplify_cal_query into lp:indicator-datetime.

Requested reviews:
  Indicator Applet Developers (indicator-applet-developers)

For more details, see:
https://code.launchpad.net/~ken-vandine/indicator-datetime/simplify_cal_query/+merge/51694

Simplify calendar query, we don't need to compute times for the range.  The query system has a built in way to specify a relative range.
-- 
https://code.launchpad.net/~ken-vandine/indicator-datetime/simplify_cal_query/+merge/51694
Your team ayatana-commits is subscribed to branch lp:indicator-datetime.
=== modified file 'src/datetime-service.c'
--- src/datetime-service.c	2011-02-25 18:36:03 +0000
+++ src/datetime-service.c	2011-03-01 04:08:54 +0000
@@ -462,8 +462,7 @@
 	if (calendar == NULL) return FALSE;
 	if (!g_settings_get_boolean(conf, SETTINGS_SHOW_EVENTS_S)) return FALSE;
 	
-	time_t t1, t2;
-	gchar *query, *is, *ie, *ad;
+	gchar *query, *ad;
 	GList *objects = NULL, *l;
 	GList *allobjects = NULL;
 	GSList *g;
@@ -472,13 +471,6 @@
 	gint width, height;
 	ESourceList * sources = NULL;
 	
-	time(&t1);
-	time(&t2);
-	t2 += (time_t) (7 * 24 * 60 * 60); /* 7 days ahead of now */
-
-	is = isodate_from_time_t(t1);
-	ie = isodate_from_time_t(t2);
-	
 	gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
 
 	/* Remove all of the previous appointments */
@@ -497,7 +489,7 @@
 	// TODO Remove all highlights from the calendar widget
 
 	// FIXME can we put a limit on the number of results? Or if not complete, or is event/todo? Or sort it by date?
-	query = g_strdup_printf("(occur-in-time-range? (make-time\"%s\") (make-time\"%s\"))", is, ie);
+	query = g_strdup_printf("(occur-in-time-range? (time-now) (time-add-day (time-now) 7))");
 	
 	if (!e_cal_get_sources(&sources, E_CAL_SOURCE_TYPE_EVENT, &gerror)) {
 		g_debug("Failed to get ecal sources\n");


Follow ups