* implemented the cancel button of the task panel.
* added menu.
* restore position of vertical/horizaton spliters.
+ * added creation date, due, and start date in the list of tasks.
v0.0.4
------
restore position of vertical/horizaton spliters.\r
</p>\r
</li>\r
+<li>\r
+<p>\r
+added creation date, due, and start date in the list of tasks.\r
+</p>\r
+</li>\r
</ul></div>\r
</div>\r
</div>\r
<div id="footnotes"><hr /></div>\r
<div id="footer">\r
<div id="footer-text">\r
-Last updated 2013-12-07 20:03:29 CET\r
+Last updated 2013-12-07 22:47:54 CET\r
</div>\r
</div>\r
</body>\r
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
- <object class="GtkListStore" id="prioritystore">
- <columns>
- <!-- column-name priority -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">None</col>
- </row>
- <row>
- <col id="0" translatable="yes">Low</col>
- </row>
- <row>
- <col id="0" translatable="yes">Medium</col>
- </row>
- <row>
- <col id="0" translatable="yes">High</col>
- </row>
- </data>
- </object>
<object class="GtkDialog" id="diag_tasknew">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<action-widget response="0">button2</action-widget>
</action-widgets>
</object>
+ <object class="GtkListStore" id="prioritystore">
+ <columns>
+ <!-- column-name priority -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">None</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Low</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Medium</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">High</col>
+ </row>
+ </data>
+ </object>
<object class="GtkListStore" id="projectstore">
<columns>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
<!-- column-name urgency -->
<column type="gchararray"/>
+ <!-- column-name creation -->
+ <column type="gchararray"/>
+ <!-- column-name due -->
+ <column type="gchararray"/>
+ <!-- column-name start -->
+ <column type="gchararray"/>
</columns>
</object>
<object class="GtkWindow" id="window">
</object>
</child>
<child>
+ <object class="GtkTreeViewColumn" id="urgency">
+ <property name="title" translatable="yes">Urgency</property>
+ <property name="sort_column_id">5</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext9"/>
+ <attributes>
+ <attribute name="text">5</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="creation date">
+ <property name="title" translatable="yes">Creation date</property>
+ <property name="sort_column_id">6</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext10"/>
+ <attributes>
+ <attribute name="text">6</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="Due">
+ <property name="title" translatable="yes">Due</property>
+ <property name="sort_column_id">7</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext11"/>
+ <attributes>
+ <attribute name="text">7</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn3">
+ <property name="title" translatable="yes">Start date</property>
+ <property name="sort_column_id">8</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext12"/>
+ <attributes>
+ <attribute name="text">8</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
<object class="GtkTreeViewColumn" id="description">
<property name="fixed_width">10</property>
<property name="min_width">30</property>
</child>
</object>
</child>
- <child>
- <object class="GtkTreeViewColumn" id="urgency">
- <property name="title" translatable="yes">Urgency</property>
- <property name="sort_column_id">5</property>
- <child>
- <object class="GtkCellRendererText" id="cellrenderertext9"/>
- <attributes>
- <attribute name="text">5</attribute>
- </attributes>
- </child>
- </object>
- </child>
</object>
</child>
</object>
*/
#include <stdlib.h>
-#include "ptime.h"
+#include <log.h>
+#include <ptime.h>
-char *time_to_str(time_t *t)
+static char *time_to_str(time_t *t)
{
struct tm lt;
char *str;
t = time(NULL);
return time_to_str(&t);
}
+
+char *tm_to_str(const struct tm *tm)
+{
+ char *str;
+ size_t s;
+
+ str = malloc(11);
+ s = strftime(str, 11, "%Y/%m/%d", tm);
+
+ if (s)
+ return str;
+
+ log_err("Failed to convert time");
+ return NULL;
+}
#include <time.h>
char *get_time_str();
-char *time_to_str(time_t *t);
+char *tm_to_str(const struct tm *);
#endif
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
+#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
+#include <time.h>
#include <json/json.h>
#include <pstr.h>
#include "tw.h"
+struct tm *parse_time(const char *t)
+{
+ struct tm *tm;
+
+ tm = malloc(sizeof(struct tm));
+ memset(tm, 0, sizeof(struct tm));
+ strptime(t, "%Y%m%dT%H%M%S%Z", tm);
+
+ return tm;
+}
+
static char *task_exec(char *opts)
{
FILE *f;
tasks[i]->urgency = NULL;
tasks[i]->note = note_get(tasks[i]->uuid);
+
+ json = json_object_object_get(jtask, "entry");
+ tasks[i]->entry = parse_time(json_object_get_string(json));
+
+ json = json_object_object_get(jtask, "due");
+ if (json)
+ tasks[i]->due
+ = parse_time(json_object_get_string(json));
+ else
+ tasks[i]->due = NULL;
+
+ json = json_object_object_get(jtask, "start");
+ if (json)
+ tasks[i]->start
+ = parse_time(json_object_get_string(json));
+ else
+ tasks[i]->start = NULL;
}
tasks[n] = NULL;
free(task->project);
free(task->priority);
free(task->urgency);
+ free(task->entry);
+ free(task->due);
+ free(task->start);
free(task);
}
char *project;
char *priority;
char *urgency;
+ struct tm *entry;
+ struct tm *due;
+ struct tm *start;
};
struct project {
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
+#define _XOPEN_SOURCE
+#include <time.h>
+
+#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <log.h>
+#include <ptime.h>
#include <ui_projecttree.h>
#include <ui_taskpanel.h>
#include <ui_tasktree.h>
COL_PROJECT,
COL_UUID,
COL_PRIORITY,
- COL_URGENCY
+ COL_URGENCY,
+ COL_CREATION_DATE,
+ COL_DUE,
+ COL_START
};
static int priority_to_int(const char *str)
struct task *task;
GtkTreeIter iter;
const char *prj;
+ char *s;
current_tasks = tasks;
gtk_list_store_set(GTK_LIST_STORE(model),
&iter,
- COL_ID, (*tasks_cur)->id,
+ COL_ID,
+ (*tasks_cur)->id,
COL_DESCRIPTION,
(*tasks_cur)->description,
- COL_PROJECT, prj,
- COL_UUID, (*tasks_cur)->uuid,
- COL_PRIORITY, (*tasks_cur)->priority,
- COL_URGENCY, (*tasks_cur)->urgency,
+ COL_PROJECT,
+ prj,
+ COL_UUID,
+ (*tasks_cur)->uuid,
+ COL_PRIORITY,
+ (*tasks_cur)->priority,
+ COL_URGENCY,
+ (*tasks_cur)->urgency,
-1);
+
+ if ((*tasks_cur)->start) {
+ s = tm_to_str((*tasks_cur)->start);
+ gtk_list_store_set
+ (GTK_LIST_STORE(model),
+ &iter,
+ COL_START,
+ s,
+ -1);
+ free(s);
+ }
+
+ if ((*tasks_cur)->due) {
+ s = tm_to_str((*tasks_cur)->due);
+ gtk_list_store_set
+ (GTK_LIST_STORE(model),
+ &iter,
+ COL_DUE,
+ s,
+ -1);
+ free(s);
+ }
+
+ if ((*tasks_cur)->entry) {
+ s = tm_to_str((*tasks_cur)->entry);
+ gtk_list_store_set
+ (GTK_LIST_STORE(model),
+ &iter,
+ COL_CREATION_DATE,
+ s,
+ -1);
+ free(s);
+ }
}
}