diff console/libgnt/gnttree.c @ 15158:68385f5bbd61

[gaim-migrate @ 17944] Generate the marshal-things during make when necessary. Allow specifying the hash-functions for a GntTree. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 10 Dec 2006 09:26:44 +0000
parents 34e049e6ce10
children c6b79e535eb8
line wrap: on
line diff
--- a/console/libgnt/gnttree.c	Sun Dec 10 09:09:39 2006 +0000
+++ b/console/libgnt/gnttree.c	Sun Dec 10 09:26:44 2006 +0000
@@ -1005,6 +1005,8 @@
 			GntTreeRow *r = tree->root;
 			row->next = r;
 			if (r) r->prev = row;
+			if (tree->current == tree->root)
+				tree->current = row;
 			tree->root = row;
 			tree->list = g_list_prepend(tree->list, key);
 		}
@@ -1146,7 +1148,7 @@
 void gnt_tree_remove_all(GntTree *tree)
 {
 	tree->root = NULL;
-	g_hash_table_foreach_remove(tree->hash, (GHRFunc)return_true, NULL);
+	g_hash_table_foreach_remove(tree->hash, (GHRFunc)return_true, tree);
 	g_list_free(tree->list);
 	tree->list = NULL;
 	tree->current = tree->top = tree->bottom = NULL;
@@ -1394,3 +1396,10 @@
 	gnt_widget_set_size(GNT_WIDGET(tree), twidth, height);
 }
 
+void gnt_tree_set_hash_fns(GntTree *tree, gpointer hash, gpointer eq, gpointer kd)
+{
+	g_hash_table_foreach_remove(tree->hash, return_true, NULL);
+	g_hash_table_destroy(tree->hash);
+	tree->hash = g_hash_table_new_full(hash, eq, kd, free_tree_row);
+}
+