aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-02-28 23:05:10 -0500
committerKen VanDine <ken.vandine@canonical.com>2011-02-28 23:05:10 -0500
commit2de6f443b603965a7fc786df9ef58fcc63841daf (patch)
tree2fae6d531f4856d67c9ca097190a347ab7b94503
parentb79665734363a3644d3eb7b13a110908ac05d3a1 (diff)
downloadayatana-indicator-datetime-2de6f443b603965a7fc786df9ef58fcc63841daf.tar.gz
ayatana-indicator-datetime-2de6f443b603965a7fc786df9ef58fcc63841daf.tar.bz2
ayatana-indicator-datetime-2de6f443b603965a7fc786df9ef58fcc63841daf.zip
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.
-rw-r--r--src/datetime-service.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 6303a98..078ede0 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -462,8 +462,7 @@ update_appointment_menu_items (gpointer user_data) {
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 @@ update_appointment_menu_items (gpointer user_data) {
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 @@ update_appointment_menu_items (gpointer user_data) {
// 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");