aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-tasks.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2003-10-22 02:49:34 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2003-10-22 02:49:34 +0800
commit653cfffc0e00dfb59b36813c1b45c53d3f773c65 (patch)
tree9b486d5e383ec1391d60973d9cc548be0ef6d9d5 /calendar/gui/e-tasks.c
parent0fb08f3ff81575a4749d851404233f34252dd2f2 (diff)
downloadgsoc2013-evolution-653cfffc0e00dfb59b36813c1b45c53d3f773c65.tar
gsoc2013-evolution-653cfffc0e00dfb59b36813c1b45c53d3f773c65.tar.gz
gsoc2013-evolution-653cfffc0e00dfb59b36813c1b45c53d3f773c65.tar.bz2
gsoc2013-evolution-653cfffc0e00dfb59b36813c1b45c53d3f773c65.tar.lz
gsoc2013-evolution-653cfffc0e00dfb59b36813c1b45c53d3f773c65.tar.xz
gsoc2013-evolution-653cfffc0e00dfb59b36813c1b45c53d3f773c65.tar.zst
gsoc2013-evolution-653cfffc0e00dfb59b36813c1b45c53d3f773c65.zip
Merge new-ui-branch to the trunk.
svn path=/trunk/; revision=22965
Diffstat (limited to 'calendar/gui/e-tasks.c')
-rw-r--r--calendar/gui/e-tasks.c128
1 files changed, 40 insertions, 88 deletions
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index b441aee09d..768b2e587c 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -572,7 +572,6 @@ GtkWidget *
e_tasks_construct (ETasks *tasks)
{
ETasksPrivate *priv;
- ECalModel *model;
g_return_val_if_fail (tasks != NULL, NULL);
g_return_val_if_fail (E_IS_TASKS (tasks), NULL);
@@ -581,24 +580,6 @@ e_tasks_construct (ETasks *tasks)
setup_widgets (tasks);
- priv->client = cal_client_new ();
- if (!priv->client)
- return NULL;
-
- g_signal_connect (priv->client, "cal_opened",
- G_CALLBACK (cal_opened_cb), tasks);
- g_signal_connect (priv->client, "backend_error",
- G_CALLBACK (backend_error_cb), tasks);
- g_signal_connect (priv->client, "categories_changed",
- G_CALLBACK (client_categories_changed_cb), tasks);
- g_signal_connect (priv->client, "obj_updated",
- G_CALLBACK (client_obj_updated_cb), tasks);
-
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
- g_assert (model != NULL);
-
- e_cal_model_add_client (model, priv->client);
-
return GTK_WIDGET (tasks);
}
@@ -685,6 +666,8 @@ e_tasks_open (ETasks *tasks,
EUri *uri;
char *real_uri;
char *urinopwd;
+ ECalModel *model;
+ GError *error = NULL;
g_return_val_if_fail (tasks != NULL, FALSE);
g_return_val_if_fail (E_IS_TASKS (tasks), FALSE);
@@ -704,10 +687,30 @@ e_tasks_open (ETasks *tasks,
g_free (message);
g_free (urinopwd);
- if (!cal_client_open_calendar (priv->client, real_uri, FALSE)) {
- g_message ("e_tasks_open(): Could not issue the request");
+ /* create the CalClient */
+ priv->client = cal_client_new (real_uri, CALOBJ_TYPE_TODO);
+ if (!priv->client)
+ return NULL;
+
+ g_signal_connect (priv->client, "cal_opened",
+ G_CALLBACK (cal_opened_cb), tasks);
+ g_signal_connect (priv->client, "backend_error",
+ G_CALLBACK (backend_error_cb), tasks);
+ g_signal_connect (priv->client, "categories_changed",
+ G_CALLBACK (client_categories_changed_cb), tasks);
+ g_signal_connect (priv->client, "obj_updated",
+ G_CALLBACK (client_obj_updated_cb), tasks);
+
+ model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
+ g_assert (model != NULL);
+
+ e_cal_model_add_client (model, priv->client);
+
+ if (cal_client_open (priv->client, FALSE, &error)) {
+ g_message ("e_tasks_open(): %s", error->message);
g_free (real_uri);
e_uri_free (uri);
+ g_error_free (error);
return FALSE;
}
@@ -787,7 +790,8 @@ cal_opened_cb (CalClient *client,
location = calendar_config_get_timezone ();
zone = icaltimezone_get_builtin_timezone (location);
if (zone)
- cal_client_set_default_timezone (client, zone);
+ /* FIXME Error checking */
+ cal_client_set_default_timezone (client, zone, NULL);
return;
case CAL_CLIENT_OPEN_ERROR:
@@ -937,60 +941,6 @@ create_sexp (void)
return sexp;
}
-/* Callback used when a component is updated in the live query */
-static void
-query_obj_updated_cb (CalQuery *query, const char *uid,
- gboolean query_in_progress, int n_scanned, int total,
- gpointer data)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
-
- tasks = E_TASKS (data);
- priv = tasks->priv;
-
- delete_error_dialog (cal_client_remove_object (priv->client, uid), CAL_COMPONENT_TODO);
-}
-
-/* Callback used when an evaluation error occurs when running a query */
-static void
-query_eval_error_cb (CalQuery *query, const char *error_str, gpointer data)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
-
- tasks = E_TASKS (data);
- priv = tasks->priv;
-
- g_warning ("eval error: %s\n", error_str);
-
- set_status_message (tasks, NULL);
-
- g_signal_handlers_disconnect_matched (priv->query, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, tasks);
- g_object_unref (priv->query);
- priv->query = NULL;
-}
-
-static void
-query_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *error_str, gpointer data)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
-
- tasks = E_TASKS (data);
- priv = tasks->priv;
-
- if (status != CAL_QUERY_DONE_SUCCESS)
- g_warning ("query done: %s\n", error_str);
-
- set_status_message (tasks, NULL);
-
- g_signal_handlers_disconnect_matched (priv->query, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, tasks);
- g_object_unref (priv->query);
- priv->query = NULL;
-}
/**
* e_tasks_expunge:
* @tasks: A tasks control widget
@@ -1002,31 +952,32 @@ e_tasks_delete_completed (ETasks *tasks)
{
ETasksPrivate *priv;
char *sexp;
+ GList *objects, *l;
g_return_if_fail (tasks != NULL);
g_return_if_fail (E_IS_TASKS (tasks));
priv = tasks->priv;
- /* If we have a query, we are already expunging */
- if (priv->query)
- return;
+ /* FIXME Confirm expunge */
sexp = create_sexp ();
set_status_message (tasks, _("Expunging"));
- priv->query = cal_client_get_query (priv->client, sexp);
- g_free (sexp);
-
- if (!priv->query) {
+
+ if (!cal_client_get_object_list (priv->client, sexp, &objects, NULL)) {
set_status_message (tasks, NULL);
- g_message ("update_query(): Could not create the query");
+ g_warning (G_STRLOC ": Could not get the objects");
+
return;
}
+
+ for (l = objects; l; l = l->next) {
+ /* FIXME Better error handling */
+ cal_client_remove_object (priv->client, icalcomponent_get_uid (l->data), NULL);
+ }
- g_signal_connect (priv->query, "obj_updated", G_CALLBACK (query_obj_updated_cb), tasks);
- g_signal_connect (priv->query, "query_done", G_CALLBACK (query_query_done_cb), tasks);
- g_signal_connect (priv->query, "eval_error", G_CALLBACK (query_eval_error_cb), tasks);
+ set_status_message (tasks, NULL);
}
/* Callback used from the view collection when we need to display a new view */
@@ -1181,6 +1132,7 @@ e_tasks_update_all_config_settings (void)
calendar_config_configure_e_calendar_table (E_CALENDAR_TABLE (priv->tasks_view));
if (zone)
- cal_client_set_default_timezone (priv->client, zone);
+ /* FIXME Error checking */
+ cal_client_set_default_timezone (priv->client, zone, NULL);
}
}