changeset 22170:364e67f1a429

Function to get the parent key.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 22 Jan 2008 07:28:11 +0000
parents 8c5d0180c326
children 2c9646c55369
files ChangeLog.API finch/libgnt/gnttree.c finch/libgnt/gnttree.h
diffstat 3 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Tue Jan 22 02:59:56 2008 +0000
+++ b/ChangeLog.API	Tue Jan 22 07:28:11 2008 +0000
@@ -70,6 +70,7 @@
 		  string.
 		* Added gnt_style_get_color to get a color pair from an entry in
 		  ~/.gntrc
+		* Added gnt_tree_get_parent_key to get the key for the parent row.
 
 version 2.3.0 (11/24/2007):
 	libpurple:
--- a/finch/libgnt/gnttree.c	Tue Jan 22 02:59:56 2008 +0000
+++ b/finch/libgnt/gnttree.c	Tue Jan 22 07:28:11 2008 +0000
@@ -1841,3 +1841,9 @@
 	tree->priv->search_func = func;
 }
 
+gpointer gnt_tree_get_parent_key(GntTree *tree, gpointer key)
+{
+	GntTreeRow *row = g_hash_table_lookup(tree->hash, key);
+	return row ? row->parent : NULL;
+}
+
--- a/finch/libgnt/gnttree.h	Tue Jan 22 02:59:56 2008 +0000
+++ b/finch/libgnt/gnttree.h	Tue Jan 22 07:28:11 2008 +0000
@@ -575,6 +575,17 @@
 void gnt_tree_set_search_function(GntTree *tree,
 		gboolean (*func)(GntTree *tree, gpointer key, const char *search, const char *current));
 
+/**
+ * Get the parent key for a row.
+ *
+ * @param  tree  The tree
+ * @param  key   The key for the row.
+ *
+ * @return The key of the parent row.
+ * @since 2.4.0
+ */
+gpointer gnt_tree_get_parent_key(GntTree *tree, gpointer key);
+
 G_END_DECLS
 
 #endif /* GNT_TREE_H */