After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 782884 - Remove need to scroll in epubs
Remove need to scroll in epubs
Status: RESOLVED OBSOLETE
Product: gnome-documents
Classification: Core
Component: books
unspecified
Other All
: Normal enhancement
: ---
Assigned To: Daniel Garcia
GNOME documents maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-05-20 19:23 UTC by Daniel Garcia
Modified: 2018-12-06 16:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
epub: Remove need to scroll in epubs (1.13 KB, patch)
2018-01-12 23:17 UTC, Bastien Nocera
needs-work Details | Review

Description Daniel Garcia 2017-05-20 19:23:44 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
Comment 1 Bastien Nocera 2017-05-31 12:35:52 UTC
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;
Comment 2 Bastien Nocera 2017-05-31 13:05:07 UTC
Actually, that works now that I've fixed up libgepub's jhbuild declaration. It will need more work to support paging through chapters though.
Comment 3 Daniel Garcia 2017-05-31 16:13:41 UTC
(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() {
Comment 4 Bastien Nocera 2018-01-12 23:17:48 UTC
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.
Comment 5 Bastien Nocera 2018-01-12 23:32:47 UTC
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.
Comment 6 Bastien Nocera 2018-02-01 13:00:36 UTC
Review of attachment 366746 [details] [review]:

As per comment 5.