Re: [evolution-patches] Fix for #264449 [Tasks]



Changed the function names from hide_completed_tasks to
process_completed_tasks since it also shows completed tasks when the
configuration changes. Made this change and committed the patch to
gnome-2-12 and head branches.

thanks, chenthill.

On Sat, 2005-10-01 at 11:42 -0600, Jukaku Mubeen wrote:
> Hi,
> 
> Attached is patch with additional changes.
> 
> Thanks, Mubeen
> 
> On Sat, 2005-10-01 at 13:14 +0000, "Jukaku Mubeen"  wrote:
> > Hi,
> > 
> > Attached is patch with necessary changes.
> > 
> > Thanks, Mubeen
> > 
> > >>> chen <pchenthill novell com> 09/08/05 14:25 PM >>>
> > Hi,
> >     The function hide of tasks should not be present in e-cal-model,
> > probably can be moved to e-calendar-table. We need to get all the
> > objects to be displayed only when the configuration is changed for
> > displaying the completed tasks. This also cover the color change for
> to
> > show the due (for today) and over due tasks.
> > 
> > priv->objects->len - 1);
> > +                       } else {
> > +                               e_table_model_pre_change
> (E_TABLE_MODEL
> > (model));
> > +                               pos = get_position_in_array
> > (priv->objects, comp_data);
> > +                               e_table_model_row_changed
> (E_TABLE_MODEL
> > (model), pos);
> > +                       }
> > +         
> > Is it necessary to emit a row changed signal here ?
> > 
> > thanks, Chenthill.
> > 
> > Mon, 2005-08-29 at 04:53 -0600, Jukaku Mubeen wrote:
> > > Hi,
> > > 
> > > Attached is modified patch to fix the bug.
> > > Changelog explains it all.
> > > 
> > > Thanks,
> > > Mubeen
> > > _______________________________________________
> > > evolution-patches mailing list
> > > evolution-patches lists ximian com
> > > http://lists.ximian.com/mailman/listinfo/evolution-patches
> > 
> _______________________________________________
> Evolution-patches mailing list
> Evolution-patches gnome org
> http://mail.gnome.org/mailman/listinfo/evolution-patches
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2802.2.18
diff -u -p -r1.2802.2.18 ChangeLog
--- ChangeLog	1 Oct 2005 14:55:16 -0000	1.2802.2.18
+++ ChangeLog	1 Oct 2005 17:25:57 -0000
@@ -1,3 +1,26 @@
+2005-10-01  Mubeen Jukaku  <jmubeen novell com>
+
+	Fixes #264449
+	* gui/e-tasks.c: (update_view_cb),
+	(config_process_completed_tasks_changed_cb): Use process_completed_tasks
+	instead of update_view
+	* gui/gnome-cal.c (update_todo_view_cb),
+	(config_process_completed_tasks_changed_cb): ditto
+	* gui/e-calendar-table.[ch]:
+	(e_cal_model_process_completed_tasks): New function to hide
+	completed tasks
+	* gui/calendar-config.[ch]: 
+	(calendar_config_get_process_completed_tasks_sexp): Added a parameter
+	get_completed to get completed or not completed tasks
+	* gui/misc.[ch]: 
+	(get_position_in_array): Moved from gui/e-cal-model.c
+	* gui/e-cal-model.[ch]:
+	(e_cal_model_set_instance_times): Renamed from static function
+	set_instance_times
+	(search_by_uid_and_client): fix for client is NULL
+	* gui/e-cal-model-tasks.[ch]:
+	(e_cal_model_tasks_update_due_tasks): Update due tasks
+
 2005-10-01  Viren.L  <lviren novell com>
 	
 	Fixes #257649
Index: gui/e-tasks.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-tasks.c,v
retrieving revision 1.120.2.1
diff -u -p -r1.120.2.1 e-tasks.c
--- gui/e-tasks.c	29 Sep 2005 12:49:17 -0000	1.120.2.1
+++ gui/e-tasks.c	1 Oct 2005 17:26:17 -0000
@@ -56,6 +56,7 @@
 #include "e-tasks.h"
 #include "common/authentication.h"
 #include "e-cal-menu.h"
+#include "e-cal-model-tasks.h"
 
 
 /* Private part of the GnomeCalendar structure */
@@ -291,7 +292,7 @@ update_view (ETasks *tasks)
 
 	model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
 		
