GNOME Bugzilla – Bug 782884
Remove need to scroll in epubs
Last modified: 2018-12-06 16:36:25 UTC
The pagination is implemented now in libgepub so we can try to add pagination to gnome-books. libgepub pagination bug: https://bugzilla.gnome.org/show_bug.cgi?id=768002
I would expect this to be enough to make pagination work, but it doesn't do anything: diff --git a/src/epubview.js b/src/epubview.js index 28a0023..8978ad4 100644 --- a/src/epubview.js +++ b/src/epubview.js @@ -69,6 +69,7 @@ const EPUBView = new Lang.Class({ createView: function() { let view = new Gepub.Widget(); + view.paginate = true; let fc = view.get_find_controller(); fc.connect('found-text', Lang.bind(this, function(view, matchCount, data) { let hasResults = matchCount > 0;
Actually, that works now that I've fixed up libgepub's jhbuild declaration. It will need more work to support paging through chapters though.
(In reply to Bastien Nocera from comment #2) > Actually, that works now that I've fixed up libgepub's jhbuild declaration. > It will need more work to support paging through chapters though. It's needed to change the goNext and goPrev functions in epubpreview.js to use the gepub_widget_page_next and gepub_widget_page_prev instead of changing the page in the epubdoc. We need something like: diff --git a/src/epubview.js b/src/epubview.js index 28a0023..a76565e 100644 --- a/src/epubview.js +++ b/src/epubview.js @@ -69,6 +69,7 @@ const EPUBView = new Lang.Class({ createView: function() { let view = new Gepub.Widget(); + view.paginate = true; let fc = view.get_find_controller(); fc.connect('found-text', Lang.bind(this, function(view, matchCount, data) { let hasResults = matchCount > 0; @@ -137,11 +138,11 @@ const EPUBView = new Lang.Class({ }, goPrev: function() { - this._epubdoc.go_prev(); + this.view.page_prev(); }, goNext: function() { - this._epubdoc.go_next(); + this.view.page_next(); }, get hasPages() {
Created attachment 366746 [details] [review] epub: Remove need to scroll in epubs Remove need to scroll in ePub files by using the pagination support in libgepub.
This doesn't work quite as well as it should, as the slider only scrolls between chapters instead of pages, so it doesn't move when changing pages within the same chapter, and will only ever scroll to the first page of each chapter.
Review of attachment 366746 [details] [review]: As per comment 5.
Moved to: https://gitlab.gnome.org/GNOME/gnome-documents/merge_requests/11 and: https://gitlab.gnome.org/GNOME/gnome-documents/issues/28