Re: [evolution-patches] 56898 Tasks



On Mon, 2004-04-19 at 22:58 -0600, Gary Ekker wrote:
> Attached is the latest revision of the patch. JPR reminded that
> gnome-cal would need the same changes. I also realized that I had to
> make this work with the searchbar. All of this should now work together.

Seems to work, some comments below.
 
> Index: gui/e-tasks.c
> ===================================================================
> RCS file: /cvs/gnome/evolution/calendar/gui/e-tasks.c,v
> retrieving revision 1.85
> diff -u -r1.85 e-tasks.c
> --- gui/e-tasks.c	18 Apr 2004 18:01:19 -0000	1.85
> +++ gui/e-tasks.c	20 Apr 2004 04:22:11 -0000
> @@ -73,6 +73,7 @@
>  	GtkWidget *preview;
>  	
>  	gchar *current_uid;
> +	char *sexp;
>  
>  	/* View instance and the view menus handler */
>  	GalViewInstance *view_instance;
> @@ -167,12 +168,26 @@
>  	ETasks *tasks;
>  	ETasksPrivate *priv;
>  	ECalModel *model;
> +	char *new_sexp = NULL;
> +	char *real_sexp = NULL;
>  
>  	tasks = E_TASKS (data);
>  	priv = tasks->priv;
>  
> +	if (priv->sexp)
> +		g_free (priv->sexp);
> +	
> +	priv->sexp = g_strdup (sexp);
> +	
>  	model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
> -	e_cal_model_set_search_query (model, sexp);
> +		
> +	if ((new_sexp = calendar_config_get_hide_completed_tasks_sexp()) != NULL) {
> +		real_sexp = g_strdup_printf ("(and %s %s)", new_sexp, sexp);
> +		e_cal_model_set_search_query (model, real_sexp);
> +		g_free (new_sexp);
> +		g_free (real_sexp);
> +	} else
> +		e_cal_model_set_search_query (model, sexp);
>  }

Couldn't we just call update_view here after assigning the priv->sexp?
Now that I look, storing priv->sexp seems pretty useless doesn't it?
 
>  /* Callback used when the selected category in the search bar changes */
> @@ -228,6 +243,41 @@
>  }
>  
>  static void
> +update_view (ETasks *tasks)
> +{
> +	ETasksPrivate *priv;
> +	ECalModel *model;
> +	char *real_sexp = NULL;
> +	char *new_sexp = NULL;
> +	
> +	priv = tasks->priv;
> +
> +	model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
> +		
> +	if ((new_sexp = calendar_config_get_hide_completed_tasks_sexp()) != 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);
> +		g_free (real_sexp);
> +	} else
> +		e_cal_model_set_search_query (model, priv->sexp);
> +}
> +
> +static gboolean
> +update_view_cb (ETasks *tasks)
> +{	
> +	update_view (tasks);
> +
> +	return TRUE;
> +}
> +
> +static void
> +config_hide_completed_tasks_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
> +{
> +	update_view (data);
> +}
> +
> +static void
>  model_row_changed_cb (ETableModel *etm, int row, gpointer data)
>  {
>  	ETasks *tasks;
> @@ -290,6 +340,7 @@
>  {
>  	ETasksPrivate *priv;
>  	guint not;
> +	guint idle_id = 0;
>  
>  	priv = tasks->priv;
>  	
> @@ -298,6 +349,21 @@
>  	
>  	not = calendar_config_add_notification_timezone (timezone_changed_cb, tasks);
>  	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, 
> +							      tasks);
> +	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, 
> +							      tasks);
> +	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, 
> +							      tasks);
> +	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, tasks, NULL);	
>  }

A nit, but an idle is a bit different that a timeout (you want the
timeout though).


-JP




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