During GUADEC 2021, various topics were presented quite interesting of which one that caught the attention of many it was a new tool that allows you to create user interfaces for Gnome, the name of this tool is Cambalache.
Swap is positioned as a new RAD tool that enables rapid front-end development for GTK 3, GTK 4 and the GNOME desktop environment, although its main focus is on the Gtk 4 library. Uses the MVC paradigm and the philosophy of the data model paradigm and that one of the most notable differences with Glade is the support for maintaining multiple user interfaces in a single project.
Its developer Juan Pablo Ugarte, mentions than the tool:
It started out as a proof-of-concept data model for Glade meant to test all the crazy ideas I've had for years about what a clean model should look like.
A few months later I had a pretty good data model that matched the GObject type system pretty well and didn't depend on GtkBuilder or GObject.
The developer mentions that with the model you can:
- Import and export multiple UIs at once
- Support simple functions (no custom tags) from GtkBuilder
- Packaging / Design Properties
- Undo / Redo stack
- Compression and grouping of history commands
As such Cambalache is totally independent from GtkBuilder and GObject, but it provides a data model that conforms to the GObject type system, that is why the data model can do what was mentioned above, import and export multiple interfaces at the same time, support objects, properties, etc.
In addition to this, provides the cambalache-db utility to generate the data model from gir files, and the db-codegen utility is provided to generate GObject classes from the data model tables.
To support multiple branches, the GTK training workspace is done with the help of the Broadway backend, allowing you to draw a conclusion from the GTK libraries in the web browser window.
The main Cambalache process is provided with a link to WebKit WebView, in which, using Broadway, the output of the Merengue process is transmitted, which is the name of the process that Cambalache uses that is directly involved to render the user interface while the user creates it, it is a normal Gtk 3 or Gtk application 4 depending on the version defined in the project.
Finally, for those interested in knowing more about it You can check the details of the project In the following link. While for those who are interested in being able to take a look at the Cambalache code, they can do so. from the link below. It is also important to mention that the project code is written in Python and is available under the GPLv2 license.
For those who are interested in being able to work with this tool, they should know that There are two ways to have it in your system, one of them is downloading the source code of Cambalache and with which it is not necessary to install the tool, while the other option and which I think is much more comfortable is with the help of Flatpak packages. It is also important to mention that it is worth mentioning that Python must be installed.
In the first case and that does not require installation is by downloading the source code of the tool. This we can do opening a terminal and in it we are going to type the following command:
git clone https://gitlab.gnome.org/jpu/cambalache.git
Now, in order to run the tool, just type:
Finally as for the other method is that it is with the help of Flatpak packages, We only have to have the support to be able to install this type of package in the system and all we have to do is open a terminal and run the following commands:
flatpak-builder --force-clean --repo=repo build ar.xjuan.Cambalache.json flatpak build-bundle repo cambalache.flatpak ar.xjuan.Cambalache flatpak install --user cambalache.flatpak