-	if ((new_sexp = calendar_config_get_hide_completed_tasks_sexp()) != NULL) {
+	if ((new_sexp = calendar_config_get_hide_completed_tasks_sexp (FALSE)) != NULL) {
 		real_sexp = g_strdup_printf ("(and %s %s)", new_sexp, priv->sexp);
 		e_cal_model_set_search_query (model, real_sexp);
 		g_free (new_sexp);
@@ -302,10 +303,31 @@ update_view (ETasks *tasks)
 	e_cal_component_preview_clear (E_CAL_COMPONENT_PREVIEW (priv->preview));
 }
 
+static void
+process_completed_tasks (ETasks *tasks, gboolean config_changed)
+{
+	ETasksPrivate *priv;
+	ECalModel *model;
+
+	g_return_if_fail (tasks != NULL);
+	g_return_if_fail (E_IS_TASKS (tasks));
+
+	priv = tasks->priv;
+
+	model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
+
+	e_calendar_table_process_completed_tasks (e_tasks_get_calendar_table (tasks), priv->clients_list, config_changed);
+}
+
 static gboolean
 update_view_cb (ETasks *tasks)
 {	
-	update_view (tasks);
+	ECalModel *model;
+
+	model = e_calendar_table_get_model (E_CALENDAR_TABLE (tasks->priv->tasks_view));
+
+	process_completed_tasks (tasks, FALSE);
+	e_cal_model_tasks_update_due_tasks (E_CAL_MODEL_TASKS (model));
 
 	return TRUE;
 }
@@ -313,7 +335,7 @@ update_view_cb (ETasks *tasks)
 static void
 config_process_completed_tasks_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
 {
-	update_view (data);
+	process_completed_tasks (data, TRUE);
 }
 
 static void
Index: gui/gnome-cal.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.c,v
retrieving revision 1.386.2.1
diff -u -p -r1.386.2.1 gnome-cal.c
--- gui/gnome-cal.c	29 Sep 2005 12:49:17 -0000	1.386.2.1
+++ gui/gnome-cal.c	1 Oct 2005 17:26:42 -0000
@@ -81,6 +81,7 @@
 #include "common/authentication.h"
 #include "e-cal-popup.h"
 #include "e-cal-menu.h"
+#include "e-cal-model-tasks.h"
 
 /* FIXME glib 2.4 and above has this */
 #ifndef G_MAXINT32
@@ -1135,7 +1136,7 @@ update_todo_view (GnomeCalendar *gcal)
 	
 	model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo));
 		
