S["CPPCHECK_TRUE"]=""
S["HAVE_CPPCHECK"]="yes"
S["HELP2MAN"]="help2man"
-S["JSON_LIBS"]="-ljson "
-S["JSON_CFLAGS"]="-I/usr/include/json "
+S["JSON_LIBS"]="-ljson-c "
+S["JSON_CFLAGS"]="-I/usr/include/json-c "
S["GTK_LIBS"]="-lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 "
S["GTK_CFLAGS"]="-pthread -I/usr/include/gtk-3.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/i"\
"nclude/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz -I/usr/inclu"\
msgstr ""
"Project-Id-Version: ptask\n"
"Report-Msgid-Bugs-To: jeanfi@gmail.com\n"
-"POT-Creation-Date: 2013-03-24 13:22+0100\n"
+"POT-Creation-Date: 2013-10-19 11:51+0200\n"
"PO-Revision-Date: 2012-05-13 18:15+0000\n"
"Last-Translator: jeanfi <Unknown>\n"
"Language-Team: French <>\n"
"X-Launchpad-Export-Date: 2012-07-02 08:28+0000\n"
"X-Generator: Launchpad (build 15520)\n"
-#: src/main.c:60
+#: src/main.c:65
#, c-format
msgid ""
"Copyright (C) %s jeanfi@gmail.com\n"
"There is NO WARRANTY, to the extent permitted by law.\n"
msgstr ""
-#: src/main.c:71
+#: src/main.c:76
#, c-format
msgid "Usage: %s [OPTION]...\n"
msgstr ""
-#: src/main.c:73
-msgid "Ptask is a task management UI based on taskwarrior."
+#: src/main.c:78
+msgid "ptask is a task management user interface based on taskwarrior."
msgstr ""
-#: src/main.c:76
+#: src/main.c:82
#, fuzzy
msgid "Options:"
msgstr "Description:"
-#: src/main.c:77
+#: src/main.c:83
msgid ""
" -h, --help display this help and exit\n"
" -v, --version display version information and exit"
msgstr ""
-#: src/main.c:82
+#: src/main.c:88
+msgid " -d, --debug=LEVEL set the debug level, integer between 0 and 3"
+msgstr ""
+
+#: src/main.c:93
#, c-format
msgid "Report bugs to: %s\n"
msgstr ""
-#: src/main.c:84
+#: src/main.c:95
#, c-format
msgid "%s home page: <%s>\n"
msgstr ""
-#: src/main.c:444
+#: src/main.c:210
+msgid ""
+"Error loading tasks, verify that a supported version of taskwarrior is "
+"installed and its configuration file exist."
+msgstr ""
+
+#: src/main.c:490
+msgid "Enables debug mode."
+msgstr ""
+
+#: src/main.c:499
#, c-format
msgid "Try `%s --help' for more information.\n"
msgstr ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: jeanfi@gmail.com\n"
-"POT-Creation-Date: 2013-03-24 13:22+0100\n"
+"POT-Creation-Date: 2013-10-19 11:51+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/main.c:60
+#: src/main.c:65
#, c-format
msgid ""
"Copyright (C) %s jeanfi@gmail.com\n"
"There is NO WARRANTY, to the extent permitted by law.\n"
msgstr ""
-#: src/main.c:71
+#: src/main.c:76
#, c-format
msgid "Usage: %s [OPTION]...\n"
msgstr ""
-#: src/main.c:73
-msgid "Ptask is a task management UI based on taskwarrior."
+#: src/main.c:78
+msgid "ptask is a task management user interface based on taskwarrior."
msgstr ""
-#: src/main.c:76
+#: src/main.c:82
msgid "Options:"
msgstr ""
-#: src/main.c:77
+#: src/main.c:83
msgid ""
" -h, --help display this help and exit\n"
" -v, --version display version information and exit"
msgstr ""
-#: src/main.c:82
+#: src/main.c:88
+msgid " -d, --debug=LEVEL set the debug level, integer between 0 and 3"
+msgstr ""
+
+#: src/main.c:93
#, c-format
msgid "Report bugs to: %s\n"
msgstr ""
-#: src/main.c:84
+#: src/main.c:95
#, c-format
msgid "%s home page: <%s>\n"
msgstr ""
-#: src/main.c:444
+#: src/main.c:210
+msgid ""
+"Error loading tasks, verify that a supported version of taskwarrior is "
+"installed and its configuration file exist."
+msgstr ""
+
+#: src/main.c:490
+msgid "Enables debug mode."
+msgstr ""
+
+#: src/main.c:499
#, c-format
msgid "Try `%s --help' for more information.\n"
msgstr ""
ptask_SOURCES = main.c \
log.c log.h \
note.c note.h \
+ pstr.c pstr.h \
ptime.c ptime.h \
tw.c tw.h
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
PROGRAMS = $(bin_PROGRAMS)
am_ptask_OBJECTS = main.$(OBJEXT) log.$(OBJEXT) note.$(OBJEXT) \
- ptime.$(OBJEXT) tw.$(OBJEXT)
+ pstr.$(OBJEXT) ptime.$(OBJEXT) tw.$(OBJEXT)
ptask_OBJECTS = $(am_ptask_OBJECTS)
ptask_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
ptask_SOURCES = main.c \
log.c log.h \
note.c note.h \
+ pstr.c pstr.h \
ptime.c ptime.h \
tw.c tw.h
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/note.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pstr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ptime.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tw.Po@am__quote@
{
printf(_("Usage: %s [OPTION]...\n"), program_name);
- puts(_("ptask is a task management user interface based on taskwarrior."));
+ puts(_("ptask is a task management user interface based"
+ " on taskwarrior."));
puts("");
puts(_("Options:"));
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
_("Error loading tasks, verify "
- "that taskwarrior is "
- "correctly installed, and its"
- " configuration file exist."
+ "that a supported version of "
+ "taskwarrior is installed "
+ "and its configuration file "
+ "exist."
));
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
--- /dev/null
+/*
+ * Copyright (C) 2012-2013 jeanfi@gmail.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+
+void trim(char *str)
+{
+ char *p;
+ int l;
+
+ p = str;
+
+ l = strlen(str) - 1;
+ while (l && isspace(*(p+l))) {
+ *(p+l) = '\0';
+ l--;
+ }
+
+ while (*p && isspace(*p))
+ p++;
+
+ memmove(str, p, strlen(p));
+}
--- /dev/null
+/*
+ * Copyright (C) 2012-2013 jeanfi@gmail.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef _PTASK_PSTR_H_
+#define _PTASK_PSTR_H_
+
+void trim(char *str);
+
+#endif
#include <log.h>
#include "note.h"
+#include <pstr.h>
#include "tw.h"
+
static int has_taskrc()
{
char *home, *path;
size_t s;
char *str, *tmp, *cmd, buf[1024];
- if (!has_taskrc())
- return NULL;
-
- cmd = malloc(strlen("task rc.json.array=on ") + strlen(opts) + 1);
- strcpy(cmd, "task rc.json.array=on ");
+ cmd = malloc(strlen("task ") + strlen(opts) + 1);
+ strcpy(cmd, "task ");
strcat(cmd, opts);
log_debug("execute: %s", cmd);
f = popen(cmd, "r");
+ free(cmd);
+
if (!f) {
perror("popen");
- str = NULL;
- goto exit_free;
+ return NULL;
}
str = strdup("");
if (ret == -1)
log_err("pclose fails");
- exit_free:
- free(cmd);
-
return str;
}
+static char *task_get_version()
+{
+ char *out;
+
+ out = task_exec("--version");
+
+ trim(out);
+
+ return out;
+}
+
+static int task_check_version()
+{
+ char *ver;
+
+ ver = task_get_version();
+
+ if (!ver)
+ return 0;
+
+ log_debug("task version: %s", ver);
+
+ if (!strcmp(ver, "2.2.0"))
+ return 1;
+ else
+ return 0;
+}
+
+static char *tw_exec(char *opts)
+{
+ if (!has_taskrc())
+ return NULL;
+
+ if (!task_check_version()) {
+ log_err("ptask is not compatible with the installed version of"
+ " taskwarrior.");
+ return NULL;
+ }
+
+ return task_exec(opts);
+}
+
static struct json_object *task_exec_json(char *opts)
{
struct json_object *o;
- char *str;
+ char *str, *cmd;
- str = task_exec(opts);
+ cmd = malloc(strlen("rc.json.array=on ") + strlen(opts) + 1);
+ strcpy(cmd, "rc.json.array=on ");
+ strcat(cmd, opts);
+
+ str = tw_exec(cmd);
if (str) {
o = json_tokener_parse(str);
free(str);
- return o;
+ } else {
+ o = NULL;
}
- return NULL;
+ free(cmd);
+
+ return o;
}
struct task **tw_get_all_tasks(const char *status)
+ 1);
sprintf(opts, " %s modify \"%s\"", uuid, str);
- task_exec(opts);
+ tw_exec(opts);
free(str);
free(opts);
+ 1);
sprintf(opts, " %s modify project:\"%s\"", uuid, str);
- task_exec(opts);
+ tw_exec(opts);
free(str);
free(opts);
+ 1);
sprintf(opts, " %s modify priority:\"%s\"", uuid, str);
- task_exec(opts);
+ tw_exec(opts);
free(str);
free(opts);
+ 1);
sprintf(opts, " add \"%s\"", str);
- task_exec(opts);
+ tw_exec(opts);
free(str);
free(opts);
+ 1);
sprintf(opts, " %s done", uuid);
- task_exec(opts);
+ tw_exec(opts);
free(opts);
}