(no commit message)
authorJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 17 Oct 2012 10:10:35 +0000 (10:10 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 17 Oct 2012 10:10:35 +0000 (10:10 +0000)
config.status
po/Makefile.in
src/Makefile.am
src/Makefile.in
src/main.c
src/note.c [new file with mode: 0644]
src/note.h [new file with mode: 0644]

index cdd4a85..5adf104 100755 (executable)
@@ -432,7 +432,7 @@ Copyright (C) 2012 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
-ac_pwd='/home/jporsini/work.local/wpitchoune/svnpub/gtask/trunk'
+ac_pwd='/home/jporsini/work/wpitchoune/svnpub/gtask/trunk'
 srcdir='.'
 INSTALL='/usr/bin/install -c'
 MKDIR_P='/bin/mkdir -p'
@@ -685,12 +685,12 @@ S["mkdir_p"]="/bin/mkdir -p"
 S["MKDIR_P"]="/bin/mkdir -p"
 S["INSTALL_STRIP_PROGRAM"]="$(install_sh) -c -s"
 S["STRIP"]=""
-S["install_sh"]="${SHELL} /home/jporsini/work.local/wpitchoune/svnpub/gtask/trunk/install-sh"
-S["MAKEINFO"]="${SHELL} /home/jporsini/work.local/wpitchoune/svnpub/gtask/trunk/missing --run makeinfo"
-S["AUTOHEADER"]="${SHELL} /home/jporsini/work.local/wpitchoune/svnpub/gtask/trunk/missing --run autoheader"
-S["AUTOMAKE"]="${SHELL} /home/jporsini/work.local/wpitchoune/svnpub/gtask/trunk/missing --run automake-1.11"
-S["AUTOCONF"]="${SHELL} /home/jporsini/work.local/wpitchoune/svnpub/gtask/trunk/missing --run autoconf"
-S["ACLOCAL"]="${SHELL} /home/jporsini/work.local/wpitchoune/svnpub/gtask/trunk/missing --run aclocal-1.11"
+S["install_sh"]="${SHELL} /home/jporsini/work/wpitchoune/svnpub/gtask/trunk/install-sh"
+S["MAKEINFO"]="${SHELL} /home/jporsini/work/wpitchoune/svnpub/gtask/trunk/missing --run makeinfo"
+S["AUTOHEADER"]="${SHELL} /home/jporsini/work/wpitchoune/svnpub/gtask/trunk/missing --run autoheader"
+S["AUTOMAKE"]="${SHELL} /home/jporsini/work/wpitchoune/svnpub/gtask/trunk/missing --run automake-1.11"
+S["AUTOCONF"]="${SHELL} /home/jporsini/work/wpitchoune/svnpub/gtask/trunk/missing --run autoconf"
+S["ACLOCAL"]="${SHELL} /home/jporsini/work/wpitchoune/svnpub/gtask/trunk/missing --run aclocal-1.11"
 S["VERSION"]="0.0.x"
 S["PACKAGE"]="gtask"
 S["CYGPATH_W"]="echo"
index b94b43d..b93dffa 100644 (file)
@@ -34,12 +34,12 @@ INSTALL_DATA = ${INSTALL} -m 644
 # We use $(mkdir_p).
 # In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as
 # "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions,
-# ${SHELL} /home/jporsini/work.local/wpitchoune/svnpub/gtask/trunk/install-sh does not start with $(SHELL), so we add it.
+# ${SHELL} /home/jporsini/work/wpitchoune/svnpub/gtask/trunk/install-sh does not start with $(SHELL), so we add it.
 # In automake >= 1.10, /bin/mkdir -p is derived from ${MKDIR_P}, which is defined
 # either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake
 # versions, $(mkinstalldirs) and $(install_sh) are unused.
-mkinstalldirs = $(SHELL) ${SHELL} /home/jporsini/work.local/wpitchoune/svnpub/gtask/trunk/install-sh -d
-install_sh = $(SHELL) ${SHELL} /home/jporsini/work.local/wpitchoune/svnpub/gtask/trunk/install-sh
+mkinstalldirs = $(SHELL) ${SHELL} /home/jporsini/work/wpitchoune/svnpub/gtask/trunk/install-sh -d
+install_sh = $(SHELL) ${SHELL} /home/jporsini/work/wpitchoune/svnpub/gtask/trunk/install-sh
 MKDIR_P = /bin/mkdir -p
 mkdir_p = /bin/mkdir -p
 
index f76c8e8..6d64fa8 100644 (file)
@@ -12,6 +12,7 @@ LIBS = $(JSON_LIBS) $(GTK_LIBS)
 bin_PROGRAMS = gtask
 
 gtask_SOURCES = main.c \
+       note.c note.h \
        tw.c tw.h
 
 #dist_man_MANS = gtask.1
index 670c384..0e28399 100644 (file)
@@ -63,7 +63,7 @@ CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 am__installdirs = "$(DESTDIR)$(bindir)"
 PROGRAMS = $(bin_PROGRAMS)
-am_gtask_OBJECTS = main.$(OBJEXT) tw.$(OBJEXT)
+am_gtask_OBJECTS = main.$(OBJEXT) note.$(OBJEXT) tw.$(OBJEXT)
 gtask_OBJECTS = $(am_gtask_OBJECTS)
 gtask_LDADD = $(LDADD)
 DEFAULT_INCLUDES = -I.@am__isrc@
@@ -253,6 +253,7 @@ SUBDIRS = glade
 AM_LDFLAGS = -Wl,--as-needed  -export-dynamic
 AM_CPPFLAGS = -Wall -Werror $(GTK_CFLAGS) $(JSON_CFLAGS)
 gtask_SOURCES = main.c \
+       note.c note.h \
        tw.c tw.h
 
 all: all-recursive
@@ -340,6 +341,7 @@ distclean-compile:
        -rm -f *.tab.c
 
 @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)/tw.Po@am__quote@
 
 .c.o:
