|
|
8b7974 |
diff --git a/src/dh-book-tree.c b/src/dh-book-tree.c
|
|
|
8b7974 |
index e97fe283..7d8f2395 100644
|
|
|
8b7974 |
--- a/src/dh-book-tree.c
|
|
|
8b7974 |
+++ b/src/dh-book-tree.c
|
|
|
8b7974 |
@@ -177,7 +177,7 @@ book_tree_find_language_group (DhBookTree *tree,
|
|
|
8b7974 |
g_return_if_reached ();
|
|
|
8b7974 |
}
|
|
|
8b7974 |
|
|
|
8b7974 |
- if (exact_iter != NULL &&
|
|
|
8b7974 |
+ if (exact_iter != NULL && exact_found &&
|
|
|
8b7974 |
g_ascii_strcasecmp (title, language) == 0) {
|
|
|
8b7974 |
/* Exact match found! */
|
|
|
8b7974 |
*exact_iter = loop_iter;
|
|
|
8b7974 |
@@ -187,7 +187,7 @@ book_tree_find_language_group (DhBookTree *tree,
|
|
|
8b7974 |
g_free (title);
|
|
|
8b7974 |
return;
|
|
|
8b7974 |
}
|
|
|
8b7974 |
- } else if (next_iter != NULL &&
|
|
|
8b7974 |
+ } else if (next_iter != NULL && next_found &&
|
|
|
8b7974 |
g_ascii_strcasecmp (title, language) > 0) {
|
|
|
8b7974 |
*next_iter = loop_iter;
|
|
|
8b7974 |
*next_found = TRUE;
|
|
|
8b7974 |
@@ -252,7 +252,7 @@ book_tree_find_book (DhBookTree *tree,
|
|
|
8b7974 |
|
|
|
8b7974 |
/* We can compare pointers directly as we're playing with references
|
|
|
8b7974 |
* of the same object */
|
|
|
8b7974 |
- if (exact_iter != NULL &&
|
|
|
8b7974 |
+ if (exact_iter != NULL && exact_found &&
|
|
|
8b7974 |
in_tree_book == book) {
|
|
|
8b7974 |
*exact_iter = loop_iter;
|
|
|
8b7974 |
*exact_found = TRUE;
|
|
|
8b7974 |
diff --git a/src/dh-keyword-model.c b/src/dh-keyword-model.c
|
|
|
8b7974 |
index a0b716f4..6a7fc50d 100644
|
|
|
8b7974 |
--- a/src/dh-keyword-model.c
|
|
|
8b7974 |
+++ b/src/dh-keyword-model.c
|
|
|
8b7974 |
@@ -442,6 +442,14 @@ search_single_book (DhBook *book,
|
|
|
8b7974 |
return ret;
|
|
|
8b7974 |
}
|
|
|
8b7974 |
|
|
|
8b7974 |
+static gint
|
|
|
8b7974 |
+compare_links (gconstpointer a,
|
|
|
8b7974 |
+ gconstpointer b,
|
|
|
8b7974 |
+ gpointer user_data)
|
|
|
8b7974 |
+{
|
|
|
8b7974 |
+ return dh_link_compare (a, b);
|
|
|
8b7974 |
+}
|
|
|
8b7974 |
+
|
|
|
8b7974 |
static GQueue *
|
|
|
8b7974 |
search_books (SearchSettings *settings,
|
|
|
8b7974 |
guint max_hits,
|
|
|
8b7974 |
@@ -486,7 +494,7 @@ search_books (SearchSettings *settings,
|
|
|
8b7974 |
dh_util_queue_concat (ret, book_result);
|
|
|
8b7974 |
}
|
|
|
8b7974 |
|
|
|
8b7974 |
- g_queue_sort (ret, (GCompareDataFunc) dh_link_compare, NULL);
|
|
|
8b7974 |
+ g_queue_sort (ret, (GCompareDataFunc) compare_links, NULL);
|
|
|
8b7974 |
return ret;
|
|
|
8b7974 |
}
|
|
|
8b7974 |
|
|
|
8b7974 |
diff --git a/src/dh-preferences.c b/src/dh-preferences.c
|
|
|
8b7974 |
index 0568c505..ffae33b3 100644
|
|
|
8b7974 |
--- a/src/dh-preferences.c
|
|
|
8b7974 |
+++ b/src/dh-preferences.c
|
|
|
8b7974 |
@@ -143,7 +143,7 @@ preferences_bookshelf_find_book (DhPreferences *prefs,
|
|
|
8b7974 |
-1);
|
|
|
8b7974 |
|
|
|
8b7974 |
/* We may have reached the start of the next language group here */
|
|
|
8b7974 |
- if (first && !in_list_book) {
|
|
|
8b7974 |
+ if (exact_found && first && !in_list_book) {
|
|
|
8b7974 |
*next_iter = loop_iter;
|
|
|
8b7974 |
*next_found = TRUE;
|
|
|
8b7974 |
return;
|
|
|
8b7974 |
@@ -151,7 +151,7 @@ preferences_bookshelf_find_book (DhPreferences *prefs,
|
|
|
8b7974 |
|
|
|
8b7974 |
/* We can compare pointers directly as we're playing with references
|
|
|
8b7974 |
* of the same object */
|
|
|
8b7974 |
- if (exact_iter &&
|
|
|
8b7974 |
+ if (exact_iter && exact_found &&
|
|
|
8b7974 |
in_list_book == book) {
|
|
|
8b7974 |
*exact_iter = loop_iter;
|
|
|
8b7974 |
*exact_found = TRUE;
|
|
|
8b7974 |
@@ -160,7 +160,7 @@ preferences_bookshelf_find_book (DhPreferences *prefs,
|
|
|
8b7974 |
g_object_unref (in_list_book);
|
|
|
8b7974 |
return;
|
|
|
8b7974 |
}
|
|
|
8b7974 |
- } else if (next_iter &&
|
|
|
8b7974 |
+ } else if (next_iter && next_found &&
|
|
|
8b7974 |
dh_book_cmp_by_title (in_list_book, book) > 0) {
|
|
|
8b7974 |
*next_iter = loop_iter;
|
|
|
8b7974 |
*next_found = TRUE;
|
|
|
8b7974 |
@@ -223,7 +223,7 @@ preferences_bookshelf_find_language_group (DhPreferences *prefs,
|
|
|
8b7974 |
continue;
|
|
|
8b7974 |
}
|
|
|
8b7974 |
|
|
|
8b7974 |
- if (exact_iter &&
|
|
|
8b7974 |
+ if (exact_iter && exact_found &&
|
|
|
8b7974 |
g_ascii_strcasecmp (title, language) == 0) {
|
|
|
8b7974 |
/* Exact match found! */
|
|
|
8b7974 |
*exact_iter = loop_iter;
|
|
|
8b7974 |
@@ -233,7 +233,7 @@ preferences_bookshelf_find_language_group (DhPreferences *prefs,
|
|
|
8b7974 |
g_free (title);
|
|
|
8b7974 |
return;
|
|
|
8b7974 |
}
|
|
|
8b7974 |
- } else if (next_iter &&
|
|
|
8b7974 |
+ } else if (next_iter && next_found &&
|
|
|
8b7974 |
g_ascii_strcasecmp (title, language) > 0) {
|
|
|
8b7974 |
*next_iter = loop_iter;
|
|
|
8b7974 |
*next_found = TRUE;
|