qulogic/libgnt

Parents 6c8a01831a89
Children f5b2dc404958
- Don't bother changing/signalling the selected row from NULL to NULL
- Ensure the selected row is a visible row when searching the tree.
  • +8 -1
    gnttree.c
  • --- a/gnttree.c Mon Apr 06 10:30:25 2009 +0000
    +++ b/gnttree.c Wed Apr 08 12:35:09 2009 +0000
    @@ -432,7 +432,7 @@
    if (tree->top == NULL)
    tree->top = tree->root;
    - if (tree->current == NULL) {
    + if (tree->current == NULL && tree->root != NULL) {
    tree->current = tree->root;
    tree_selection_changed(tree, NULL, tree->current);
    }
    @@ -491,6 +491,13 @@
    tree->top = get_next(tree->top);
    row = tree->top;
    scrcol = widget->priv.width - 1 - 2 * pos; /* exclude the borders and the scrollbar */
    +
    + if (tree->current && !row_matches_search(tree->current)) {
    + GntTreeRow *old = tree->current;
    + tree->current = tree->top;
    + tree_selection_changed(tree, old, tree->current);
    + }
    +
    for (i = start + pos; row && i < widget->priv.height - pos;
    i++, row = get_next(row))
    {