gspell and LaTeXila – progress report

In September I’ve launched two small fundraisings on gspell and LaTeXila. The two goals are now reached, thanks!

I’ve started working on those two projects, here is a progress report.

gspell – adding GtkEntry support

The basic infrastructure is there, and red wavy underlines are inserted to highlight misspelled words. The code is written in a way that it is unit-testable, and unit tests have been written.

Statistics so far:

21 files changed, 1921 insertions(+), 14 deletions(-)

Next steps:

  • The context menu (right-click menu).
  • Do not check the word currently typed.
  • Better word boundaries, to take into account apostrophes and dashes.

For all those next steps, the idea is to have common code between the GtkTextView and GtkEntry support.

LaTeXila – port to GAction/GMenu?

This progress report is a bit more technical.

To create the menu and toolbars, LaTeXila still uses the deprecated GtkUIManager and GtkAction. What I’ve done this week is investigation work, to figure out if it is possible to use GMenu (the new way menus are now usually created). GAction is great and will be used, but for GMenu it is more complicated.

The conclusion is that it will not be possible to use GMenu in LaTeXila. Because in LaTeXila, when hovering a menu item, a longer description is displayed in the status-bar – which makes the user interface self-discoverable – and this is not possible with GMenu (see this comment in bugzilla for more details). Thankfully GTK+ has a more basic way to create menus, with GtkMenuBar, GtkMenuItem etc. So that’s what LaTeXila will use.

Another reason to create a GtkMenuBar manually is to be able to add a sub-menu with the list of recently used files, with GtkRecentChooserMenu. This doesn’t exist as a GMenu, it would need to be implemented.

Also, the nice thing about GtkUIManager is that the information was encoded just once for both the menus and the toolbars. For a certain menu or toolbar item, the needed information is: the short description, the long description, the icon, the keyboard shortcut and the function to call when the action is activated. With GMenu, some of the information needs to be duplicated for creating a toolbar. So that’s another reason why not using GMenu (at least not directly).

So what I will do is to create a simplified GtkUIManager based on GAction. In other words, store the information just once, and have a convenient way to create menus and toolbars. To create a menu or toolbar item, all of what will be needed is to provide the action name; it will fetch the required missing information from a central store.

6 thoughts on “gspell and LaTeXila – progress report”

  1. The GMenu issues apply to Gnumeric too. Or rather, they would apply if we had plans of moving to GTK4 anytime soon. I don’t think we enjoy pain quite that much right now.

    Anyway, a simplified GtkUIManager sounds interesting for us too.

    1. Let’s see what I come up with. But I don’t plan to have an XML format to describe the menus and toolbars, those will need to be created with code (but with simple code). An XML format would be nice, but it is more work.

  2. Would it not be better to undeprecate GtkUIManager and fix it to use GAction ?

    Deprecating GtkUIManager is a major set back for us aswell. We use plugins and rely on GtkUIManagers ability to merge and unmerge menus and tollbars.

    1. The lower-level API to create menus and toolbars is still there. Merging/unmerging can be implemented on top. Or it can be implemented with GMenu too (an implementation exists in gedit).

      I’ll implement something much simpler than GtkUIManager. Enough features for LaTeXila, at least.

Leave a Reply

Your email address will not be published. Required fields are marked *