[evolution-patches] 56898 Tasks



This patch implements the hide deleted tasks functionality that is
missing. See attached patch for details.

-Gary
? 52271.patch
? 56628.patch
? 56898.patch
? current.patch
? fb.patch
? fb2.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2257
diff -u -r1.2257 ChangeLog
--- ChangeLog	16 Apr 2004 01:26:55 -0000	1.2257
+++ ChangeLog	16 Apr 2004 04:49:45 -0000
@@ -1,3 +1,18 @@
+2004-04-15  Gary Ekker  <gekker novell com>
+
+	* gui/tasks-component.c: (createControls): Setup callbacks for gconf
+	changes. Add an idle timeout to hide completed items.
+	Add update_view, update_view_cb, and 
+	config_hide_completed_tasks_changed_cb to update the model view.
+
+	* gui/e-tasks.c: (e_tasks_init): Set up the model to use the correct 
+	query.
+
+	* gui/calendar-config.h: Add notifications for hide_completed_tasks
+	settings.
+
+	* gui/calendar-config.c: ditto
+
 2004-04-15 Gary Ekker <gekker novell com>
 
 	Fixes #52271
Index: gui/calendar-config.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config.c,v
retrieving revision 1.68
diff -u -r1.68 calendar-config.c
--- gui/calendar-config.c	7 Apr 2004 16:12:22 -0000	1.68
+++ gui/calendar-config.c	16 Apr 2004 04:49:47 -0000
@@ -613,6 +613,15 @@
 	gconf_client_set_bool (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED, hide, NULL);
 }
 
+guint 
+calendar_config_add_notification_hide_completed_tasks (GConfClientNotifyFunc func, gpointer data)
+{
+	guint id;
+	
+	id = gconf_client_notify_add (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED , func, data, NULL, NULL);
+	
+	return id;	
+}
 
 CalUnits
 calendar_config_get_hide_completed_tasks_units	(void)
@@ -656,6 +665,15 @@
 	g_free (units);
 }
 
+guint 
+calendar_config_add_notification_hide_completed_tasks_units (GConfClientNotifyFunc func, gpointer data)
+{
+	guint id;
+	
+	id = gconf_client_notify_add (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED_UNITS , func, data, NULL, NULL);
+	
+	return id;	
+}
 
 gint
 calendar_config_get_hide_completed_tasks_value	(void)
@@ -668,6 +686,16 @@
 calendar_config_set_hide_completed_tasks_value	(gint		value)
 {
 	gconf_client_set_int (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED_VALUE, value, NULL);
+}
+
+guint 
+calendar_config_add_notification_hide_completed_tasks_value (GConfClientNotifyFunc func, gpointer data)
+{
+	guint id;
+	
+	id = gconf_client_notify_add (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED_VALUE , func, data, NULL, NULL);
+	
+	return id;	
 }
 
 /**
Index: gui/calendar-config.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config.h,v
retrieving revision 1.33
diff -u -r1.33 calendar-config.h
--- gui/calendar-config.h	7 Apr 2004 16:12:22 -0000	1.33
+++ gui/calendar-config.h	16 Apr 2004 04:49:48 -0000
@@ -173,12 +173,15 @@
 /* Settings to hide completed tasks. */
 gboolean  calendar_config_get_hide_completed_tasks	(void);
 void	  calendar_config_set_hide_completed_tasks	(gboolean	hide);
+guint	  calendar_config_add_notification_hide_completed_tasks (GConfClientNotifyFunc func, gpointer data);
 
 CalUnits  calendar_config_get_hide_completed_tasks_units(void);
 void	  calendar_config_set_hide_completed_tasks_units(CalUnits	units);
+guint	  calendar_config_add_notification_hide_completed_tasks_units (GConfClientNotifyFunc func, gpointer data);
 
 gint	  calendar_config_get_hide_completed_tasks_value(void);
 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);
 
Index: gui/e-tasks.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-tasks.c,v
retrieving revision 1.84
diff -u -r1.84 e-tasks.c
--- gui/e-tasks.c	9 Apr 2004 15:56:21 -0000	1.84
+++ gui/e-tasks.c	16 Apr 2004 04:49:50 -0000
@@ -646,6 +646,7 @@
 {
 	ETasksPrivate *priv;
 	ECalModel *model;
+	char *sexp = NULL;
 	
 	priv = g_new0 (ETasksPrivate, 1);
 	tasks->priv = priv;
@@ -660,7 +661,12 @@
 	priv->current_uid = NULL;
 
 	model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
-	e_cal_model_set_search_query (model, "#t");
+	
+	if ((sexp = calendar_config_get_hide_completed_tasks_sexp()) != NULL) {
+		e_cal_model_set_search_query (model, sexp);
+		g_free (sexp);
+	} else
+		e_cal_model_set_search_query (model, "#t");
 }
 
 /* Callback used when the set of categories changes in the calendar client */
Index: gui/tasks-component.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/tasks-component.c,v
retrieving revision 1.60
diff -u -r1.60 tasks-component.c
--- gui/tasks-component.c	14 Apr 2004 05:40:01 -0000	1.60
+++ gui/tasks-component.c	16 Apr 2004 04:49:54 -0000
@@ -232,6 +232,32 @@
 	}
 }
 
+static void
+update_view (TasksComponent *component)
+{
+	TasksComponentPrivate *priv;
+	ECalModel *model;
+	char *sexp = NULL;
+	
+	priv = component->priv;
+	
+	model = e_calendar_table_get_model (E_CALENDAR_TABLE (e_tasks_get_calendar_table (priv->tasks)));
+	
+	if ((sexp = calendar_config_get_hide_completed_tasks_sexp()) != NULL) {
+		e_cal_model_set_search_query (model, sexp);
+		g_free (sexp);
+	} else
+		e_cal_model_set_search_query (model, "#t");
+}
+
+static gboolean
+update_view_cb (TasksComponent *component)
+{	
+	update_view(component);
+
+	return TRUE;
+}
+
 /* Callbacks.  */
 static void
 add_popup_menu_item (GtkMenu *menu, const char *label, const char *pixmap,
@@ -402,6 +428,12 @@
 	update_primary_selection (data);
 }
 
+static void
+config_hide_completed_tasks_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+	update_view (data);
+}
+
 /* GObject methods */
 
 static void
@@ -481,6 +513,7 @@
 	GtkWidget *selector_scrolled_window, *statusbar_widget, *vbox, *info;
 	BonoboControl *sidebar_control, *statusbar_control;
 	guint not;
+	guint idle_id = 0;
 	
 	priv = component->priv;
 
@@ -541,6 +574,21 @@
 	not = calendar_config_add_notification_primary_tasks (config_primary_selection_changed_cb, 
 							      component);
 	priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+	
+	not = calendar_config_add_notification_hide_completed_tasks (config_hide_completed_tasks_changed_cb, 
+							      component);
+	priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+	
+	not = calendar_config_add_notification_hide_completed_tasks_units (config_hide_completed_tasks_changed_cb, 
+							      component);
+	priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+	
+	not = calendar_config_add_notification_hide_completed_tasks_value (config_hide_completed_tasks_changed_cb, 
+							      component);
+	priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
+	
+	/* Idle check to hide completed items */
+	idle_id = g_timeout_add_full (G_PRIORITY_LOW, 60000, (GSourceFunc) update_view_cb, component, NULL);
 
 	/* Return the controls */
 	*corba_sidebar_control = CORBA_Object_duplicate (BONOBO_OBJREF (sidebar_control), ev);


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