… but my involvement in GNOME has just started!

Google Summer of Code was an incredible experience, and I would like to give special thanks to Google for the sponsorship. This was a great opportunity to finally get involved in the FOSS world, and to start contributing to GNOME. My mentor, Cosimo Cecchi was a great support, helper, and teacher, so thank you Cosimo for your time, patience and knowledge transfer.

Project description

As a reminder, my project for GNOME is to develop an application for reading eBooks, titled ‘GNOME Books’. The main focus during this phase of Books development was to get the most of the functionality in the Read Mode. The first format which was chosen to support was EPUB, as it is a very popular standard among eBooks. The core application code itself is designed to have a formal separation of backend and frontend logic. The backend, so called GNOME Books Library is focused on providing the core object model & operation, and the interaction with the external libraries like epub.js. The frontend, or GJS Books Application builds on this backend, to produce a GTK based user interface.

Architecture

For the easier understanding of the following text the image below is showing the main components of the GNOME Books Application with the libraries.

Books Diagram
Application structure

Implementation details

GNOME BOOKS LIBRARY

EPUB is based on familiar technologies like XML, CSS, and XHTML. It is well known that browsers have built in mechanism for parsing (HTML, XML, CSS, JavaScript), text and graphics rendering, image decoding, etc. Those are the reasons for the Books Read Mode to use WebKit WebView to present the EPUB contents. Rendering EPUB documents is done with the JavaScript library, epub.js [1], which is included in the project as a sub-module. Books Library main purpose is to handle the interaction between epub.js and WebKit JS, while exposing the common API. Besides that it implements the functionality for the URI scheme, navigation control, linking, event handling, etc.

INTROSPECTION

Application Books is using the latest GNOME 3.0 technologies, so it is written in a very special JavaScript binding for GNOME, so called GJS. GObject introspection is used as a convenient bridge between the two worlds, C and JavaScript.

GJS BOOKS APPLICATION

GJS Books application is based on GtkApplication class which handles aspects of GTK+ application. It exports actions and menus, and manages a list of toplevel windows whose life-cycle is automatically tied to the life-cycle of the application.

By using introspected library application can load and render the eBook and present it in the window, with the WebKit WebView. Some extra functionality which is implemented is controlling the Read Mode.

BUILD SYSTEM

It was difficult to build the application ‘manually’ as it’s complexity reached a certain size. At that point I started learning about an awesome build system, autotools aka the GNU build system. After producing autotools and getting the project build it was much easier to continue the development.

Screenshots

GNOME_Books

Application’s state

You can get the code from the git repository [2]. Open the README file and follow the instructions.

There is an example eBook which is going to be loaded by clicking Load Book button. When the mouse is moved navigation controls will show up, and allow you to change the pages. You can also jump to other chapters by clicking Contents button in the navigation bar. This is the temporary look of the application. Later on, the buttons in the top panel are going to be removed, and displaced.

The development is still in the progress, so there is many new features coming up soon.

Future plans

End of the Google Summer of Code does not mean the end of the project. There is many more ideas left to realize. Below is the list of the next steps:

  • Solution to the asynchronous bug for the interaction between the WebKit JS and the Promise RSVP library used by ePub.js
  • Overview mode and integration with GNOME Documents
  • GNOME Books integration with an existing store
  • GNOME Books design

Very interesting parts of the GNOME Books development are in front of us. I will continue updating You about new features and hopefully, very soon, we are going to have a new application in GNOME.

“Grain by grain – a loaf; stone by stone – a palace.”
– George Bernard Shaw

[1] epub.js: https://github.com/futurepress/epub.js/
[2] Git repository: https://github.com/martamilakovic/gnome-books

Advertisements