[devhelp] BookTree: remove get_selected_book()



commit 74bb8af375d5141163222d3bba75adbd119afb49
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri May 18 15:10:29 2018 +0200

    BookTree: remove get_selected_book()
    
    It's now dead code. Not used in Anjuta nor gnome-builder.

 devhelp/dh-book-tree.c              |   47 -----------------------------------
 devhelp/dh-book-tree.h              |    2 -
 docs/reference/api-breaks.xml       |    8 +++++-
 docs/reference/devhelp-sections.txt |    1 -
 4 files changed, 7 insertions(+), 51 deletions(-)
---
diff --git a/devhelp/dh-book-tree.c b/devhelp/dh-book-tree.c
index aa161b3..9e6507c 100644
--- a/devhelp/dh-book-tree.c
+++ b/devhelp/dh-book-tree.c
@@ -1043,50 +1043,3 @@ dh_book_tree_select_uri (DhBookTree  *tree,
 out:
         gtk_tree_path_free (data.path);
 }
-
-/**
- * dh_book_tree_get_selected_book:
- * @tree: a #DhBookTree.
- *
- * Returns: (nullable) (transfer full): the #DhLink of type %DH_LINK_TYPE_BOOK
- * of the selected book, or %NULL if there is no selection. Unref with
- * dh_link_unref() when no longer needed.
- */
-DhLink *
-dh_book_tree_get_selected_book (DhBookTree *tree)
-{
-        GtkTreeSelection *selection;
-        GtkTreeModel *model;
-        GtkTreeIter iter;
-
-        g_return_val_if_fail (DH_IS_BOOK_TREE (tree), NULL);
-
-        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
-        if (!gtk_tree_selection_get_selected (selection, &model, &iter))
-                return NULL;
-
-        /* Depending on whether books are grouped by language, the book link can
-         * be at a different depth. And it's safer to check that the returned
-         * link has the good type. So walk up the tree to find the book.
-         */
-        while (TRUE) {
-                DhLink *link;
-                GtkTreeIter parent;
-
-                gtk_tree_model_get (model, &iter,
-                                    COL_LINK, &link,
-                                    -1);
-
-                if (dh_link_get_link_type (link) == DH_LINK_TYPE_BOOK)
-                        return link;
-
-                dh_link_unref (link);
-
-                if (!gtk_tree_model_iter_parent (model, &parent, &iter))
-                        break;
-
-                iter = parent;
-        }
-
-        g_return_val_if_reached (NULL);
-}
diff --git a/devhelp/dh-book-tree.h b/devhelp/dh-book-tree.h
index 2f494c2..d6f4c16 100644
--- a/devhelp/dh-book-tree.h
+++ b/devhelp/dh-book-tree.h
@@ -59,8 +59,6 @@ DhLink *        dh_book_tree_get_selected_link  (DhBookTree *tree);
 void            dh_book_tree_select_uri         (DhBookTree  *tree,
                                                  const gchar *uri);
 
-DhLink *        dh_book_tree_get_selected_book  (DhBookTree *tree);
-
 G_END_DECLS
 
 #endif /* DH_BOOK_TREE_H */
diff --git a/docs/reference/api-breaks.xml b/docs/reference/api-breaks.xml
index 718f535..72df6ac 100644
--- a/docs/reference/api-breaks.xml
+++ b/docs/reference/api-breaks.xml
@@ -67,6 +67,12 @@
           <link linkend="DhProfile">DhProfile</link>.
         </para>
       </listitem>
+      <listitem>
+        <para>
+          <code>dh_book_tree_get_selected_book()</code> has been replaced by
+          <link linkend="dh-book-tree-get-selected-link">dh_book_tree_get_selected_link()</link>.
+        </para>
+      </listitem>
     </itemizedlist>
   </refsect1>
 
@@ -182,7 +188,7 @@
       <listitem>
         <para>
           The ownership transfer of the return values of
-          <link linkend="dh-book-tree-get-selected-book">dh_book_tree_get_selected_book()</link>
+          <code>dh_book_tree_get_selected_book()</code>
           and <code>dh_sidebar_get_selected_book()</code>
           have been changed from (transfer none) to (transfer full).
         </para>
diff --git a/docs/reference/devhelp-sections.txt b/docs/reference/devhelp-sections.txt
index 97c47d1..6fd2662 100644
--- a/docs/reference/devhelp-sections.txt
+++ b/docs/reference/devhelp-sections.txt
@@ -128,7 +128,6 @@ dh_book_tree_new
 dh_book_tree_get_profile
 dh_book_tree_get_selected_link
 dh_book_tree_select_uri
-dh_book_tree_get_selected_book
 <SUBSECTION Standard>
 DhBookTreeClass
 DH_BOOK_TREE


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