Support deleting tasks
[milk] / src / milk-auth.c
index e8e78f1..37343bf 100644 (file)
@@ -144,16 +144,16 @@ auth_response_cb (GtkWidget *dialog,
         auth_token = rtm_glib_auth_get_token (priv->rtm_glib, priv->frob,
                         &error);
         if (error != NULL) {
-                g_error ("%s", rtm_error_get_message (error));
+                g_warning ("%s", rtm_error_get_message (error));
                 goto auth_response_cb_error_OUT;
         }
 
         if (!rtm_glib_auth_check_token (priv->rtm_glib, auth_token, NULL)) {
-                g_error ("auth_token not valid!\n");
+                g_warning ("auth_token not valid!\n");
                 goto auth_response_cb_error_OUT;
         }
         if (error != NULL) {
-                g_error ("%s", rtm_error_get_message (error));
+                g_warning ("%s", rtm_error_get_message (error));
                 goto auth_response_cb_error_OUT;
         }
         username = rtm_glib_test_login (priv->rtm_glib, auth_token, &error);
@@ -161,7 +161,7 @@ auth_response_cb (GtkWidget *dialog,
         g_free (auth_token);
 
         if (error != NULL) {
-                g_error ("%s", rtm_error_get_message (error));
+                g_warning ("%s", rtm_error_get_message (error));
                 goto auth_response_cb_error_OUT;
         }
 
@@ -170,6 +170,8 @@ auth_response_cb (GtkWidget *dialog,
 
 auth_response_cb_error_OUT:
         priv->state = MILK_AUTH_STATE_DISCONNECTED;
+        /* FIXME: make it possible to re-try, etc. */
+        gtk_main_quit ();
 
 auth_response_cb_OUT:
         if (priv->state != previous_state)
@@ -201,6 +203,49 @@ milk_auth_get_tasks (MilkAuth    *auth,
         return rtm_tasks;
 }
 
+char*
+milk_auth_timeline_create (MilkAuth  *auth,
+                           GError   **error)
+{
+        MilkAuthPrivate *priv;
+
+        g_return_val_if_fail (MILK_IS_AUTH (auth), NULL);
+
+        priv = MILK_AUTH_PRIVATE (auth);
+
+        return rtm_glib_timelines_create (priv->rtm_glib, error);
+}
+
+char*
+milk_auth_task_complete (MilkAuth  *auth,
+                         char      *timeline,
+                         RtmTask   *task,
+                         GError   **error)
+{
+        MilkAuthPrivate *priv;
+
+        g_return_val_if_fail (MILK_IS_AUTH (auth), NULL);
+
+        priv = MILK_AUTH_PRIVATE (auth);
+
+        return rtm_glib_tasks_complete (priv->rtm_glib, timeline, task, error);
+}
+
+char*
+milk_auth_task_delete (MilkAuth  *auth,
+                       char      *timeline,
+                       RtmTask   *task,
+                       GError   **error)
+{
+        MilkAuthPrivate *priv;
+
+        g_return_val_if_fail (MILK_IS_AUTH (auth), NULL);
+
+        priv = MILK_AUTH_PRIVATE (auth);
+
+        return rtm_glib_tasks_delete (priv->rtm_glib, timeline, task, error);
+}
+
 void
 milk_auth_log_in (MilkAuth *auth)
 {