(no commit message)
authorJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 17 Oct 2012 08:25:29 +0000 (08:25 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 17 Oct 2012 08:25:29 +0000 (08:25 +0000)
src/glade/gtask.glade
src/main.c
src/tw.c
src/tw.h

index 8a65600..47d8973 100644 (file)
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
+                        <property name="top_attach">1</property>
                         <property name="width">1</property>
                         <property name="height">1</property>
                       </packing>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">3</property>
+                        <property name="top_attach">4</property>
                         <property name="width">1</property>
                         <property name="height">1</property>
                       </packing>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">3</property>
+                        <property name="top_attach">4</property>
                         <property name="width">1</property>
                         <property name="height">1</property>
                       </packing>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">0</property>
+                        <property name="top_attach">1</property>
                         <property name="width">1</property>
                         <property name="height">1</property>
                       </packing>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">2</property>
+                        <property name="top_attach">3</property>
                         <property name="width">1</property>
                         <property name="height">1</property>
                       </packing>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">2</property>
+                        <property name="top_attach">3</property>
                         <property name="width">1</property>
                         <property name="height">1</property>
                       </packing>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
+                        <property name="top_attach">2</property>
                         <property name="width">1</property>
                         <property name="height">1</property>
                       </packing>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">1</property>
+                        <property name="top_attach">2</property>
                         <property name="width">1</property>
                         <property name="height">1</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkButtonBox" id="buttonbox2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="layout_style">start</property>
+                        <child>
+                          <object class="GtkButton" id="button3">
+                            <property name="label" translatable="yes">Mark Done</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <signal name="clicked" handler="taskdone_clicked_cbk" swapped="no"/>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                        <property name="width">2</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">True</property>
index 9ff003e..6efc6c7 100644 (file)
@@ -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;
index d65ae61..1e9a23c 100644 (file)
--- 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);
+}
index f6718cb..c95d009 100644 (file)
--- 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);