[devhelp/wip/swilmet/various-code-improvements] book-tree: update selected_link in dh_book_tree_select_uri()



commit 3999b40e934b343bf7976c20634cc71ba1ae6b72
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Nov 11 16:04:30 2015 +0100

    book-tree: update selected_link in dh_book_tree_select_uri()
    
    The DhBookTree::link-selected signal was not emitted in certain cases
    because the selected_link was not always updated.
    
    The selected_link is still needed, it was added in
    commit effcc0fd9a693e91f63b20fef4b6777cd3b9dd1d.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755872

 src/dh-book-tree.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/dh-book-tree.c b/src/dh-book-tree.c
index ca41d58..f4bf3b0 100644
--- a/src/dh-book-tree.c
+++ b/src/dh-book-tree.c
@@ -783,6 +783,7 @@ dh_book_tree_select_uri (DhBookTree  *tree,
         DhBookTreePrivate   *priv = dh_book_tree_get_instance_private (tree);
         GtkTreeSelection *selection;
         FindURIData       data;
+        DhLink           *link;
 
         data.found = FALSE;
         data.uri = uri;
@@ -807,7 +808,14 @@ dh_book_tree_select_uri (DhBookTree  *tree,
                                          tree);
 
         gtk_tree_view_expand_to_path (GTK_TREE_VIEW (tree), data.path);
+
+        gtk_tree_model_get (GTK_TREE_MODEL (priv->store),
+                            &data.iter,
+                            COL_LINK, &link,
+                            -1);
+        priv->selected_link = link;
         gtk_tree_selection_select_iter (selection, &data.iter);
+
         gtk_tree_view_set_cursor (GTK_TREE_VIEW (tree), data.path, NULL, 0);
 
         g_signal_handlers_unblock_by_func (selection,


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