aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-11-26 04:07:15 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-11-26 04:09:18 +0800
commit02b15ae6b88dad131f56c74fd1205b8b9aacbf80 (patch)
tree83e18e062ccdd607d631e7390ac1090af8f54975
parent6b8a6f1865b273ba5ecc2bc9ab9417c602d82cb7 (diff)
downloadgsoc2013-evolution-02b15ae6b88dad131f56c74fd1205b8b9aacbf80.tar.gz
gsoc2013-evolution-02b15ae6b88dad131f56c74fd1205b8b9aacbf80.tar.zst
gsoc2013-evolution-02b15ae6b88dad131f56c74fd1205b8b9aacbf80.zip
BugĀ 602704 - Actions->Purge in task view doesn't work
-rw-r--r--modules/calendar/e-task-shell-view-actions.c4
-rw-r--r--modules/calendar/e-task-shell-view-private.c58
-rw-r--r--modules/calendar/e-task-shell-view-private.h2
3 files changed, 60 insertions, 4 deletions
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index 0e77efb1d8..6f70c9afdb 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -589,9 +589,7 @@ action_task_purge_cb (GtkAction *action,
e_task_shell_view_set_confirm_purge (task_shell_view, FALSE);
purge:
-
- /* FIXME KILL-BONOBO */
- ;
+ e_task_shell_view_delete_completed (task_shell_view);
}
static void
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c
index 532b357b02..bbe0a1035d 100644
--- a/modules/calendar/e-task-shell-view-private.c
+++ b/modules/calendar/e-task-shell-view-private.c
@@ -374,7 +374,7 @@ e_task_shell_view_private_dispose (ETaskShellView *task_shell_view)
DISPOSE (priv->task_shell_sidebar);
if (task_shell_view->priv->activity != NULL) {
- /* XXX Activity is no cancellable. */
+ /* XXX Activity is not cancellable. */
e_activity_complete (task_shell_view->priv->activity);
g_object_unref (task_shell_view->priv->activity);
task_shell_view->priv->activity = NULL;
@@ -447,6 +447,62 @@ exit:
}
void
+e_task_shell_view_delete_completed (ETaskShellView *task_shell_view)
+{
+ ETaskShellSidebar *task_shell_sidebar;
+ GList *list, *iter;
+ const gchar *sexp;
+
+ g_return_if_fail (E_IS_TASK_SHELL_VIEW (task_shell_view));
+
+ sexp = "(is-completed?)";
+
+ task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
+ list = e_task_shell_sidebar_get_clients (task_shell_sidebar);
+
+ e_task_shell_view_set_status_message (
+ task_shell_view, _("Expunging"), -1.0);
+
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ECal *client = E_CAL (iter->data);
+ GList *objects;
+ gboolean read_only = TRUE;
+ GError *error = NULL;
+
+ if (!e_cal_is_read_only (client, &read_only, &error)) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ continue;
+ }
+
+ if (read_only)
+ continue;
+
+ if (!e_cal_get_object_list (client, sexp, &objects, &error)) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ continue;
+ }
+
+ while (objects != NULL) {
+ icalcomponent *component = objects->data;
+ const gchar *uid;
+
+ uid = icalcomponent_get_uid (component);
+ if (!e_cal_remove_object (client, uid, &error)) {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ }
+
+ icalcomponent_free (component);
+ objects = g_list_delete_link (objects, objects);
+ }
+ }
+
+ e_task_shell_view_set_status_message (task_shell_view, NULL, -1.0);
+}
+
+void
e_task_shell_view_set_status_message (ETaskShellView *task_shell_view,
const gchar *status_message,
gdouble percent)
diff --git a/modules/calendar/e-task-shell-view-private.h b/modules/calendar/e-task-shell-view-private.h
index fcbe852898..4418fd7136 100644
--- a/modules/calendar/e-task-shell-view-private.h
+++ b/modules/calendar/e-task-shell-view-private.h
@@ -126,6 +126,8 @@ void e_task_shell_view_actions_init
void e_task_shell_view_open_task
(ETaskShellView *task_shell_view,
ECalModelComponent *comp_data);
+void e_task_shell_view_delete_completed
+ (ETaskShellView *task_shell_view);
void e_task_shell_view_set_status_message
(ETaskShellView *task_shell_view,
const gchar *status_message,