index 18c46eb..8844001 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <gtk/gtk.h>
 
+#include "note.h"
 #include "tw.h"
 
 static struct task **tasks;
@@ -171,17 +172,16 @@ static int tasksave_clicked_cbk(GtkButton *btn, gpointer data)
 
        printf("tasksave_clicked_cbk %d\n", task->id);
 
-       if (task->note) {
-               buf = gtk_text_view_get_buffer(w_note);
-
-               gtk_text_buffer_get_iter_at_offset(buf, &sIter, 0);
-               gtk_text_buffer_get_iter_at_offset(buf, &eIter, -1);
-               txt = gtk_text_buffer_get_text(buf, &sIter, &eIter, TRUE);
-
-               txt = escape(txt);
+       buf = gtk_text_view_get_buffer(w_note);
 
-               printf("%s\n", txt);
-       }
+       gtk_text_buffer_get_iter_at_offset(buf, &sIter, 0);
+       gtk_text_buffer_get_iter_at_offset(buf, &eIter, -1);
+       txt = gtk_text_buffer_get_text(buf, &sIter, &eIter, TRUE);
+       
+       printf("note=%s\n", txt);
+       
+       if (!task->note || strcmp(txt, task->note))
+               note_put(task->uuid, txt);
 
        ctxt = gtk_entry_get_text(w_description);
        if (!task->description || strcmp(ctxt, task->description))
diff --git a/src/note.c b/src/note.c
new file mode 100644 (file)
index 0000000..6e48e87
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2010-2012 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <note.h>
+
+void note_put(const char *uuid, const char *note)
+{
+       char *home, *dir, *path;
+       FILE *f;
+
+       home = getenv("HOME");
+
+       if (!home)
+               return ;
+
+       dir = malloc(strlen(home) + 1 + strlen(".task") + 1);
+       sprintf(dir, "%s/%s", home, ".task");
+       mkdir(dir, 0777);
+
+       path = malloc(strlen(dir) + 1 + strlen(uuid) + strlen(".note") + 1);
+       sprintf(path, "%s/%s.note", dir, uuid);
+
+       printf("note_put %s %s %s \n", path, uuid, note);
+
+       f = fopen(path, "w");
+
+       if (f) {
+               fwrite(note, 1, strlen(note), f);
+               fclose(f);
+       } else {
+               fprintf(stderr, "Failed to open %s\n", path);
+       }
+
+       free(dir);
+       free(path);
+}
diff --git a/src/note.h b/src/note.h
new file mode 100644 (file)
index 0000000..1462480
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2010-2012 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 _GTASK_NOTE_H_
+#define _GTASK_NOTE_H_
+
+#include "tw.h"
+
+void note_put(const char *uuid, const char *note);
+
+#endif