Back to GNOME development

After writing my last blog post – a retrospection about my first 10 years of Free Software development – it made me want to contribute to GNOME again. I didn’t contribute much this past year (in short, too much stress). But I’m back, I hope my keen interest will continue.

I’ve restarted with gedit. I’m improving the documentation for contributors, I’ve written a new roadmap, and done the 3.33.92 development release. Plus already a small yak shaving in jhbuild (doing the release) for the gedit contributors’ docs 🙂

10 Years Later

10 years ago, in 2009, when I was 19 years old, during the summer after my second year at the university, I started to develop a new Free/Libre desktop application for GNU/Linux for writing LaTeX documents, now called GNOME LaTeX, based on the GTK GUI toolkit.1)

I quickly realized that the plumbing for developing such an application was lacking. It required to re-invent the wheel, basically re-implementing the core of gedit (50k lines of code back then, without counting the plugins, to have a top-notch implementation). There was the GtkSourceView library – used by gedit – but it was far from sufficient. What I did for GNOME LaTeX is to have a much simpler implementation than the gedit core, leaving out some features and have a lower quality for the essential features.2)

That’s why 2-3 years later I got involved to improve GtkSourceView, and to kickstart a project to make the gedit source code more re-usable.

A decade later, all my GNOME projects

The result, including some side projects:

  • I’ve improved a lot GtkSourceView, receiving very good feedback from application developers.
  • I’ve created 3 other libraries: gspell, Tepl and Amtk.
  • I’ve created in total 3 GTK text editors: GNOME LaTeX, gCSVedit and Gnotepad.
  • I’ve contributed extensively to gedit, Devhelp and its libdevhelp.
  • I’ve contributed a little to GLib and GTK, including the addition of some small APIs.
  • I’ve started to write the book The GLib/GTK Development Platform – A Getting Started Guide, for the C language (70 pages currently).
  • And other yak shaving and side projects: gnome-c-utils, a brochure on GLib/GTK for the FOSDEM conference, and of course some contributions to other GNOME modules.
  • Andthen:
    • Error: not enough funding.
    • Too much stress, I needed to rest.

The gedit codebase has shrunk, but not as much as I would like. It stems from the fact that the gedit core provides an API for plugins, so either the API must remain intact, or when breaking the API the official plugins need to be adapted, and lots of third-party plugins would be unavailable during possibly a long time. So it complicates matter significantly when wanting to do big refactorings in the gedit core.


Just counting my GNOME or GNOME-related projects:

  • 6200 Git commits.
  • Author of ~140k lines of code, according to git blame in *.{c,h,vala,py} files (the vast majority being C library code).
  • Contributions in more than 30 GNOME Git repositories.
  • Some modules that I maintained or created are installed on millions of computers worldwide, thanks to being installed by default with GNOME.

A vision – Developing software product lines for GNOME

In short, my focus in GNOME is to make more code re-usable, especially in the field of text editors and other developer tools. The code is written as a set of object-oriented libraries. At most flexible at best.

It’s very similar to the “as a library” philosophy of the LLVM compiler infrastructure project:

“A corpus of functionality built as a set of libraries that can be sliced and remixed in different ways per the needs of different use-cases.” (Chris Lattner, original co-author of LLVM)

And it enables new possibilities: create software product lines! Instead of developing one application like gedit, the idea is to be able to develop a set of similar applications, each specialized for a different use-case. GNOME LaTeX is specialized for writing LaTeX documents, gCSVedit is specialized for CSV/TSV files, etc. There is still a need for a general-purpose text editor like gedit or Gnotepad, when a specialized text editor has not yet been developed.

A specialized application – by definition – has the potential to be better at its targeted task. Ideally, the application Just Works out-of-the-box, without the need to spend a lot of time to configure the application, finding plugins, etc.

This vision can be applied to many situations:

  • For text editors as previously explained.
  • I’ve almost finished to implement it for the Devhelp API browser, to be able to create specialized API browsers for specific development platforms.
  • For other desktop environments that prefer a traditional GUI instead of the more modern GNOME GUI for applications: from the same codebase (a library), create two applications, one with the old GUI and the other with the new GUI. This would permit to avoid forking the code or writing new applications from scratch.
  • For the desktop itself: create a software product line to be able to develop easily new desktops like gnome-shell.

Writing almost all the code as re-usable code is harder, but it is always possible: it is just software after all. And a well-designed library has a cleaner codebase and is easier to understand thanks to its API documentation.


  • 2019-08-23: Add section about the vision with software product lines and specialized applications. Remove less important paragraphs to not make the article too long.
  • 2019-08-25: Add more details and a second footnote to the introduction.

Footnotes   [ + ]

