allow to change the directory containing the notes.
authorJean-Philippe Orsini <jeanfi@gmail.com>
Tue, 21 Jan 2014 08:25:13 +0000 (08:25 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Tue, 21 Jan 2014 08:25:13 +0000 (08:25 +0000)
NEWS
NEWS.html
config.status
po/Makefile
po/Makefile.in
src/note.c
src/settings.c
src/settings.h
src/ui.c

diff --git a/NEWS b/NEWS
index 014f504..91f1354 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ v0.0.5
  * added creation date, due, id, uuid, urgency, and start date in the
    list of tasks.
  * popup menu to filter columns of the table of tasks.
+ * allow to change the directory containing the notes.
 
 v0.0.4
 ------
index 37ac5a7..f13f412 100644 (file)
--- a/NEWS.html
+++ b/NEWS.html
@@ -367,6 +367,11 @@ added creation date, due, id, uuid, urgency, and start date in the
 popup menu to filter columns of the table of tasks.\r
 </p>\r
 </li>\r
+<li>\r
+<p>\r
+allow to change the directory containing the notes.\r
+</p>\r
+</li>\r
 </ul></div>\r
 </div>\r
 </div>\r
@@ -512,7 +517,7 @@ Initial release.
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Last updated 2013-12-10 08:57:18 CET\r
+Last updated 2014-01-21 09:21:30 CET\r
 </div>\r
 </div>\r
 </body>\r
index 7ac0c65..675ff48 100755 (executable)
@@ -428,7 +428,7 @@ $config_commands
 Report bugs to <jeanfi@gmail.com>.
 ptask home page: <http://wpitchoune.net/ptask>."
 
-ac_cs_config=""
+ac_cs_config="'--prefix=/tmp'"
 ac_cs_version="\
 ptask config.status 0.0.x
 configured by ./configure, generated by GNU Autoconf 2.69,
@@ -520,7 +520,7 @@ if $ac_cs_silent; then
 fi
 
 if $ac_cs_recheck; then
-  set X /bin/bash './configure'  $ac_configure_extra_args --no-create --no-recursion
+  set X /bin/bash './configure'  '--prefix=/tmp' $ac_configure_extra_args --no-create --no-recursion
   shift
   $as_echo "running CONFIG_SHELL=/bin/bash $*" >&6
   CONFIG_SHELL='/bin/bash'
@@ -797,7 +797,7 @@ S["libexecdir"]="${exec_prefix}/libexec"
 S["sbindir"]="${exec_prefix}/sbin"
 S["bindir"]="${exec_prefix}/bin"
 S["program_transform_name"]="s,x,x,"
-S["prefix"]="/usr/local"
+S["prefix"]="/tmp"
 S["exec_prefix"]="${prefix}"
 S["PACKAGE_URL"]="http://wpitchoune.net/ptask"
 S["PACKAGE_BUGREPORT"]="jeanfi@gmail.com"
index 430bf0b..ea8150b 100644 (file)
@@ -21,7 +21,7 @@ srcdir = .
 top_srcdir = ..
 
 
-prefix = /usr/local
+prefix = /tmp
 exec_prefix = ${prefix}
 datarootdir = ${prefix}/share
 datadir = ${datarootdir}
index 9db3564..ca508b4 100644 (file)
@@ -21,7 +21,7 @@ srcdir = .
 top_srcdir = ..
 
 
-prefix = /usr/local
+prefix = /tmp
 exec_prefix = ${prefix}
 datarootdir = ${prefix}/share
 datadir = ${datarootdir}
index be9d87a..247d8d9 100644 (file)
@@ -53,11 +53,11 @@ static char *get_path(const char *uuid)
        const char *sdir;
        char *path, *dir;
 
-       sdir = settings_get_str(SETTINGS_KEY_NOTES_DIR);
+       sdir = settings_get_notes_dir();
 
        if (sdir == NULL || *sdir == '\0') {
                dir = get_default_path();
-               settings_set_str(SETTINGS_KEY_NOTES_DIR, dir);
+               settings_set_notes_dir(dir);
        } else {
                dir = strdup(sdir);
        }
index be6e87c..8dd8d04 100644 (file)
@@ -77,3 +77,13 @@ void settings_set_str(const gchar *key, const gchar *value)
 {
        g_settings_set_string(settings, key, value);
 }
+
+const char *settings_get_notes_dir()
+{
+       return settings_get_str(SETTINGS_KEY_NOTES_DIR);
+}
+
+void settings_set_notes_dir(const char *dir)
+{
+       settings_set_str(SETTINGS_KEY_NOTES_DIR, dir);
+}
index 8453c10..8fa2ed3 100644 (file)
@@ -30,7 +30,6 @@ extern const char *SETTINGS_KEY_SPLITER_VERTICAL_POS;
 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();
@@ -42,4 +41,7 @@ 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);
 
+const char *settings_get_notes_dir();
+void settings_set_notes_dir(const char *dir);
+
 #endif
index d28d87b..2cc8107 100644 (file)
--- a/src/ui.c
+++ b/src/ui.c
@@ -172,6 +172,7 @@ void preferences_activate_cbk(GtkWidget *menu_item, gpointer data)
        GtkBuilder *builder;
        GtkFileChooser *w_dir;
        char *dir;
+       const char *sdir;
 
        builder = gtk_builder_new();
        gtk_builder_add_from_file
@@ -184,6 +185,10 @@ void preferences_activate_cbk(GtkWidget *menu_item, gpointer data)
        w_dir = GTK_FILE_CHOOSER(gtk_builder_get_object(builder,
                                                        "dir_chooser"));
 
+       sdir = settings_get_notes_dir();
+       if (sdir && *sdir)
+               gtk_file_chooser_set_filename(w_dir, sdir);
+
        result = gtk_dialog_run(diag);
 
        if (result) {
@@ -192,9 +197,11 @@ void preferences_activate_cbk(GtkWidget *menu_item, gpointer data)
 
                if (dir) {
                        log_debug("preferences_activate_cbk(): path=%s", dir);
+                       settings_set_notes_dir(dir);
                        free(dir);
                }
 
+               refresh();
        } else {
                log_debug("preferences_activate_cbk(): cancel");
        }