aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-tasks.c
diff options
context:
space:
mode:
authorGary Ekker <gekker@novell.com>2004-05-01 05:33:11 +0800
committerGary Ekker <gekker@src.gnome.org>2004-05-01 05:33:11 +0800
commit8acc05254177f038ff5f93fed69fac376851a7d8 (patch)
tree22920664c6f513ad105b1e3e0f81103087a684dc /calendar/gui/e-tasks.c
parent343d0d815a4b59c13316e7125ef392be7ccdefcb (diff)
downloadgsoc2013-evolution-8acc05254177f038ff5f93fed69fac376851a7d8.tar
gsoc2013-evolution-8acc05254177f038ff5f93fed69fac376851a7d8.tar.gz
gsoc2013-evolution-8acc05254177f038ff5f93fed69fac376851a7d8.tar.bz2
gsoc2013-evolution-8acc05254177f038ff5f93fed69fac376851a7d8.tar.lz
gsoc2013-evolution-8acc05254177f038ff5f93fed69fac376851a7d8.tar.xz
gsoc2013-evolution-8acc05254177f038ff5f93fed69fac376851a7d8.tar.zst
gsoc2013-evolution-8acc05254177f038ff5f93fed69fac376851a7d8.zip
Set up the model to use the correct query. Setup callbacks for gconf
2004-04-30 Gary Ekker <gekker@novell.com> * gui/e-tasks.c: (e_tasks_init): Set up the model to use the correct query. 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/gnome-cal.c: ditto * gui/calendar-config.h: Add notifications for hide_completed_tasks settings. * gui/calendar-config.c: ditto svn path=/trunk/; revision=25727
Diffstat (limited to 'calendar/gui/e-tasks.c')
-rw-r--r--calendar/gui/e-tasks.c75
1 files changed, 69 insertions, 6 deletions
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index e48e954c12..729e5456c7 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -74,6 +74,7 @@ struct _ETasksPrivate {
GtkWidget *preview;
gchar *current_uid;
+ char *sexp;
/* View instance and the view menus handler */
GalViewInstance *view_instance;
@@ -87,6 +88,7 @@ static void e_tasks_class_init (ETasksClass *class);
static void e_tasks_init (ETasks *tasks);
static void setup_widgets (ETasks *tasks);
static void e_tasks_destroy (GtkObject *object);
+static void update_view (ETasks *tasks);
static void backend_error_cb (ECal *client, const char *message, gpointer data);
@@ -168,12 +170,18 @@ search_bar_sexp_changed_cb (CalSearchBar *cal_search, const char *sexp, gpointer
ETasks *tasks;
ETasksPrivate *priv;
ECalModel *model;
+ char *new_sexp = NULL;
+ char *real_sexp = NULL;
tasks = E_TASKS (data);
priv = tasks->priv;
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
- e_cal_model_set_search_query (model, sexp);
+ if (priv->sexp)
+ g_free (priv->sexp);
+
+ priv->sexp = g_strdup (sexp);
+
+ update_view (tasks);
}
/* Callback used when the selected category in the search bar changes */
@@ -230,6 +238,41 @@ timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer
}
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;
@@ -292,6 +335,7 @@ setup_config (ETasks *tasks)
{
ETasksPrivate *priv;
guint not;
+ guint timeout_id = 0;
priv = tasks->priv;
@@ -300,6 +344,21 @@ setup_config (ETasks *tasks)
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));
+
+ /* Timeout check to hide completed items */
+ timeout_id = g_timeout_add_full (G_PRIORITY_LOW, 60000, (GSourceFunc) update_view_cb, tasks, NULL);
}
#define E_TASKS_TABLE_DEFAULT_STATE \
@@ -421,7 +480,6 @@ static void
e_tasks_init (ETasks *tasks)
{
ETasksPrivate *priv;
- ECalModel *model;
priv = g_new0 (ETasksPrivate, 1);
tasks->priv = priv;
@@ -434,9 +492,9 @@ e_tasks_init (ETasks *tasks)
priv->view_instance = NULL;
priv->view_menus = NULL;
priv->current_uid = NULL;
+ priv->sexp = g_strdup ("#t");
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
- e_cal_model_set_search_query (model, "#t");
+ update_view (tasks);
}
/* Callback used when the set of categories changes in the calendar client */
@@ -502,7 +560,12 @@ e_tasks_destroy (GtkObject *object)
g_free (priv->current_uid);
priv->current_uid = NULL;
}
-
+
+ if (priv->sexp) {
+ g_free (priv->sexp);
+ priv->sexp = NULL;
+ }
+
if (priv->tasks_view_config) {
g_object_unref (priv->tasks_view_config);
priv->tasks_view_config = NULL;