1. The idea to develop a desktop application – instead of some other kind of software – didn’t come out of thin air. In primary and secondary school I did web development, but I no longer wanted to play in that field. During the second year at the university, we needed to develop a desktop application in Java by groups of two, and I enjoyed doing that project. During the summer vacation, it made me want to develop my own desktop application, and since I liked GNOME 2, I wanted my app to be well integrated with GNOME, so I chose to develop it in C with GTK. And now, look where all of this has led me!
2. I didn’t want to fork gedit because it would have duplicated the maintenance, and as a total beginner back then I had difficulties to understand some of the gedit code, because I didn’t know well the GObject library.

Expanding Amtk to support GUIs with headerbar

I initially created the Amtk library to still be able to conveniently create a traditional UI without using deprecated GTK+ APIs, for GNOME LaTeX. But when working on Devhelp (which has a modern UI with a GtkHeaderBar) I noticed that some pieces of information were duplicated in order to create the menus and the GtkShortcutsWindow.

So I’ve expanded Amtk to support GUIs with GtkHeaderBar and GtkShortcutsWindow, and ported Devhelp to Amtk. I’m quite happy with the result, there are fewer lines of code, it avoids information duplication, all the extra information about the GActions are centralized (so inconsistencies are easier to catch), and on top of that Amtk has been designed to be able to share the extra GActions information in a library, so it’ll be possible to provide a higher-level API for the libdevhelp.

Read the Amtk introduction for more details.

PS: oh, and I’ve moved Amtk to its own git repository now, it was initially developed inside Tepl.

Devhelp news

Some news for your beloved API documentation browser, Devhelp!

I’ve written recently a roadmap for Devhelp and its library. It serves as a good summary of what has been achieved recently, with some future plans. Most of what I’ve done so far are under-the-hood changes, so it’s not directly visible in the application, except – hopefully – the better quality/stability (I’ve discovered and fixed a lot of bugs when doing refactorings).

For more context, I started to contribute to Devhelp in 2015 to fix some annoying bugs (it’s an application that I use almost every day). Then I got hooked, I contributed more, became a co-maintainer last year, etc. Devhelp is a nice little project, I would like it to be better known and used more outside of GNOME development, for example for the Linux kernel now that they have a good API documentation infrastructure (it’s just a matter of generating *.devhelp2 index files alongside the HTML pages).

GtkSourceView fundraising – November/December report

I’ve launched in September a fundraising for the GtkSourceView library. Here is a report for the past two months.

What has been achieved

I prefer to set expectations, I haven’t worked hard on GtkSourceView and Tepl this time around, because the fundraising is not as successful as I would like. Since I’m paid less than one hour per week for that project, I don’t feel forced to work > 10 times more, I think it’s understandable.

But I still continue to maintain GtkSourceView and Tepl, and I’ve progressed a little for the file loading and saving. The tasks that I’ve done in November/December:

  • Code reviews, especially for *.lang files (needed for syntax highlighting);
  • Triage incoming bugs on the bug tracker;
  • Doing releases;
  • Writing an Uncrustify configuration file to apply the GtkSourceView coding style, it will ease contributions;
  • Continue the high-level API for the file loading and saving in Tepl;
  • A few other development tasks in Tepl.

GtkSourceView fundraising – September/October report

I’ve launched two months ago a fundraising for the GtkSourceView library. I intend to write a report every two months, so that you can follow what’s going on in that project, and at the same occasion I can explain in more details some facets of the fundraising.

Only one maintainer (me)

For most of the code in GtkSourceView, there is basically only one remaining maintainer: myself. Tobias Schönberg helps to maintain and review some *.lang files (for the support of syntax highlighting), especially in the area of web development. But that’s it.

Here are the top 5 contributors, in terms of number of commits:

$ git shortlog -sn | head -5
1372 Sébastien Wilmet
531 Paolo Borelli
289 Ignacio Casal Quinteiro
200 Jesse van den Kieboom
149 Yevgen Muntyan

So you can see that I’m the first contributor. All the other developers also contributed during their free time, and they don’t have enough free time anymore (they have an unrelated full-time job, etc).

So in some way, the future of GtkSourceView rests in my hands.

File loading and saving

These past weeks my focus was on file loading and saving in Tepl (the incubator for GtkSourceView).

There are several layers for the file loading and saving:

  • The backend/toolkit part, i.e. the low-level API, it’s what I’ve added to GtkSourceView in 2014 but needs improvements.
  • The high-level API taking care of the frontend, part of the Tepl framework.
  • Some features that are built on top of the high-level API, for example an action to save all documents, or the auto-save to automatically save a document periodically.

For the first layer, the backend/toolkit part, Tepl provides two new things: file metadata (for example to save the cursor position) and a new file loader based on uchardet, to improve the character encoding auto-detection. This past month I’ve improved the new file loader, it is now in a good enough shape for most applications (but still lacks some features compared to the old file loader, so some work is still needed to be able to deprecate the old implementation).

For the second layer, I’ve started to create the high-level API. Creating the API is not the most difficult, the bulk of the work will be to improve what the implementation does internally (creating infobars, handling errors, etc).

