Mercurial > geeqie.yaz
changeset 1456:b24391991f7f
improved expanding and hiding of helper keywords
author | nadvornik |
---|---|
date | Tue, 17 Mar 2009 18:58:15 +0000 |
parents | 2545780d4779 |
children | 5c0ecb2ebbc5 |
files | src/bar_keywords.c src/metadata.c |
diffstat | 2 files changed, 17 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/bar_keywords.c Tue Mar 17 18:30:53 2009 +0000 +++ b/src/bar_keywords.c Tue Mar 17 18:58:15 2009 +0000 @@ -163,12 +163,10 @@ { PaneKeywordsData *pkd = data; gboolean set; - gboolean is_keyword; - gtk_tree_model_get(model, iter, FILTER_KEYWORD_COLUMN_TOGGLE, &set, - FILTER_KEYWORD_COLUMN_IS_KEYWORD, &is_keyword, -1); + gtk_tree_model_get(model, iter, FILTER_KEYWORD_COLUMN_TOGGLE, &set, -1); - if (is_keyword && !set && gtk_tree_view_row_expanded(GTK_TREE_VIEW(pkd->keyword_treeview), path)) + if (!set && gtk_tree_view_row_expanded(GTK_TREE_VIEW(pkd->keyword_treeview), path)) { gtk_tree_view_collapse_row(GTK_TREE_VIEW(pkd->keyword_treeview), path); }
--- a/src/metadata.c Tue Mar 17 18:30:53 2009 +0000 +++ b/src/metadata.c Tue Mar 17 18:58:15 2009 +0000 @@ -917,6 +917,20 @@ static gboolean keyword_tree_is_set_casefold(GtkTreeModel *keyword_tree, GtkTreeIter iter, GList *casefold_list) { if (!casefold_list) return FALSE; + + if (!keyword_get_is_keyword(keyword_tree, &iter)) + { + /* for the purpose of expanding and hiding, a helper is set if it has any children set */ + GtkTreeIter child; + if (!gtk_tree_model_iter_children(keyword_tree, &child, &iter)) + return FALSE; /* this should happen only on empty helpers */ + + while (TRUE) + { + if (keyword_tree_is_set_casefold(keyword_tree, child, casefold_list)) return TRUE; + if (!gtk_tree_model_iter_next(keyword_tree, &child)) return FALSE; + } + } while (TRUE) { @@ -953,8 +967,6 @@ GList *casefold_list = NULL; GList *work; - if (!keyword_get_is_keyword(keyword_tree, iter)) return FALSE; - work = kw_list; while (work) { @@ -1130,8 +1142,7 @@ GtkTreeIter iter = *iter_ptr; while (TRUE) { - if (keyword_get_is_keyword(GTK_TREE_MODEL(keyword_tree), &iter) && - !keyword_tree_is_set(GTK_TREE_MODEL(keyword_tree), &iter, keywords)) + if (!keyword_tree_is_set(GTK_TREE_MODEL(keyword_tree), &iter, keywords)) { keyword_hide_in(keyword_tree, &iter, id); /* no need to check children of hidden node */