diff finch/libgnt/gnttree.c @ 18564:36257cac2b11

Anoter patch from Javeed Shaikh to introduce a utility function for a tree. I changed it a bit, but hopefully I didn't break the patch in the process.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 19 Jul 2007 21:34:35 +0000
parents dba4edbde4a7
children 3c634117a7ef
line wrap: on
line diff
--- a/finch/libgnt/gnttree.c	Thu Jul 19 21:11:37 2007 +0000
+++ b/finch/libgnt/gnttree.c	Thu Jul 19 21:34:35 2007 +0000
@@ -1363,24 +1363,30 @@
 	return NULL;
 }
 
-GList *gnt_tree_get_selection_text_list(GntTree *tree)
+GList *gnt_tree_get_row_text_list(GntTree *tree, gpointer key)
 {
 	GList *list = NULL, *iter;
+	GntTreeRow *row = key ? g_hash_table_lookup(tree->hash, key) : tree->current;
 	int i;
 
-	if (!tree->current)
+	if (!row)
 		return NULL;
 
-	for (i = 0, iter = tree->current->columns; i < tree->ncol && iter;
+	for (i = 0, iter = row->columns; i < tree->ncol && iter;
 			i++, iter = iter->next)
 	{
 		GntTreeCol *col = iter->data;
-		list = g_list_append(list, g_strdup(col->text));
+		list = g_list_append(list, BINARY_DATA(tree, i) ? col->text : g_strdup(col->text));
 	}
 
 	return list;
 }
 
+GList *gnt_tree_get_selection_text_list(GntTree *tree)
+{
+	return gnt_tree_get_row_text_list(tree, NULL);
+}
+
 void gnt_tree_remove(GntTree *tree, gpointer key)
 {
 	GntTreeRow *row = g_hash_table_lookup(tree->hash, key);