Looking behind my back, a very interesting part is done. Let me tell you what I did during this period and what is coming.

After the basis have been set the real work has started. GNOME Books is going to be a “two level” application, as it is going to use two different levels and languages, C for the core functionality and JavaScript as managed runtime. To make a bridge between those two worlds the code has to be written using GObject convention.  The application can be divided in two parts:

  1. A library for handling interaction with the WebKit WebView, which could be called GNOME Books Library,
  2. GNOME JS application.

GNOME BOOKS LIBRARY

To expose a common API from a C library to GJS the code had to be “introspected”. GObject introspection is a middleware layer between C libraries (using GObject) and language bindings, in this case JavaScript. The C library is being scanned at compile time, followed by the generation of a metadata file. At runtime, language bindings are reading metadata and automatically providing bindings to call into the C library.

The C library is exposing “controller” object with the methods which are calling into the WebKit WebView. WebKit View is then calling JS functions to execute the method.

The most challenging aspect was building the whole thing. The best supported build system is the autotools aka the GNU build system, with autoconfautomake and libtool.

The structure of the project at this point can be seen below.

.
├── autogen.sh
├── configure.ac
├── COPYING
├── Makefile.am
├── src
│   ├── lib
│   │   ├── gb-webview.c
│   │   ├── gb-webview.h
│   │   ├── gb-resources.c
│   │   ├── gb-resources.xml
│   ├── Makefile-js.am
│   ├── Makefile-lib.am
│   ├── Makefile.am
│   ├── application.js
│   ├── mainWindow.js
│   ├── main.js
│   └── webView.js
└── README.md

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 book and present it in the window, with the WebKit WebView. Some extra functionality which is implemented is controlling the reading more.

GIT REPOSITORY

The repository of the GNOME Books application can be found on github [1].

GUADEC 2014

I am very glad to say that I’ll attend this years edition of GUADEC in Strasbourg, France. As a participant of Google Summer of Code I will give a short introduction of my application during the interns’ lightning talks session.

guadec-2014-badge-large

NEXT STEPS

  • Add more functionality in the library to navigate the book
  • Integrate Books application with the document discovery part that Documents partly does

[1] github repository of the GNOME Books application: https://github.com/martamilakovic/gnome-books/tree/master

Advertisements