aboutsummaryrefslogtreecommitdiffstats
path: root/my-evolution/e-summary-tasks.c
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2001-07-19 05:39:20 +0800
committerIain Holmes <iain@src.gnome.org>2001-07-19 05:39:20 +0800
commita715797c0228dba3bae20a3f8ae1d796a90f1f34 (patch)
tree4dcdbd69eaed0a718b0b26a8e24823121908e97a /my-evolution/e-summary-tasks.c
parenta5ae0cd4770257bd7fae678f46396d4248460e85 (diff)
downloadgsoc2013-evolution-a715797c0228dba3bae20a3f8ae1d796a90f1f34.tar
gsoc2013-evolution-a715797c0228dba3bae20a3f8ae1d796a90f1f34.tar.gz
gsoc2013-evolution-a715797c0228dba3bae20a3f8ae1d796a90f1f34.tar.bz2
gsoc2013-evolution-a715797c0228dba3bae20a3f8ae1d796a90f1f34.tar.lz
gsoc2013-evolution-a715797c0228dba3bae20a3f8ae1d796a90f1f34.tar.xz
gsoc2013-evolution-a715797c0228dba3bae20a3f8ae1d796a90f1f34.tar.zst
gsoc2013-evolution-a715797c0228dba3bae20a3f8ae1d796a90f1f34.zip
Make the Tasks option work
svn path=/trunk/; revision=11212
Diffstat (limited to 'my-evolution/e-summary-tasks.c')
-rw-r--r--my-evolution/e-summary-tasks.c62
1 files changed, 57 insertions, 5 deletions
diff --git a/my-evolution/e-summary-tasks.c b/my-evolution/e-summary-tasks.c
index 41ce94704c..8e75245f38 100644
--- a/my-evolution/e-summary-tasks.c
+++ b/my-evolution/e-summary-tasks.c
@@ -114,18 +114,17 @@ sort_uids (gconstpointer a,
gpointer user_data)
{
CalComponent *comp_a, *comp_b;
- ESummary *summary = user_data;
- ESummaryTasks *tasks = summary->tasks;
+ CalClient *client = user_data;
CalClientGetStatus status;
CalComponentDateTime start_a, start_b;
/* a after b then return > 0 */
- status = cal_client_get_object (tasks->client, a, &comp_a);
+ status = cal_client_get_object (client, a, &comp_a);
if (status != CAL_CLIENT_GET_SUCCESS)
return -1;
- status = cal_client_get_object (tasks->client, b, &comp_b);
+ status = cal_client_get_object (client, b, &comp_b);
if (status != CAL_CLIENT_GET_SUCCESS)
return 1;
@@ -135,6 +134,50 @@ sort_uids (gconstpointer a,
return icaltime_compare (*start_a.value, *start_b.value);
}
+static GList *
+get_todays_uids (CalClient *client,
+ GList *uids)
+{
+ GList *today = NULL, *p;
+ time_t todays_end, todays_start;
+
+ todays_start = time_day_begin (time (NULL));
+ todays_end = time_day_end (time (NULL));
+
+ for (p = uids; p; p = p->next) {
+ char *uid;
+ CalComponent *comp;
+ CalClientGetStatus status;
+ CalComponentDateTime end;
+ time_t endt;
+
+ uid = p->data;
+ status = cal_client_get_object (client, uid, &comp);
+ if (status != CAL_CLIENT_GET_SUCCESS) {
+ continue;
+ }
+
+ cal_component_get_dtend (comp, &end);
+ if (end.value != 0) {
+ endt = icaltime_as_timet (*end.value);
+
+ if (endt >= todays_start && endt <= todays_end) {
+ today = g_list_append (today, g_strdup (uid));
+ }
+ g_print ("Check da mic\n");
+ } else {
+ g_print ("Duff\n");
+ }
+ }
+
+ if (today == NULL) {
+ return NULL;
+ }
+
+ today = cal_list_sort (today, sort_uids, client);
+ return today;
+}
+
static gboolean
generate_html (gpointer data)
{
@@ -150,6 +193,15 @@ generate_html (gpointer data)
day_end = time_day_end (t);
uids = cal_client_get_uids (tasks->client, CALOBJ_TYPE_TODO);
+ if (summary->preferences->show_tasks == E_SUMMARY_CALENDAR_TODAYS_TASKS && uids != NULL) {
+ GList *tmp;
+
+ tmp = get_todays_uids (tasks->client, uids);
+ cal_obj_uid_list_free (uids);
+
+ uids = tmp;
+ }
+
if (uids == NULL) {
char *s1, *s2;
@@ -285,7 +337,7 @@ e_summary_tasks_init (ESummary *summary)
void
e_summary_tasks_reconfigure (ESummary *summary)
{
-
+ generate_html (summary);
}
void