-	if ((sexp = calendar_config_get_hide_completed_tasks_sexp()) != NULL) {
+	if ((sexp = calendar_config_get_hide_completed_tasks_sexp (FALSE)) != NULL) {
 		priv->todo_sexp = g_strdup_printf ("(and %s %s)", sexp, priv->sexp);
 		e_cal_model_set_search_query (model, priv->todo_sexp);
 		g_free (sexp);
@@ -1146,10 +1147,28 @@ update_todo_view (GnomeCalendar *gcal)
 	
 }
 
+static void
+process_completed_tasks (GnomeCalendar *gcal, gboolean config_changed)
+{
+	GnomeCalendarPrivate *priv;
+
+	g_return_if_fail (gcal != NULL);
+	g_return_if_fail (GNOME_IS_CALENDAR(gcal));
+
+	priv = gcal->priv;
+
+	e_calendar_table_process_completed_tasks (E_CALENDAR_TABLE (priv->todo), priv->clients_list[E_CAL_SOURCE_TYPE_TODO], config_changed);
+}
+
 static gboolean
 update_todo_view_cb (GnomeCalendar *gcal)
 {	
-	update_todo_view(gcal);
+	ECalModel *model;
+
+	model = e_calendar_table_get_model (E_CALENDAR_TABLE (gcal->priv->todo));
+
+	process_completed_tasks (gcal, FALSE);
+	e_cal_model_tasks_update_due_tasks (E_CAL_MODEL_TASKS (model));
 
 	return TRUE;
 }
@@ -1172,7 +1191,7 @@ update_marcus_bains_line_cb (GnomeCalend
 static void
 config_process_completed_tasks_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
 {
-	update_todo_view (data);
+	process_completed_tasks (data, TRUE);
 }
 
 static void
Index: gui/e-calendar-table.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-table.c,v
retrieving revision 1.139.2.2
diff -u -p -r1.139.2.2 e-calendar-table.c
--- gui/e-calendar-table.c	30 Sep 2005 16:45:14 -0000	1.139.2.2
+++ gui/e-calendar-table.c	1 Oct 2005 17:27:44 -0000
@@ -55,6 +55,7 @@
 #include "print.h"
 #include <e-util/e-icon-factory.h>
 #include "e-cal-popup.h"
+#include "misc.h"
 
 extern ECompEditorRegistry *comp_editor_registry;
 
@@ -89,6 +90,9 @@ static struct tm e_calendar_table_get_cu
 						    gpointer data);
 static void mark_row_complete_cb (int model_row, gpointer data);
 
+static void hide_completed_rows (ECalModel *model, GList *clients_list, char *hide_sexp, GPtrArray *comp_objects);
+static void show_completed_rows (ECalModel *model, GList *clients_list, char *show_sexp, GPtrArray *comp_objects);
+
 /* Signal IDs */
 enum {
 	USER_CREATED,
@@ -1274,6 +1278,74 @@ e_calendar_table_on_key_press (ETable *t
 	return FALSE;
 }
 
+static void
+hide_completed_rows (ECalModel *model, GList *clients_list, char *hide_sexp, GPtrArray *comp_objects)
+{
+	GList *l, *m, *objects;
+	ECal *client;
+	int pos;
+
+	for (l = clients_list; l != NULL; l = l->next) {
+		client = l->data;
+
+		if (!e_cal_get_object_list (client, hide_sexp, &objects, NULL)) {
+			g_warning (G_STRLOC ": Could not get the objects");
+
+			continue;
+		}
+
+		for (m = objects; m; m = m->next) {
+			ECalModelComponent *comp_data;
+
+			if ((comp_data =  e_cal_model_get_component_for_uid (model, icalcomponent_get_uid (m->data)))) {
+				e_table_model_pre_change (E_TABLE_MODEL (model));
+				pos = get_position_in_array (comp_objects, comp_data);
+				e_table_model_row_deleted (E_TABLE_MODEL (model), pos);
+
+				g_ptr_array_remove (comp_objects, comp_data);
+			}
+		}
+
+		g_list_foreach (objects, (GFunc) icalcomponent_free, NULL);
+		g_list_free (objects);
+	}
+}
+
+static void
+show_completed_rows (ECalModel *model, GList *clients_list, char *show_sexp, GPtrArray *comp_objects)
+{
+	GList *l, *m, *objects;
+	ECal *client;
+
+	for (l = clients_list; l != NULL; l = l->next) {
+		client = l->data;
+
+		if (!e_cal_get_object_list (client, show_sexp, &objects, NULL)) {
+			g_warning (G_STRLOC ": Could not get the objects");
+
+			continue;
+		}
+
+		for (m = objects; m; m = m->next) {
+			ECalModelComponent *comp_data;
+
+			if (!(e_cal_model_get_component_for_uid (model, icalcomponent_get_uid (m->data)))) {
+				e_table_model_pre_change (E_TABLE_MODEL (model));
+				comp_data = g_new0 (ECalModelComponent, 1);
+				comp_data->client = client;
+				comp_data->icalcomp = icalcomponent_new_clone (m->data);
+				e_cal_model_set_instance_times (comp_data,
+						e_cal_model_get_timezone (model));
+				comp_data->dtstart = comp_data->dtend = comp_data->due = comp_data->completed = NULL;
+				comp_data->color = NULL;
+
+				g_ptr_array_add (comp_objects, comp_data);
+				e_table_model_row_inserted (E_TABLE_MODEL (model), comp_objects->len - 1);
+			} 
+		}
+	}
+}
+
 /* Loads the state of the table (headers shown etc.) from the given file. */
 void
 e_calendar_table_load_state	(ECalendarTable *cal_table,
@@ -1384,4 +1456,49 @@ e_calendar_table_set_status_message (ECa
 
                 e_activity_handler_operation_progressing (cal_table->activity_handler, cal_table->activity_id, message, progress);
 	}
+}
+
+/**
+ * e_calendar_table_hide_completed_tasks:
+ * @table: A calendar table model.
+ * @client_list: Clients List
+ *
+ * Hide completed tasks.
+ */
+void
+e_calendar_table_process_completed_tasks (ECalendarTable *table, GList *clients_list, gboolean config_changed)
+{
+	ECalModel *model;
+	static GMutex *mutex = NULL;
+	char *hide_sexp, *show_sexp;
+	GPtrArray *comp_objects = NULL;
+
+	if (!mutex)
+		mutex = g_mutex_new ();
+
+	g_mutex_lock (mutex);
+
+	model = e_calendar_table_get_model (table); 
+	comp_objects = e_cal_model_get_object_array (model);
+
+	hide_sexp = calendar_config_get_hide_completed_tasks_sexp (TRUE);
+	show_sexp = calendar_config_get_hide_completed_tasks_sexp (FALSE);
+
+	/* If hide option is unchecked */
+	if (!(hide_sexp && show_sexp))
+		show_sexp = g_strdup ("(is-completed?)");
+
+	/* Delete rows from model*/
+	if (hide_sexp) {
+		hide_completed_rows (model, clients_list, hide_sexp, comp_objects);
+	}
+
+	/* Insert rows into model */
+	if (config_changed) {
+		show_completed_rows (model, clients_list, show_sexp, comp_objects);
+	}
+
+	g_free (hide_sexp);
+	g_free (show_sexp);
+	g_mutex_unlock (mutex);
 }
Index: gui/e-calendar-table.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-table.h,v
retrieving revision 1.28
diff -u -p -r1.28 e-calendar-table.h
--- gui/e-calendar-table.h	25 Jul 2005 07:53:18 -0000	1.28
+++ gui/e-calendar-table.h	1 Oct 2005 17:29:02 -0000
@@ -108,6 +108,7 @@ void 	   e_calendar_table_open_task (ECa
 				       ECalModelComponent *comp_data, 
 				       gboolean assign);
 ECalModelComponent * e_calendar_table_get_selected_comp (ECalendarTable *cal_table);
+void e_calendar_table_hide_completed_tasks (ECalendarTable *table, GList *clients_list, gboolean config_changed);
 
 G_END_DECLS
 
Index: gui/calendar-config.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config.c,v
retrieving revision 1.77
diff -u -p -r1.77 calendar-config.c
--- gui/calendar-config.c	13 Jul 2005 10:36:14 -0000	1.77
+++ gui/calendar-config.c	1 Oct 2005 17:29:28 -0000
@@ -1077,11 +1077,13 @@ calendar_config_set_default_reminder_uni
 /**
  * calendar_config_get_hide_completed_tasks_sexp:
  *
+ * @get_completed: Whether to form subexpression that 
+ * gets completed or not completed tasks.
  * Returns the subexpression to use to filter out completed tasks according
  * to the config settings. The returned sexp should be freed.
  **/
 char*
-calendar_config_get_hide_completed_tasks_sexp (void)
+calendar_config_get_hide_completed_tasks_sexp (gboolean get_completed)
 {
 	char *sexp = NULL;
 
@@ -1094,8 +1096,11 @@ calendar_config_get_hide_completed_tasks
 
 		if (value == 0) {
 			/* If the value is 0, we want to hide completed tasks
-			   immediately, so we filter out all completed tasks.*/
-			sexp = g_strdup ("(not is-completed?)");
+			   immediately, so we filter out all complete/incomplete tasks.*/
+			if (!get_completed)
+				sexp = g_strdup ("(not is-completed?)");
+			else
+				sexp = g_strdup ("(is-completed?)");
 		} else {
 			char *isodate;
 			icaltimezone *zone;
@@ -1126,7 +1131,10 @@ calendar_config_get_hide_completed_tasks
 			/* Convert the time to an ISO date string, and build
 			   the query sub-expression. */
 			isodate = isodate_from_time_t (t);
-			sexp = g_strdup_printf ("(not (completed-before? (make-time \"%s\")))", isodate);
+			if (!get_completed)
+				sexp = g_strdup_printf ("(not (completed-before? (make-time \"%s\")))", isodate);
+			else
+				sexp = g_strdup_printf ("(completed-before? (make-time \"%s\"))", isodate);
 		}
 	}
 
Index: gui/calendar-config.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config.h,v
retrieving revision 1.39
diff -u -p -r1.39 calendar-config.h
--- gui/calendar-config.h	30 May 2005 09:14:26 -0000	1.39
+++ gui/calendar-config.h	1 Oct 2005 17:30:23 -0000
@@ -183,7 +183,7 @@ gint	  calendar_config_get_hide_complete
 void	  calendar_config_set_hide_completed_tasks_value(gint		value);
 guint	  calendar_config_add_notification_hide_completed_tasks_value (GConfClientNotifyFunc func, gpointer data);
 
-char*	  calendar_config_get_hide_completed_tasks_sexp (void);
+char *	  calendar_config_get_hide_completed_tasks_sexp (gboolean get_completed);
 
 /* Confirmation options */
 gboolean  calendar_config_get_confirm_delete (void);
Index: gui/misc.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/misc.c,v
retrieving revision 1.4
diff -u -p -r1.4 misc.c
--- gui/misc.c	17 Jan 2005 13:39:19 -0000	1.4
+++ gui/misc.c	1 Oct 2005 17:30:55 -0000
@@ -78,3 +78,16 @@ get_uri_without_password (const char *fu
 
 	return uristr;
  }
+
+gint
+get_position_in_array (GPtrArray *objects, gpointer item)
+{
+	gint i;
+
+	for (i = 0; i < objects->len; i++) {
+		if (g_ptr_array_index (objects, i) == item)
+			return i;
+	}
+
+	return -1;
+}
Index: gui/misc.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/misc.h,v
retrieving revision 1.3
diff -u -p -r1.3 misc.h
--- gui/misc.h	9 Dec 2002 21:26:53 -0000	1.3
+++ gui/misc.h	1 Oct 2005 17:31:29 -0000
@@ -26,5 +26,6 @@
 
 gboolean string_is_empty (const char *value);
 char    *get_uri_without_password (const char *uri);
+gint get_position_in_array (GPtrArray *objects, gpointer item);
 
 #endif
Index: gui/e-cal-model.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-model.c,v
retrieving revision 1.61.2.1
diff -u -p -r1.61.2.1 e-cal-model.c
--- gui/e-cal-model.c	30 Sep 2005 13:46:14 -0000	1.61.2.1
+++ gui/e-cal-model.c	1 Oct 2005 17:35:03 -0000
@@ -1259,7 +1259,7 @@ search_by_uid_and_client (ECalModelPriva
 
 			tmp_uid = icalcomponent_get_uid (comp_data->icalcomp);
 			if (tmp_uid && *tmp_uid) {
-				if (comp_data->client == client && !strcmp (uid, tmp_uid))
+				if ((!client || comp_data->client == client) && !strcmp (uid, tmp_uid)) 
 					return comp_data;
 			}
 		}
@@ -1268,19 +1268,6 @@ search_by_uid_and_client (ECalModelPriva
 	return NULL;
 }
 
-static gint
-get_position_in_array (GPtrArray *objects, gpointer item)
-{
-	gint i;
-
-	for (i = 0; i < objects->len; i++) {
-		if (g_ptr_array_index (objects, i) == item)
-			return i;
-	}
-
-	return -1;
-}
-
 typedef struct {
 	ECal *client;
 	ECalView *query;
@@ -1313,21 +1300,6 @@ add_instance_cb (ECalComponent *comp, ti
 	return TRUE;
 }
 
-static void
-set_instance_times (ECalModelComponent *comp_data, icaltimezone *zone)
-{
-	struct icaltimetype recur_time, start_time, end_time;
-
-	recur_time = icalcomponent_get_recurrenceid (comp_data->icalcomp);
-	start_time = icalcomponent_get_dtstart (comp_data->icalcomp);
-	end_time = icalcomponent_get_dtend (comp_data->icalcomp);
-
-	comp_data->instance_start = icaltime_as_timet (start_time);
-
-	comp_data->instance_end = comp_data->instance_start +
-		(icaltime_as_timet (end_time) - icaltime_as_timet (start_time));
-}
-
 /* We do this check since the calendar items are downloaded from the server in the open_method,
    since the default timezone might not be set there */
 static void
@@ -1395,7 +1367,7 @@ e_cal_view_objects_added_cb (ECalView *q
 			comp_data = g_new0 (ECalModelComponent, 1);
 			comp_data->client = g_object_ref (e_cal_view_get_client (query));
 			comp_data->icalcomp = icalcomponent_new_clone (l->data);
-			set_instance_times (comp_data, priv->zone);
+			e_cal_model_set_instance_times (comp_data, priv->zone);
 			comp_data->dtstart = comp_data->dtend = comp_data->due = comp_data->completed = NULL;
 			comp_data->color = NULL;
 
@@ -2094,4 +2066,30 @@ e_cal_model_generate_instances (ECalMode
 		mdata.cb_data = cb_data;
 		e_cal_generate_instances_for_object (comp_data->client, comp_data->icalcomp, start, end, cb, &mdata);
 	}
+}
+
+/**
+ * e_cal_model_get_object_array
+ */
+GPtrArray *
+e_cal_model_get_object_array (ECalModel *model)
+{
+	g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
+
+	return model->priv->objects;
+}
+
+void
+e_cal_model_set_instance_times (ECalModelComponent *comp_data, icaltimezone *zone)
+{
+	struct icaltimetype recur_time, start_time, end_time;
+
+	recur_time = icalcomponent_get_recurrenceid (comp_data->icalcomp);
+	start_time = icalcomponent_get_dtstart (comp_data->icalcomp);
+	end_time = icalcomponent_get_dtend (comp_data->icalcomp);
+
+	comp_data->instance_start = icaltime_as_timet (start_time);
+
+	comp_data->instance_end = comp_data->instance_start +
+		(icaltime_as_timet (end_time) - icaltime_as_timet (start_time));
 }
Index: gui/e-cal-model.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-model.h,v
retrieving revision 1.16
diff -u -p -r1.16 e-cal-model.h
--- gui/e-cal-model.h	2 Jul 2005 14:54:44 -0000	1.16
+++ gui/e-cal-model.h	1 Oct 2005 17:35:39 -0000
@@ -152,6 +152,8 @@ void                e_cal_model_generate
 								time_t               end,
 								ECalRecurInstanceFn  cb,
 								gpointer             cb_data);
+GPtrArray * e_cal_model_get_object_array (ECalModel *model);
+void e_cal_model_set_instance_times (ECalModelComponent *comp_data, icaltimezone *zone);
 
 
 
Index: gui/e-cal-model-tasks.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-model-tasks.c,v
retrieving revision 1.31
diff -u -p -r1.31 e-cal-model-tasks.c
--- gui/e-cal-model-tasks.c	27 Jul 2005 10:53:37 -0000	1.31
+++ gui/e-cal-model-tasks.c	1 Oct 2005 17:36:47 -0000
@@ -1112,3 +1112,31 @@ e_cal_model_tasks_mark_task_complete (EC
 		e_table_model_row_changed (E_TABLE_MODEL (model), model_row);
 	}
 }
+
+/**
+ * e_cal_model_tasks_update_due_tasks
+ */
+void
+e_cal_model_tasks_update_due_tasks (ECalModelTasks *model)
+{
+	gint row, row_count;
+	ECalModelTasksPrivate *priv;
+	ECalModelComponent *comp_data;
+	ECalModelTasksDueStatus status;
+
+	g_return_if_fail (E_IS_CAL_MODEL_TASKS (model));
+
+	row_count = e_table_model_row_count (E_TABLE_MODEL (model));
+	priv = model->priv;
+
+	for (row = 0; row < row_count; row++)
+	{
+		comp_data = e_cal_model_get_component_at (E_CAL_MODEL (model), row);
+		status = get_due_status (E_CAL_MODEL_TASKS (model), comp_data);
+		if((status == E_CAL_MODEL_TASKS_DUE_TODAY) || (status == E_CAL_MODEL_TASKS_DUE_OVERDUE)) 
+		{
+			e_table_model_pre_change (E_TABLE_MODEL (model));
+			e_table_model_row_changed (E_TABLE_MODEL (model), row);
+		}
+	}
+}
Index: gui/e-cal-model-tasks.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-model-tasks.h,v
retrieving revision 1.3
diff -u -p -r1.3 e-cal-model-tasks.h
--- gui/e-cal-model-tasks.h	9 Aug 2003 09:01:35 -0000	1.3
+++ gui/e-cal-model-tasks.h	1 Oct 2005 17:37:08 -0000
@@ -62,6 +62,7 @@ GType           e_cal_model_tasks_get_ty
 ECalModelTasks *e_cal_model_tasks_new (void);
 
 void            e_cal_model_tasks_mark_task_complete (ECalModelTasks *model, gint model_row);
+void e_cal_model_tasks_update_due_tasks (ECalModelTasks *model);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]