diff finch/libgnt/gnttree.c @ 21774:b63b2a5c2d05

merge of '282b4acb46729e4358221cb7cc78ad9373289199' and '3fe64d635336a6d7f6e520f4b2e041c3316c465d'
author Etan Reisner <pidgin@unreliablesource.net>
date Sat, 01 Dec 2007 03:41:37 +0000
parents 3ed9b027479d
children 364e67f1a429
line wrap: on
line diff
--- a/finch/libgnt/gnttree.c	Mon Nov 19 23:06:16 2007 +0000
+++ b/finch/libgnt/gnttree.c	Sat Dec 01 03:41:37 2007 +0000
@@ -75,6 +75,7 @@
 	                               If choice is true, then child will be NULL */
 	gboolean isselected;
 	GntTextFormatFlags flags;
+	int color;
 
 	GntTreeRow *parent;
 	GntTreeRow *child;
@@ -522,9 +523,14 @@
 		else
 		{
 			if (flags & GNT_TEXT_FLAG_DIM)
-				attr |= (A_DIM | gnt_color_pair(GNT_COLOR_DISABLED));
+				if (row->color)
+					attr |= (A_DIM | gnt_color_pair(row->color));
+				else
+					attr |= (A_DIM | gnt_color_pair(GNT_COLOR_DISABLED));
 			else if (flags & GNT_TEXT_FLAG_HIGHLIGHT)
 				attr |= (A_DIM | gnt_color_pair(GNT_COLOR_HIGHLIGHT));
+			else if (row->color)
+				attr |= gnt_color_pair(row->color);
 			else
 				attr |= gnt_color_pair(GNT_COLOR_NORMAL);
 		}
@@ -1559,6 +1565,16 @@
 	redraw_tree(tree);	/* XXX: It shouldn't be necessary to redraw the whole darned tree */
 }
 
+void gnt_tree_set_row_color(GntTree *tree, void *key, int color)
+{
+	GntTreeRow *row = g_hash_table_lookup(tree->hash, key);
+	if (!row || row->color == color)
+		return;
+
+	row->color = color;
+	redraw_tree(tree);
+}
+
 void gnt_tree_set_selected(GntTree *tree , void *key)
 {
 	int dist;