# HG changeset patch # User Sadrul Habib Chowdhury # Date 1201124743 0 # Node ID 4165bcd57486a5b60b493ee1d79f5520158ac484 # Parent 68d0607ca490fdec79302472920fa969fc3f172b Allow customizing the expander in the tree. This is mostly a hack ;) diff -r 68d0607ca490 -r 4165bcd57486 finch/libgnt/gnttree.c --- a/finch/libgnt/gnttree.c Wed Jan 23 18:25:45 2008 +0000 +++ b/finch/libgnt/gnttree.c Wed Jan 23 21:45:43 2008 +0000 @@ -39,6 +39,7 @@ { PROP_0, PROP_COLUMNS, + PROP_EXPANDER, }; enum @@ -59,6 +60,7 @@ GCompareFunc compare; int lastvisible; + int expander_level; }; #define TAB_SIZE 3 @@ -338,7 +340,7 @@ 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 @@ 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 @@ 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 @@ 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 *widget = g_object_new(GNT_TYPE_TREE, "columns", col, + "expander-level", 1, NULL); return widget;