[anjal] Fix issue with odd message lists. Validate them



commit a94f43582faef69317469c34dac8d0fc5985a5f6
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Wed Dec 16 16:25:50 2009 +0530

    Fix issue with odd message lists. Validate them

 src/em-tree-store.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/src/em-tree-store.c b/src/em-tree-store.c
index 6e60f8c..e2f5b64 100644
--- a/src/em-tree-store.c
+++ b/src/em-tree-store.c
@@ -218,6 +218,22 @@ emts_calc_path(EMTreeNode *node, GtkTreePath *path)
 	}
 }
 
+static gboolean
+validate_path (EMTreeNode *node)
+{
+	EMTreeNode *save = node, *next;
+	gboolean valid = TRUE;
+	next = node->parent;
+
+	while (valid && next) {
+		if (next == save)
+			valid = FALSE;
+		next = next->parent;
+	}
+
+	return valid;
+}
+
 static GtkTreePath *
 emts_get_path(GtkTreeModel *tree_model, GtkTreeIter  *iter)
 {
@@ -228,7 +244,10 @@ emts_get_path(GtkTreeModel *tree_model, GtkTreeIter  *iter)
 	g_return_val_if_fail (iter->stamp == EMTS (tree_model)->stamp, NULL);
 
 	path = gtk_tree_path_new();
-	emts_calc_path((EMTreeNode *)iter->user_data, path);
+	if (validate_path ((EMTreeNode *)iter->user_data))
+		emts_calc_path((EMTreeNode *)iter->user_data, path);
+	else
+		gtk_tree_path_append_index(path, 0);
 
 	return path;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]