diff src/bar_keywords.c @ 1527:12b0eeb5d528

Nest new keywords inside existing It is boring to first add a bunch of keywords and then move them to the new location. It is more natural to add them as child to existing ons.
author mow
date Mon, 06 Apr 2009 23:59:54 +0000
parents 51b9d42ed79b
children c8ac214a2fca
line wrap: on
line diff
--- a/src/bar_keywords.c	Mon Apr 06 23:59:38 2009 +0000
+++ b/src/bar_keywords.c	Mon Apr 06 23:59:54 2009 +0000
@@ -794,26 +794,31 @@
 	else
 		{
 		GList *work = keywords;
+		gboolean append_to = FALSE;
 
 		while (work)
 			{
 			GtkTreeIter add;
-			if (keyword_exists(keyword_tree, NULL, have_dest ? &kw_iter : NULL, work->data, FALSE, NULL))
+			if (keyword_exists(keyword_tree, NULL, (have_dest || append_to) ? &kw_iter : NULL, work->data, FALSE, NULL))
 				{
 				work = work->next;
 				continue;
 				}
 			if (have_dest)
 				{
+				gtk_tree_store_append(GTK_TREE_STORE(keyword_tree), &add, &kw_iter);
+				}
+			else if (append_to)
+				{
 				gtk_tree_store_insert_after(GTK_TREE_STORE(keyword_tree), &add, NULL, &kw_iter);
 				}
 			else
 				{
 				gtk_tree_store_append(GTK_TREE_STORE(keyword_tree), &add, NULL);
-				have_dest = TRUE;
+				append_to = TRUE;
+				kw_iter = add;
 				}
-			kw_iter = add;
-			keyword_set(GTK_TREE_STORE(keyword_tree), &kw_iter, work->data, cdd->is_keyword);
+			keyword_set(GTK_TREE_STORE(keyword_tree), &add, work->data, cdd->is_keyword);
 			work = work->next;
 			}
 		}