g_debug ("FIXME: implement 'new task' action");
}
+/* XXX: The latency between clicking "complete" and actually removing the task
+ * from the view after polling the server is very long, so there's an obvious
+ * lag -- it will be completely transparent (and look very fast) as soon as
+ * we've got a cache in place */
static void
complete_clicked_cb (GtkButton *button,
MilkMainWindow *window)
{
- g_debug ("FIXME: implement 'complete' action");
+ MilkMainWindowPrivate *priv;
+ GList *rows;
+ GtkTreeModel *model;
+ char *timeline;
+ GError *error = NULL;
+
+ priv = MILK_MAIN_WINDOW_PRIVATE (window);
+
+ rows = hildon_touch_selector_get_selected_rows (
+ HILDON_TOUCH_SELECTOR (priv->task_view),
+ TASK_VIEW_COLUMN_TITLE);
+ model = hildon_touch_selector_get_model (
+ HILDON_TOUCH_SELECTOR (priv->task_view),
+ TASK_VIEW_COLUMN_TITLE);
+
+ timeline = milk_auth_timeline_create (priv->auth, &error);
+
+ if (error) {
+ g_warning (G_STRLOC ": failed to create a timeline: %s",
+ error->message);
+ g_clear_error (&error);
+ } else {
+ while (rows) {
+ GtkTreeIter iter;
+ RtmTask *task;
+
+ gtk_tree_model_get_iter (model, &iter, rows->data);
+ gtk_tree_model_get (model, &iter,
+ MILK_TASK_MODEL_COLUMN_TASK, &task,
+ -1);
+
+ milk_auth_task_complete (priv->auth, timeline, task,
+ &error);
+ if (error != NULL) {
+ g_warning (G_STRLOC ": failed to complete task "
+ "%s: %s",
+ rtm_task_get_id (task),
+ error->message);
+ g_clear_error (&error);
+ }
+
+ rows = g_list_delete_link (rows, rows);
+ }
+ }
}
static void