aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2002-07-29 19:49:27 +0800
committerIain Holmes <iain@src.gnome.org>2002-07-29 19:49:27 +0800
commit568f960447e0cb9b0eb520ae32a8490e2830e072 (patch)
treed51e8ec15c536fb348bd48556f3fe1d5fd7b0f84
parent1c9b6e1fe7456b3ef326fdcddba89c3eb0a9a891 (diff)
downloadgsoc2013-evolution-568f960447e0cb9b0eb520ae32a8490e2830e072.tar.gz
gsoc2013-evolution-568f960447e0cb9b0eb520ae32a8490e2830e072.tar.zst
gsoc2013-evolution-568f960447e0cb9b0eb520ae32a8490e2830e072.zip
Colour the tasks depending on their due date/time
svn path=/trunk/; revision=17628
-rw-r--r--my-evolution/ChangeLog7
-rw-r--r--my-evolution/e-summary-tasks.c56
2 files changed, 59 insertions, 4 deletions
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog
index 61532aaace..e3c41815dc 100644
--- a/my-evolution/ChangeLog
+++ b/my-evolution/ChangeLog
@@ -1,5 +1,12 @@
2002-07-29 Iain Holmes <iain@ximian.com>
+ * e-summary-tasks.c (get_task_colour): Get the colour for a task: Red
+ if overdue, blue if todays task, black otherwise.
+ (generate_html): Get the task colour, and shuffle the HTML around so
+ the colour gets preference over the link.
+
+2002-07-29 Iain Holmes <iain@ximian.com>
+
* Locations: Fixed typo according to bug #18963
* Locations.h: Updated.
diff --git a/my-evolution/e-summary-tasks.c b/my-evolution/e-summary-tasks.c
index 9846d60956..36f8813429 100644
--- a/my-evolution/e-summary-tasks.c
+++ b/my-evolution/e-summary-tasks.c
@@ -209,6 +209,7 @@ get_todays_uids (ESummary *summary,
today = g_list_append (today, g_strdup (uid));
}
}
+
cal_component_free_datetime (&due);
}
@@ -220,6 +221,50 @@ get_todays_uids (ESummary *summary,
return today;
}
+static const char *
+get_task_colour (ESummary *summary,
+ CalClient *client,
+ const char *uid)
+{
+ CalComponent *comp;
+ CalClientGetStatus status;
+ CalComponentDateTime due;
+ icaltimezone *zone;
+ char *ret;
+ time_t end_t, t, todays_start, todays_end;
+
+ t = time (NULL);
+ todays_start = time_day_begin_with_zone (t, summary->tz);
+ todays_end = time_day_end_with_zone (t, summary->tz);
+
+ status = cal_client_get_object (client, uid, &comp);
+ if (status != CAL_CLIENT_GET_SUCCESS) {
+ return "black";
+ }
+
+ cal_component_get_due (comp, &due);
+
+ cal_client_get_timezone (client, due.tzid, &zone);
+ if (due.value != 0) {
+ icaltimezone_convert_time (due.value, zone, summary->tz);
+ end_t = icaltime_as_timet (*due.value);
+
+ if (end_t >= todays_start && end_t <= todays_end) {
+ ret = "blue";
+ } else if (end_t < t) {
+ ret = "red";
+ } else {
+ ret = "black";
+ }
+ } else {
+ ret = "black";
+ }
+
+ cal_component_free_datetime (&due);
+
+ return (const char *)ret;
+}
+
static gboolean
generate_html (gpointer data)
{
@@ -278,7 +323,8 @@ generate_html (gpointer data)
CalComponentText text;
CalClientGetStatus status;
struct icaltimetype *completed;
-
+ const char *colour;
+
uid = l->data;
status = cal_client_get_object (tasks->client, uid, &comp);
if (status != CAL_CLIENT_GET_SUCCESS) {
@@ -287,12 +333,14 @@ generate_html (gpointer data)
cal_component_get_summary (comp, &text);
cal_component_get_completed (comp, &completed);
-
+
+ colour = get_task_colour (summary, tasks->client, uid);
+
if (completed == NULL) {
tmp = g_strdup_printf ("<img align=\"middle\" src=\"task.png\" "
"alt=\"\" width=\"16\" height=\"16\"> &#160; "
- "<font size=\"-1\"><a href=\"tasks:/%s\">%s</a></font><br>",
- uid, text.value ? text.value : _("(No Description)"));
+ "<a href=\"tasks:/%s\"><font size=\"-1\" color=\"%s\">%s</font></a><br>",
+ uid, colour, text.value ? text.value : _("(No Description)"));
} else {
#if 0
tmp = g_strdup_printf ("<img align=\"middle\" src=\"task.xpm\" "