comparison finch/libgnt/gnttree.c @ 26509:28795b39d745

- Don't bother changing/signalling the selected row from NULL to NULL - Ensure the selected row is a visible row when searching the tree.
author Richard Nelson <wabz@pidgin.im>
date Wed, 08 Apr 2009 12:35:09 +0000
parents 8df78c06d10e
children f769367cccd0
comparison
equal deleted inserted replaced
26508:bf5b74b2a483 26509:28795b39d745
430 else 430 else
431 pos = 1; 431 pos = 1;
432 432
433 if (tree->top == NULL) 433 if (tree->top == NULL)
434 tree->top = tree->root; 434 tree->top = tree->root;
435 if (tree->current == NULL) { 435 if (tree->current == NULL && tree->root != NULL) {
436 tree->current = tree->root; 436 tree->current = tree->root;
437 tree_selection_changed(tree, NULL, tree->current); 437 tree_selection_changed(tree, NULL, tree->current);
438 } 438 }
439 439
440 wbkgd(widget->window, gnt_color_pair(GNT_COLOR_NORMAL)); 440 wbkgd(widget->window, gnt_color_pair(GNT_COLOR_NORMAL));
489 489
490 if (tree->top && !row_matches_search(tree->top)) 490 if (tree->top && !row_matches_search(tree->top))
491 tree->top = get_next(tree->top); 491 tree->top = get_next(tree->top);
492 row = tree->top; 492 row = tree->top;
493 scrcol = widget->priv.width - 1 - 2 * pos; /* exclude the borders and the scrollbar */ 493 scrcol = widget->priv.width - 1 - 2 * pos; /* exclude the borders and the scrollbar */
494
495 if (tree->current && !row_matches_search(tree->current)) {
496 GntTreeRow *old = tree->current;
497 tree->current = tree->top;
498 tree_selection_changed(tree, old, tree->current);
499 }
500
494 for (i = start + pos; row && i < widget->priv.height - pos; 501 for (i = start + pos; row && i < widget->priv.height - pos;
495 i++, row = get_next(row)) 502 i++, row = get_next(row))
496 { 503 {
497 char *str; 504 char *str;
498 int wr; 505 int wr;