Mercurial > pidgin
changeset 22189:4165bcd57486
Allow customizing the expander in the tree. This is mostly a hack ;)
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 23 Jan 2008 21:45:43 +0000 |
parents | 68d0607ca490 |
children | bcaf4a037704 |
files | finch/libgnt/gnttree.c |
diffstat | 1 files changed, 20 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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;