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

Proposed by Ken VanDine
Status: Merged
Approved by: Ted Gould
Approved revision: 50
Merged at revision: 50
Proposed branch: lp:~ken-vandine/indicator-datetime/simplify_cal_query
Merge into: lp:indicator-datetime/0.3
Diff against target: 36 lines (+2/-10)
1 file modified
src/datetime-service.c (+2/-10)
To merge this branch: bzr merge lp:~ken-vandine/indicator-datetime/simplify_cal_query
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+51694@code.launchpad.net

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

  review approve
  merge approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/datetime-service.c'
2--- src/datetime-service.c 2011-02-25 18:36:03 +0000
3+++ src/datetime-service.c 2011-03-01 04:08:54 +0000
4@@ -462,8 +462,7 @@
5 if (calendar == NULL) return FALSE;
6 if (!g_settings_get_boolean(conf, SETTINGS_SHOW_EVENTS_S)) return FALSE;
7
8- time_t t1, t2;
9- gchar *query, *is, *ie, *ad;
10+ gchar *query, *ad;
11 GList *objects = NULL, *l;
12 GList *allobjects = NULL;
13 GSList *g;
14@@ -472,13 +471,6 @@
15 gint width, height;
16 ESourceList * sources = NULL;
17
18- time(&t1);
19- time(&t2);
20- t2 += (time_t) (7 * 24 * 60 * 60); /* 7 days ahead of now */
21-
22- is = isodate_from_time_t(t1);
23- ie = isodate_from_time_t(t2);
24-
25 gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
26
27 /* Remove all of the previous appointments */
28@@ -497,7 +489,7 @@
29 // TODO Remove all highlights from the calendar widget
30
31 // FIXME can we put a limit on the number of results? Or if not complete, or is event/todo? Or sort it by date?
32- query = g_strdup_printf("(occur-in-time-range? (make-time\"%s\") (make-time\"%s\"))", is, ie);
33+ query = g_strdup_printf("(occur-in-time-range? (time-now) (time-add-day (time-now) 7))");
34
35 if (!e_cal_get_sources(&sources, E_CAL_SOURCE_TYPE_EVENT, &gerror)) {
36 g_debug("Failed to get ecal sources\n");

Subscribers

People subscribed via source and target branches