[evince/gnome-3-22] shell: Sort bookmarks by page number instead of title



commit 66bd0fcd16495bf490b4791ae21b9c30d79ea01c
Author: Felipe Borges <felipeborges gnome org>
Date:   Sat Oct 1 12:58:16 2016 +0200

    shell: Sort bookmarks by page number instead of title
    
    Bookmarks shouldn't be sorted by their titles but their page
    numbers. Often titles don't have any sorting text, causing
    strcmp to wrongly sort them alphanumerically, just like in the
    bug referenced below.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772277

 shell/ev-window.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index f64f37c..890bdd6 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -4603,7 +4603,11 @@ static gint
 compare_bookmarks (EvBookmark *a,
                   EvBookmark *b)
 {
-       return strcmp (a->title, b->title);
+       if (a->page < b->page)
+               return -1;
+       if (a->page > b->page)
+               return 1;
+       return 0;
 }
 
 static void


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