im.pidgin.pidgin: c7753033e7c91d45359e0532abb13afbcdda343e

sadrul at pidgin.im sadrul at pidgin.im
Wed Jan 23 16:53:08 EST 2008


-----------------------------------------------------------------
Revision: c7753033e7c91d45359e0532abb13afbcdda343e
Ancestor: 5576572ef769230a2d67d9a6cf4981618d61f352
Author: sadrul at pidgin.im
Date: 2008-01-23T21:45:43
Branch: im.pidgin.pidgin

Modified files:
        finch/libgnt/gnttree.c

ChangeLog: 

Allow customizing the expander in the tree. This is mostly a hack ;)

-------------- next part --------------
============================================================
--- finch/libgnt/gnttree.c	868dc1fc524b1e9fe9f1a4e935f704182cf1c1a4
+++ finch/libgnt/gnttree.c	6ebe1a054c38392d8ea8217c57d0ba606e12658a
@@ -39,6 +39,7 @@ enum
 {
 	PROP_0,
 	PROP_COLUMNS,
+	PROP_EXPANDER,
 };
 
 enum
@@ -59,6 +60,7 @@ struct _GntTreePriv
 
 	GCompareFunc compare;
 	int lastvisible;
+	int expander_level;
 };
 
 #define	TAB_SIZE 3
@@ -338,7 +340,7 @@ update_row_text(GntTree *tree, GntTreeRo
 						row->isselected ? 'X' : ' ');
 				fl = 4;
 			}
-			else if (row->parent == NULL && row->child)
+			else if (find_depth(row) < tree->priv->expander_level && row->child)
 			{
 				if (row->collapsed)
 				{
@@ -951,6 +953,11 @@ gnt_tree_set_property(GObject *obj, guin
 		case PROP_COLUMNS:
 			_gnt_tree_init_internals(tree, g_value_get_int(value));
 			break;
+		case PROP_EXPANDER:
+			if (tree->priv->expander_level == g_value_get_int(value))
+				break;
+			tree->priv->expander_level = g_value_get_int(value);
+			g_object_notify(obj, "expander-level");
 		default:
 			break;
 	}
@@ -965,6 +972,9 @@ gnt_tree_get_property(GObject *obj, guin
 		case PROP_COLUMNS:
 			g_value_set_int(value, tree->ncol);
 			break;
+		case PROP_EXPANDER:
+			g_value_set_int(value, tree->priv->expander_level);
+			break;
 		default:
 			break;
 	}
@@ -995,6 +1005,14 @@ gnt_tree_class_init(GntTreeClass *klass)
 				G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
 			)
 		);
+	g_object_class_install_property(gclass,
+			PROP_EXPANDER,
+			g_param_spec_int("expander-level", "Expander level",
+				"Number of levels to show expander in the tree.",
+				0, G_MAXINT, 1,
+				G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
+			)
+		);
 
 	signals[SIG_SELECTION_CHANGED] = 
 		g_signal_new("selection-changed",
@@ -1618,6 +1636,7 @@ GntWidget *gnt_tree_new_with_columns(int
 {
 	GntWidget *widget = g_object_new(GNT_TYPE_TREE,
 			"columns", col,
+			"expander-level", 1,
 			NULL);
 
 	return widget;


More information about the Commits mailing list