COL_ID,
COL_DESCRIPTION,
COL_PROJECT,
- COL_UUID
+ COL_UUID,
+ COL_PRIORITY
};
static struct task *get_selected_task(GtkTreeView *treeview)
uuid = g_value_get_string(&value);
- for(tasks_cur = tasks; *tasks_cur; tasks_cur++)
+ for (tasks_cur = tasks; *tasks_cur; tasks_cur++)
if (!strcmp((*tasks_cur)->uuid, uuid))
return *tasks_cur;
COL_ID, (*tasks_cur)->id,
COL_DESCRIPTION, (*tasks_cur)->description,
COL_UUID, (*tasks_cur)->uuid,
+ COL_PRIORITY, (*tasks_cur)->priority,
-1);
}
}
else
tasks[i]->project = NULL;
+ json = json_object_object_get(jtask, "priority");
+ if (json)
+ tasks[i]->priority
+ = strdup(json_object_get_string(json));
+ else
+ tasks[i]->priority = strdup("");
+
json = json_object_object_get(jtask, "uuid");
tasks[i]->uuid = strdup(json_object_get_string(json));
free(opts);
}
+void tw_modify_priority(const char *uuid, const char *priority)
+{
+ char *str;
+ char *opts;
+
+ str = escape(priority);
+
+ opts = malloc(1
+ + strlen(uuid)
+ + strlen(" modify priority:\"")
+ + strlen(str)
+ + strlen("\"")
+ + 1);
+ sprintf(opts, " %s modify priority:\"%s\"", uuid, str);
+
+ task_exec(opts);
+
+ free(str);
+ free(opts);
+}
+
void tw_add(const char *newdesc)
{
char *str;
char *uuid;
char *note;
char *project;
+ char *priority;
};
struct task **tw_get_all_tasks(const char *status);
void tw_modify_description(const char *uuid, const char *newdesc);
void tw_modify_project(const char *uuid, const char *newproj);
+void tw_modify_priority(const char *uuid, const char *priority);
void tw_add(const char *newdesc);
char *task_exec(char *opts);