From 4e7cd76bf11ac81c04727a6297486474d703bde8 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Orsini Date: Wed, 17 Oct 2012 08:25:29 +0000 Subject: [PATCH] --- src/glade/gtask.glade | 43 +++++++++++++++++++++++++++++++++++-------- src/main.c | 11 +++++++++++ src/tw.c | 15 +++++++++++++++ src/tw.h | 1 + 4 files changed, 62 insertions(+), 8 deletions(-) diff --git a/src/glade/gtask.glade b/src/glade/gtask.glade index 8a65600..47d8973 100644 --- a/src/glade/gtask.glade +++ b/src/glade/gtask.glade @@ -367,7 +367,7 @@ 0 - 0 + 1 1 1 @@ -385,7 +385,7 @@ 0 - 3 + 4 1 1 @@ -409,7 +409,7 @@ 1 - 3 + 4 1 1 @@ -427,7 +427,7 @@ 1 - 0 + 1 1 1 @@ -445,7 +445,7 @@ 0 - 2 + 3 1 1 @@ -461,7 +461,7 @@ 1 - 2 + 3 1 1 @@ -479,7 +479,7 @@ 0 - 1 + 2 1 1 @@ -503,11 +503,38 @@ 1 - 1 + 2 1 1 + + + True + False + start + + + Mark Done + True + True + True + + + + False + True + 0 + + + + + 0 + 0 + 2 + 1 + + True diff --git a/src/main.c b/src/main.c index 9ff003e..6efc6c7 100644 --- a/src/main.c +++ b/src/main.c @@ -145,6 +145,17 @@ static void refresh() printf("refresh done\n"); } +int taskdone_clicked_cbk(GtkButton *btn, gpointer data) +{ + struct task *task; + + task = get_selected_task(GTK_TREE_VIEW(w_treeview)); + tw_done(task->uuid); + refresh(); + + return FALSE; +} + static int tasksave_clicked_cbk(GtkButton *btn, gpointer data) { struct task *task; diff --git a/src/tw.c b/src/tw.c index d65ae61..1e9a23c 100644 --- a/src/tw.c +++ b/src/tw.c @@ -263,3 +263,18 @@ void tw_add(const char *newdesc) free(str); free(opts); } + +void tw_done(const char *uuid) +{ + char *opts; + + opts = malloc(1 + + strlen(uuid) + + strlen(" done") + + 1); + sprintf(opts, " %s done", uuid); + + task_exec(opts); + + free(opts); +} diff --git a/src/tw.h b/src/tw.h index f6718cb..c95d009 100644 --- a/src/tw.h +++ b/src/tw.h @@ -34,6 +34,7 @@ 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_done(const char *uuid); void tw_add(const char *newdesc); char *task_exec(char *opts); -- 2.7.4