The third layer has not yet started.

File loading and saving was not the only thing that I did these past two months, a lot of other smaller things have been done, for more details see the NEWS files:


Even if GtkSourceView already provides a lot of features, it is far from sufficient to create even a basic text editor (to have an implementation of a good quality). To give a concrete example, the core of gedit – if we remove all the plugins – is currently made of 40.000 lines of code! It’s a lot of work for a developer who wants to create a specialized text editor or a new IDE.

So my goal with GtkSourceView and Tepl is to make more code re-usable.

See the GtkSourceView fundraising on Liberapay. Thanks for your support!

List of GNOME-related projects fundraisers

I think it’s useful to have a list of projects fundraisers in GNOME or at least GNOME-related. Ideally it would be nice to have that list on the website, it looks to me an obvious thing to do, but after a discussion on the GNOME foundation-list, it seems unlikely to happen anytime soon.

So I’ve created this wiki page in the meantime. It also explains the difference with donations made to the GNOME Foundation.

The list includes the GtkSourceView fundraiser that I launched last month. I plan to write regular updates on that front on this blog, for example every two months. Stay tuned, and thanks for your support 🙂

GtkSourceView fundraising!

I’m launching a fundraising for GtkSourceView!

If you don’t know what GtkSourceView is, it’s a widely used library for text editors and IDEs (or text editing in general). For example on Debian, more than 50 applications rely on GtkSourceView, including gedit and GNOME Builder.

What less people know about is that GtkSourceView has been almost entirely developed by volunteer work, without being paid, except a few Google Summer of Code. So with the fundraising it’ll hopefully change, to bring the library to the next level!

Go to the fundraising on Liberapay for more information.


GObject design pattern: attached class extension

I wanted to share one recurrent API design that I’ve implemented several times and that I’ve found useful. I’ve coined it “attached class extension”. It is not a complete description like the design patterns documented in the Gang of Four book (I didn’t want to write 10 pages on the subject), it is more a draft. Also the most difficult is to come up with good names, so comments welcome 😉


Adding a GObject property or signal to an existing class, but modifying that class is not possible (because it is part of another module), and creating a subclass is not desirable.

Also Unknown As

“One-to-one class extension”, or simply “class extension”, or “extending class”, or “Siamese class”.


First example: in the gspell library, we would like to extend the GtkTextView class to add spell-checking. We need to create a boolean property to enable/disable the feature. Subclassing GtkTextView is not desirable because the GtkSourceView library already has a subclass (and it should be possible in an application to use both GtkSourceView and gspell at the same time ((Why not implementing spell-checking in GtkSourceView then? Because gspell also supports GtkEntry.)) ).

Before describing the “attached class extension” design pattern, another solution is described, to have some contrast and thus to better understand the design pattern.

Since subclassing is not desirable in our case, as always with Object-Oriented Programming: composition to the rescue! A possible solution is to create a direct subclass of GObject that takes by composition a GtkTextView reference (with a construct-only property). But this has a small disadvantage: the application needs to create and store an additional object. One example in the wild of such pattern is the GtkSourceSearchContext class which takes a GtkSourceBuffer reference to extend it with search capability. Note that there is a one-to-many relationship between GtkSourceBuffer and GtkSourceSearchContext, since it is possible to create several SearchContext instances for the same Buffer. And note that the application needs to store both the Buffer and the SearchContext objects. This pattern could be named “one-to-many class extension”, or “detached class extension”.

The solution with the “attached class extension” or “one-to-one class extension” design pattern also uses composition, but in the reverse direction: see the implementation of the gspell_text_view_get_from_gtk_text_view() function, it speaks for itself. It uses g_object_get_data() and g_object_set_data_full(), to store the GspellTextView object in the GtkTextView. So the GtkTextView object has a strong reference to the GspellTextView; when the GtkTextView is destroyed, so is the GspellTextView. The nice thing with this design pattern is that an application wanting to enable spell-checking doesn’t need to store any additional object, the application has normally already a reference to the GtkTextView, so, by extension, it has also access to the GspellTextView. With this implementation, GtkTextView can store only one GspellTextView, so it is a one-to-one relationship.

Other Examples

I’ve applied this design pattern several other times in gspell, Amtk and Tepl. To give a few other examples:

  • GspellEntry: adding spell-checking to GtkEntry. GspellEntry is not a subclass of GtkEntry because there is already GtkSearchEntry.
  • AmtkMenuShell that extends GtkMenuShell to add convenience signals. GtkMenuShell is the abstract class to derive the GtkMenu and GtkMenuBar subclasses. The convenience signals must work with any GtkMenuShell subclass.
  • AmtkApplicationWindow, an extension of GtkApplicationWindow to add a statusbar property. Subclassing GtkApplicationWindow in a library is not desirable, because several libraries might want to extend GtkApplicationWindow and an application needs to be able to use all those extensions at the same time (the same applies to GtkApplication).