# HG changeset patch # User nadvornik # Date 1237316295 0 # Node ID b24391991f7f58405c4a49ae1c6797f89544550b # Parent 2545780d477904d854f13d0bfae27613e9afd074 improved expanding and hiding of helper keywords diff -r 2545780d4779 -r b24391991f7f src/bar_keywords.c --- 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); } diff -r 2545780d4779 -r b24391991f7f src/metadata.c --- 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 */