From: Jean-Philippe Orsini Date: Sun, 1 Dec 2013 11:13:42 +0000 (+0000) Subject: project filtering X-Git-Tag: v0.0.6~50 X-Git-Url: https://git.wpitchoune.net/gitweb/?p=ptask.git;a=commitdiff_plain;h=f23f892146f30006a6ebb3c4dcf0c7777a4a5c68 project filtering --- diff --git a/config.status b/config.status index e69bc53..fd63cd8 100755 --- a/config.status +++ b/config.status @@ -428,7 +428,7 @@ $config_commands Report bugs to . ptask home page: ." -ac_cs_config="'CFLAGS=-O1' '--prefix=/tmp'" +ac_cs_config="'--prefix=/tmp' 'CFLAGS=-O1'" ac_cs_version="\ ptask config.status 0.0.x configured by ./configure, generated by GNU Autoconf 2.69, @@ -438,7 +438,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/ptask/trunk' +ac_pwd='/home/jporsini/work/wpitchoune/svnpub/ptask/trunk' srcdir='.' INSTALL='/usr/bin/install -c' MKDIR_P='/bin/mkdir -p' @@ -520,7 +520,7 @@ if $ac_cs_silent; then fi if $ac_cs_recheck; then - set X /bin/bash './configure' 'CFLAGS=-O1' '--prefix=/tmp' $ac_configure_extra_args --no-create --no-recursion + set X /bin/bash './configure' '--prefix=/tmp' 'CFLAGS=-O1' $ac_configure_extra_args --no-create --no-recursion shift $as_echo "running CONFIG_SHELL=/bin/bash $*" >&6 CONFIG_SHELL='/bin/bash' @@ -752,12 +752,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/ptask/trunk/install-sh" -S["MAKEINFO"]="${SHELL} /home/jporsini/work.local/wpitchoune/svnpub/ptask/trunk/missing --run makeinfo" -S["AUTOHEADER"]="${SHELL} /home/jporsini/work.local/wpitchoune/svnpub/ptask/trunk/missing --run autoheader" -S["AUTOMAKE"]="${SHELL} /home/jporsini/work.local/wpitchoune/svnpub/ptask/trunk/missing --run automake-1.11" -S["AUTOCONF"]="${SHELL} /home/jporsini/work.local/wpitchoune/svnpub/ptask/trunk/missing --run autoconf" -S["ACLOCAL"]="${SHELL} /home/jporsini/work.local/wpitchoune/svnpub/ptask/trunk/missing --run aclocal-1.11" +S["install_sh"]="${SHELL} /home/jporsini/work/wpitchoune/svnpub/ptask/trunk/install-sh" +S["MAKEINFO"]="${SHELL} /home/jporsini/work/wpitchoune/svnpub/ptask/trunk/missing --run makeinfo" +S["AUTOHEADER"]="${SHELL} /home/jporsini/work/wpitchoune/svnpub/ptask/trunk/missing --run autoheader" +S["AUTOMAKE"]="${SHELL} /home/jporsini/work/wpitchoune/svnpub/ptask/trunk/missing --run automake-1.11" +S["AUTOCONF"]="${SHELL} /home/jporsini/work/wpitchoune/svnpub/ptask/trunk/missing --run autoconf" +S["ACLOCAL"]="${SHELL} /home/jporsini/work/wpitchoune/svnpub/ptask/trunk/missing --run aclocal-1.11" S["VERSION"]="0.0.x" S["PACKAGE"]="ptask" S["CYGPATH_W"]="echo" diff --git a/po/Makefile b/po/Makefile index db8c0d8..980102b 100644 --- a/po/Makefile +++ b/po/Makefile @@ -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/ptask/trunk/install-sh does not start with $(SHELL), so we add it. +# ${SHELL} /home/jporsini/work/wpitchoune/svnpub/ptask/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/ptask/trunk/install-sh -d -install_sh = $(SHELL) ${SHELL} /home/jporsini/work.local/wpitchoune/svnpub/ptask/trunk/install-sh +mkinstalldirs = $(SHELL) ${SHELL} /home/jporsini/work/wpitchoune/svnpub/ptask/trunk/install-sh -d +install_sh = $(SHELL) ${SHELL} /home/jporsini/work/wpitchoune/svnpub/ptask/trunk/install-sh MKDIR_P = /bin/mkdir -p mkdir_p = /bin/mkdir -p diff --git a/po/Makefile.in b/po/Makefile.in index 13ef718..ca508b4 100644 --- a/po/Makefile.in +++ b/po/Makefile.in @@ -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/ptask/trunk/install-sh does not start with $(SHELL), so we add it. +# ${SHELL} /home/jporsini/work/wpitchoune/svnpub/ptask/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/ptask/trunk/install-sh -d -install_sh = $(SHELL) ${SHELL} /home/jporsini/work.local/wpitchoune/svnpub/ptask/trunk/install-sh +mkinstalldirs = $(SHELL) ${SHELL} /home/jporsini/work/wpitchoune/svnpub/ptask/trunk/install-sh -d +install_sh = $(SHELL) ${SHELL} /home/jporsini/work/wpitchoune/svnpub/ptask/trunk/install-sh MKDIR_P = /bin/mkdir -p mkdir_p = /bin/mkdir -p diff --git a/src/glade/ptask.glade b/src/glade/ptask.glade index 569bdc1..c072be4 100644 --- a/src/glade/ptask.glade +++ b/src/glade/ptask.glade @@ -359,7 +359,7 @@ True - False + True projectstore diff --git a/src/main.c b/src/main.c index 757ac46..85e5b8c 100644 --- a/src/main.c +++ b/src/main.c @@ -95,49 +95,20 @@ static void print_help() void refresh() { GtkWidget *dialog; - GtkTreeModel *model; - struct task **tasks_cur; - struct task *task; - int i; - GtkTreeIter iter; - const char *project; log_fct_enter(); ui_taskpanel_update(NULL); if (tasks) { - ui_tasktree_update(NULL); + ui_tasktree_update(NULL, NULL); tw_task_list_free(tasks); } tasks = tw_get_all_tasks(ui_get_status_filter()); - model = gtk_tree_view_get_model(GTK_TREE_VIEW(w_treeview)); - gtk_list_store_clear(GTK_LIST_STORE(model)); - if (tasks) { - for (tasks_cur = tasks, i = 0; *tasks_cur; tasks_cur++, i++) { - task = (*tasks_cur); - - gtk_list_store_append(GTK_LIST_STORE(model), &iter); - - if (task->project) - project = task->project; - else - project = ""; - - gtk_list_store_set(GTK_LIST_STORE(model), - &iter, - COL_ID, (*tasks_cur)->id, - COL_DESCRIPTION, - (*tasks_cur)->description, - COL_PROJECT, project, - COL_UUID, (*tasks_cur)->uuid, - COL_PRIORITY, (*tasks_cur)->priority, - -1); - } ui_projecttree_update(tasks); - ui_tasktree_update(tasks); + ui_tasktree_update(tasks, NULL); } else { dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, diff --git a/src/ui_projecttree.c b/src/ui_projecttree.c index c8e30ae..2e4f4ed 100644 --- a/src/ui_projecttree.c +++ b/src/ui_projecttree.c @@ -21,6 +21,7 @@ #include #include +#include enum { COL_NAME, @@ -29,10 +30,24 @@ enum { static GtkTreeView *w_treeview; +static int cursor_changed_cbk(GtkTreeView *treeview, gpointer data) +{ + log_fct_enter(); + + ui_tasktree_update_filter(ui_projecttree_get_project()); + + log_fct_exit(); + + return FALSE; +} + void ui_projecttree_init(GtkBuilder *builder) { w_treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "projecttree")); + g_signal_connect(w_treeview, + "cursor-changed", (GCallback)cursor_changed_cbk, + NULL); } const char *ui_projecttree_get_project() @@ -54,6 +69,9 @@ const char *ui_projecttree_get_project() gtk_tree_model_get_value(model, &iter, COL_NAME, &value); prj = g_value_get_string(&value); + + if (!strcmp(prj, "ALL")) + prj = NULL; } else { prj = NULL; } diff --git a/src/ui_tasktree.c b/src/ui_tasktree.c index 16707db..4f9ab1a 100644 --- a/src/ui_tasktree.c +++ b/src/ui_tasktree.c @@ -21,6 +21,7 @@ #include #include +#include #include static GtkTreeView *w_treeview; @@ -158,7 +159,49 @@ struct task *ui_tasktree_get_selected_task() return result; } -void ui_tasktree_update(struct task **tasks) +void ui_tasktree_update(struct task **tasks, const char *prj_filter) { + GtkTreeModel *model; + struct task **tasks_cur; + struct task *task; + GtkTreeIter iter; + const char *prj; + current_tasks = tasks; + + model = gtk_tree_view_get_model(GTK_TREE_VIEW(w_treeview)); + gtk_list_store_clear(GTK_LIST_STORE(model)); + + if (current_tasks) { + for (tasks_cur = current_tasks; *tasks_cur; tasks_cur++) { + task = (*tasks_cur); + + if (task->project) + prj = task->project; + else + prj = ""; + + if (prj_filter && strcmp(prj, prj_filter)) + continue; + + gtk_list_store_append(GTK_LIST_STORE(model), &iter); + + + gtk_list_store_set(GTK_LIST_STORE(model), + &iter, + COL_ID, (*tasks_cur)->id, + COL_DESCRIPTION, + (*tasks_cur)->description, + COL_PROJECT, prj, + COL_UUID, (*tasks_cur)->uuid, + COL_PRIORITY, (*tasks_cur)->priority, + -1); + } + } + +} + +void ui_tasktree_update_filter(const char *prj_filter) +{ + ui_tasktree_update(current_tasks, prj_filter); } diff --git a/src/ui_tasktree.h b/src/ui_tasktree.h index b08877a..7589552 100644 --- a/src/ui_tasktree.h +++ b/src/ui_tasktree.h @@ -27,6 +27,7 @@ void ui_tasktree_init(GtkBuilder *); void ui_tasktree_load_settings(GSettings *); void ui_tasktree_save_settings(GSettings *); struct task *ui_tasktree_get_selected_task(); -void ui_tasktree_update(struct task **); +void ui_tasktree_update(struct task **, const char *); +void ui_tasktree_update_filter(const char *); #endif