[devhelp] DhLink: improve dh_link_type_compare()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp] DhLink: improve dh_link_type_compare()
- Date: Thu, 7 Dec 2017 16:04:57 +0000 (UTC)
commit c4ad058236480afe759fd1f262669f7af4367cd4
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Dec 7 17:01:15 2017 +0100
DhLink: improve dh_link_type_compare()
src/dh-link.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/dh-link.c b/src/dh-link.c
index f1dadb3..493c160 100644
--- a/src/dh-link.c
+++ b/src/dh-link.c
@@ -439,12 +439,17 @@ dh_link_type_compare (DhLinkType a,
if (a == b)
return 0;
- /* Sort page links before other links. The page is more important than a
- * symbol (typically contained in that page).
+ /* Same order as in a tree: first the top-level book node, then pages,
+ * then keywords (keywords are contained in a page).
*/
- if (a == DH_LINK_TYPE_PAGE)
+
+ if (a == DH_LINK_TYPE_BOOK)
return -1;
+ if (b == DH_LINK_TYPE_BOOK)
+ return 1;
+ if (a == DH_LINK_TYPE_PAGE)
+ return -1;
if (b == DH_LINK_TYPE_PAGE)
return 1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]