changeset 1595:9e2111452988

fixed keyword tree initialization
author nadvornik
date Thu, 07 May 2009 19:52:38 +0000
parents 3fbec0e63e6b
children b88069021d25
files src/bar_keywords.c src/metadata.c
diffstat 2 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/bar_keywords.c	Thu May 07 19:38:07 2009 +0000
+++ b/src/bar_keywords.c	Thu May 07 19:52:38 2009 +0000
@@ -1224,6 +1224,7 @@
 	GtkTreeModel *store;
 	GtkTreeViewColumn *column;
 	GtkCellRenderer *renderer;
+	GtkTreeIter iter;
 
 	pkd = g_new0(PaneKeywordsData, 1);
 
@@ -1273,7 +1274,11 @@
 	gtk_widget_show(scrolled);
 
 
-	if (!keyword_tree) keyword_tree_new_default();
+	if (!keyword_tree || !gtk_tree_model_get_iter_first(GTK_TREE_MODEL(keyword_tree), &iter))
+		{
+		/* keyword tree does not exist or is empty - fill with defaults */
+		keyword_tree_new_default();
+		}
 
 	store = gtk_tree_model_filter_new(GTK_TREE_MODEL(keyword_tree), NULL);
 
--- a/src/metadata.c	Thu May 07 19:38:07 2009 +0000
+++ b/src/metadata.c	Thu May 07 19:52:38 2009 +0000
@@ -1333,11 +1333,9 @@
 
 void keyword_tree_new_default(void)
 {
-	if (keyword_tree) return;
-	
-	keyword_tree_new();
+	GtkTreeIter i1, i2, i3;
 
-	GtkTreeIter i1, i2, i3;
+	if (!keyword_tree) keyword_tree_new();
 
 	i1 = keyword_tree_default_append(keyword_tree, NULL, _("People"), TRUE); 
 		i2 = keyword_tree_default_append(keyword_tree, &i1, _("Family"), TRUE);