Report bugs to <jeanfi@gmail.com>.
ptask home page: <http://wpitchoune.net/ptask>."
-ac_cs_config="'--prefix=/tmp'"
+ac_cs_config=""
ac_cs_version="\
ptask config.status 0.0.x
configured by ./configure, generated by GNU Autoconf 2.69,
fi
if $ac_cs_recheck; then
- set X /bin/bash './configure' '--prefix=/tmp' $ac_configure_extra_args --no-create --no-recursion
+ set X /bin/bash './configure' $ac_configure_extra_args --no-create --no-recursion
shift
$as_echo "running CONFIG_SHELL=/bin/bash $*" >&6
CONFIG_SHELL='/bin/bash'
S["sbindir"]="${exec_prefix}/sbin"
S["bindir"]="${exec_prefix}/bin"
S["program_transform_name"]="s,x,x,"
-S["prefix"]="/tmp"
+S["prefix"]="/usr/local"
S["exec_prefix"]="${prefix}"
S["PACKAGE_URL"]="http://wpitchoune.net/ptask"
S["PACKAGE_BUGREPORT"]="jeanfi@gmail.com"
top_srcdir = ..
-prefix = /tmp
+prefix = /usr/local
exec_prefix = ${prefix}
datarootdir = ${prefix}/share
datadir = ${datarootdir}
top_srcdir = ..
-prefix = /tmp
+prefix = /usr/local
exec_prefix = ${prefix}
datarootdir = ${prefix}/share
datadir = ${datarootdir}
log.c log.h \
main.c \
note.c note.h \
+ pio.c pio.h \
pstr.c pstr.h \
ptime.c ptime.h \
settings.c settings.h \
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
PROGRAMS = $(bin_PROGRAMS)
am_ptask_OBJECTS = list.$(OBJEXT) log.$(OBJEXT) main.$(OBJEXT) \
- note.$(OBJEXT) pstr.$(OBJEXT) ptime.$(OBJEXT) \
+ note.$(OBJEXT) pio.$(OBJEXT) pstr.$(OBJEXT) ptime.$(OBJEXT) \
settings.$(OBJEXT) tw.$(OBJEXT) ui.$(OBJEXT) \
ui_newtask_diag.$(OBJEXT) ui_projecttree.$(OBJEXT) \
ui_taskpanel.$(OBJEXT) ui_tasktree.$(OBJEXT)
log.c log.h \
main.c \
note.c note.h \
+ pio.c pio.h \
pstr.c pstr.h \
ptime.c ptime.h \
settings.c settings.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)/pio.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)/settings.Po@am__quote@
</packing>
</child>
<child>
- <object class="GtkFileChooserButton" id="filechooserbutton1">
+ <object class="GtkFileChooserButton" id="dir_chooser">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
</object>
</child>
<action-widgets>
- <action-widget response="0">button3</action-widget>
+ <action-widget response="1">button3</action-widget>
<action-widget response="0">button4</action-widget>
</action-widgets>
</object>
#include <log.h>
#include <note.h>
+#include <pio.h>
+#include <settings.h>
-static char *get_default_path(const char *uuid)
+static const char *NOTE_SUF = ".note";
+
+static char *get_default_path()
{
- char *home, *dir, *path;
+ char *home, *dir;
home = getenv("HOME");
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);
-
- free(dir);
-
- return path;
+ return dir;
}
static char *get_path(const char *uuid)
{
- return get_default_path(uuid);
+ const char *sdir;
+ char *path, *dir;
+
+ sdir = settings_get_str(SETTINGS_KEY_NOTES_DIR);
+
+ if (sdir == NULL || *sdir == '\0') {
+ dir = get_default_path();
+ settings_set_str(SETTINGS_KEY_NOTES_DIR, dir);
+ } else {
+ dir = strdup(sdir);
+ }
+
+ mkdirs(dir, 0777);
+
+ path = malloc(strlen(dir) + 1 + strlen(uuid) + strlen(NOTE_SUF) + 1);
+ sprintf(path, "%s/%s%s", dir, uuid, NOTE_SUF);
+
+ free(dir);
+
+ return path;
}
void note_put(const char *uuid, const char *note)
const char *SETTINGS_KEY_SPLITER_HORIZONTAL_POS = "spliter-horizontal-pos";
const char *SETTINGS_KEY_TASKS_SORT_COL = "tasks-sort-col";
const char *SETTINGS_KEY_TASKS_SORT_ORDER = "tasks-sort-order";
+const char *SETTINGS_KEY_NOTES_DIR = "notes-dir";
const char * const SETTINGS_VISIBLE_COL_KEYS[] = {
"tasktree-id-visible",
{
g_settings_set_boolean(settings, key, value);
}
+
+gchar *settings_get_str(const gchar *key)
+{
+ return g_settings_get_string(settings, key);
+}
+
+void settings_set_str(const gchar *key, const gchar *value)
+{
+ g_settings_set_string(settings, key, value);
+}
extern const char *SETTINGS_KEY_SPLITER_HORIZONTAL_POS;
extern const char *SETTINGS_KEY_TASKS_SORT_COL;
extern const char *SETTINGS_KEY_TASKS_SORT_ORDER;
+extern const char *SETTINGS_KEY_NOTES_DIR;
extern const char * const SETTINGS_VISIBLE_COL_KEYS[];
void settings_init();
void settings_set_int(const gchar *key, gint value);
gboolean settings_get_boolean(const gchar *key);
void settings_set_boolean(const gchar *key, gboolean value);
+gchar *settings_get_str(const gchar *key);
+void settings_set_str(const gchar *key, const gchar *value);
#endif
*/
#include <config.h>
+#include <stdlib.h>
+
#include <glib/gi18n.h>
#include <log.h>
log_fct_exit();
}
-
-
void preferences_activate_cbk(GtkWidget *menu_item, gpointer data)
{
gint result;
static GtkDialog *diag;
GtkBuilder *builder;
+ GtkFileChooser *w_dir;
+ char *dir;
builder = gtk_builder_new();
gtk_builder_add_from_file
diag = GTK_DIALOG(gtk_builder_get_object(builder, "diag_preferences"));
gtk_builder_connect_signals(builder, NULL);
+ w_dir = GTK_FILE_CHOOSER(gtk_builder_get_object(builder,
+ "dir_chooser"));
+
result = gtk_dialog_run(diag);
- if (result == GTK_RESPONSE_ACCEPT)
+ if (result) {
log_debug("preferences_activate_cbk(): accept");
- else
+ dir = gtk_file_chooser_get_filename(w_dir);
+
+ if (dir) {
+ log_debug("preferences_activate_cbk(): path=%s", dir);
+ free(dir);
+ }
+
+ } else {
log_debug("preferences_activate_cbk(): cancel");
+ }
g_object_unref(G_OBJECT(builder));