[devhelp] book-tree: avoid expanding selected items



commit e7d4c19f506a4f0e3bc41686a96a3975fada09de
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Fri Feb 15 12:27:28 2013 +0100

    book-tree: avoid expanding selected items
    
    When moving through the treeview with the keyboard we were expanding the items
    as we moved. This was an artifact due to the webview notifying us back that we
    had to re-select a given path, and while doing that we would expand_to_path()
    which expands not only the parents but also the current item.
    
    So, just avoid re-selection and expansion if we're already selected there.
    
    Should fix https://bugzilla.gnome.org/show_bug.cgi?id=673320

 src/dh-book-tree.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/dh-book-tree.c b/src/dh-book-tree.c
index 7258a3c..991699c 100644
--- a/src/dh-book-tree.c
+++ b/src/dh-book-tree.c
@@ -749,6 +749,11 @@ dh_book_tree_select_uri (DhBookTree  *tree,
 
        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
 
+        /* Do not re-select (which will expand current additionally) if already
+         * there. */
+        if (gtk_tree_selection_iter_is_selected (selection, &data.iter))
+                return;
+
        g_signal_handlers_block_by_func (selection,
                                         book_tree_selection_changed_cb,
                                         tree);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]