Development/Integrating LOKDocView and GNOME Documents

LOKDocView is the GTK3 widget that wraps the libreoffice functionality and exposes a simple API for applications to use this widget. This page mainly focuses on its integration with GNOME Documents.

GNOME Documents is written in javascript. LOKDocView is written in C++. Fortunately, LOKDocView is a GObject class which means we can make use of GObject Introspection to use this widget from not only javascript but any other bindings that gobject-introspection allows. To access this introspectable widget from language bindings like javascript, we need two files : .gir and .typelib file. You can generate these files manually using these tools - g-ir-scanner and g-ir-compiler.

To generate .gir file :

To generate .typelib file :

The current plan is to generate these files in create_tree.sh which distributions have to invoke manually. The patch will get merged to master very soon.

GNOME Documents
To test this widget with gnome-documents, it is required that the .gir, .typelib and libreofficekitgtk.so are in their correct positions. The ideal position for these files : .gir in : /usr/share/gir-1.0 .typelib in : $libdir/girepository-1.0/

Also make sure that libreofficekitgtk.so is in $libdir. You need to symlink the newly generated libreofficekitgtk.so to your $libdir so that gnome-documents could find it.

To start building gnome-documents the easiest way, jhbuild is the recommended tool.

It is recommended that you install the latest jhbuild from master. This should be helpful for doing this. After that you need to make sure that all the prerequisites are present. You can do so via :

If not, install as directed by this sanity check. After the pre-requisites, you are ready to start building gnome-documents. We don't need to build the whole GNOME stack. Following command would automatically build dependencies recursively for g-d :

It will automatically clone the repos recursively for you, and build them.

After the build
After the build finishes, you need to switch to the branch for LOKDocVIew integration (wip/pranavk/lokdocview). Build again but this time with a slightly different command because you don't want jhbuild to check all the dependencies again.

'buildone' means 'just build this module and ignore dependencies' '-n' means don't update the repo from internet

To run gnome-documents you simply do :

Alternatively, you can also jump to jhbuild env first, and then invoke g-d manually.

LOK_DEBUG=1 G_MESSAGES_DEBUG=all $prefix/bin/gnome-documents