keep focus on table items
authorJean-Philippe Orsini <jeanfi@gmail.com>
Mon, 2 Dec 2013 11:24:14 +0000 (11:24 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Mon, 2 Dec 2013 11:24:14 +0000 (11:24 +0000)
NEWS
NEWS.html
config.status
po/Makefile
po/Makefile.in
src/main.c
src/ui_projecttree.c
src/ui_tasktree.c

diff --git a/NEWS b/NEWS
index ae94036..9d74ca0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,12 @@
 What's New
 ==========
 
+v0.0.5
+------
+
+ * focus to first item when selecting a project.
+ * keep focus on project after refresh.
+
 v0.0.4
 ------
 
index bf3a333..fbf780a 100644 (file)
--- a/NEWS.html
+++ b/NEWS.html
@@ -318,6 +318,23 @@ asciidoc.install();
 </div>\r
 <div id="content">\r
 <div class="sect1">\r
+<h2 id="_v0_0_5">v0.0.5</h2>\r
+<div class="sectionbody">\r
+<div class="ulist"><ul>\r
+<li>\r
+<p>\r
+focus to first item when selecting a project.\r
+</p>\r
+</li>\r
+<li>\r
+<p>\r
+keep focus on project after refresh.\r
+</p>\r
+</li>\r
+</ul></div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
 <h2 id="_v0_0_4">v0.0.4</h2>\r
 <div class="sectionbody">\r
 <div class="ulist"><ul>\r
@@ -459,7 +476,7 @@ Initial release.
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Last updated 2013-12-01 13:58:06 CET\r
+Last updated 2013-12-02 12:23:12 CET\r
 </div>\r
 </div>\r
 </body>\r
index cc4991f..cb70d4c 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'
@@ -793,7 +793,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 8322e5f..980102b 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 85e5b8c..880bde4 100644 (file)
@@ -95,20 +95,24 @@ static void print_help()
 void refresh()
 {
        GtkWidget *dialog;
+       const char *current_prj;
 
        log_fct_enter();
        ui_taskpanel_update(NULL);
 
        if (tasks) {
+               current_prj = ui_projecttree_get_project();
                ui_tasktree_update(NULL, NULL);
                tw_task_list_free(tasks);
+       } else {
+               current_prj = NULL;
        }
 
        tasks = tw_get_all_tasks(ui_get_status_filter());
 
        if (tasks) {
                ui_projecttree_update(tasks);
-               ui_tasktree_update(tasks, NULL);
+               ui_tasktree_update(tasks, current_prj);
        } else {
                dialog = gtk_message_dialog_new(NULL,
                                                GTK_DIALOG_DESTROY_WITH_PARENT,
index 2e4f4ed..d249b29 100644 (file)
@@ -17,6 +17,7 @@
  * 02110-1301 USA
  */
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include <log.h>
@@ -32,9 +33,13 @@ static GtkTreeView *w_treeview;
 
 static int cursor_changed_cbk(GtkTreeView *treeview, gpointer data)
 {
+       const char *prj;
+
        log_fct_enter();
 
-       ui_tasktree_update_filter(ui_projecttree_get_project());
+       prj = ui_projecttree_get_project();
+
+       ui_tasktree_update_filter(prj);
 
        log_fct_exit();
 
@@ -87,10 +92,15 @@ void ui_projecttree_update(struct task **ts)
        struct project **prjs, **cur;
        GtkTreeModel *model;
        GtkTreeIter iter;
+       GtkTreePath *p;
+       const char *current_prj;
 
        log_fct_enter();
 
        model = gtk_tree_view_get_model(GTK_TREE_VIEW(w_treeview));
+
+       current_prj = ui_projecttree_get_project();
+
        gtk_list_store_clear(GTK_LIST_STORE(model));
 
        prjs = tw_get_projects(ts);
@@ -102,6 +112,18 @@ void ui_projecttree_update(struct task **ts)
                                   COL_NAME, (*cur)->name,
                                   COL_COUNT, (*cur)->count,
                                   -1);
+
+               if (current_prj) {
+                       if (!strcmp((*cur)->name, current_prj)) {
+                               p = gtk_tree_model_get_path(model, &iter);
+                               if (p) {
+                                       gtk_tree_view_set_cursor(w_treeview,
+                                                                p,
+                                                                NULL,
+                                                                FALSE);
+                               }
+                       }
+               }
        }
 
        tw_project_list_free(prjs);
index 4f9ab1a..e879b4d 100644 (file)
@@ -166,6 +166,7 @@ void ui_tasktree_update(struct task **tasks, const char *prj_filter)
        struct task *task;
        GtkTreeIter iter;
        const char *prj;
+       GtkTreePath *p;
 
        current_tasks = tasks;
 
@@ -186,7 +187,6 @@ void ui_tasktree_update(struct task **tasks, const char *prj_filter)
 
                        gtk_list_store_append(GTK_LIST_STORE(model), &iter);
 
-
                        gtk_list_store_set(GTK_LIST_STORE(model),
                                           &iter,
                                           COL_ID, (*tasks_cur)->id,
@@ -197,6 +197,9 @@ void ui_tasktree_update(struct task **tasks, const char *prj_filter)
                                           COL_PRIORITY, (*tasks_cur)->priority,
                                           -1);
                }
+
+               p = gtk_tree_path_new_first();
+               gtk_tree_view_set_cursor(w_treeview, p, NULL, FALSE);
        }
 
 }