qulogic/libgnt

db430da8059b
Parents 88d799ecf9d6
Children 1b25168abe7f
Allow customizing the expander in the tree. This is mostly a hack ;)
  • +20 -1
    gnttree.c
  • --- a/gnttree.c Wed Jan 23 00:54:25 2008 +0000
    +++ b/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;