-
Notifications
You must be signed in to change notification settings - Fork 44
How to migrate to GTK 4
We present here some advices and resources that will be helpful if you need to migrate a gtk-3-fortran application toward gtk-4-fortran. Note that you can install both the GTK 3 and 4 versions of gtk-fortran on your machine: the pkg-config names are gtk-3-fortran
and gtk-4-fortran
.
GTK 4 is a major version, released in December 2020, ten years after GTK 3. Some APIs disappeared and were replaced, some were reorganized, the name or arguments of some functions changed, new APIs appeared... Depending on the complexity of your application, on the APIs used, migrating to GTK 4 can be more or less difficult.
- First read the official GTK document Migrating from GTK 3.x to GTK 4. The advices are divided in two parts:
- what you should change in your GTK 3 app before migrating to be ready,
- what you must do at the time of the switch.
- You can look at the differences in the project examples between the gtk3 and gtk4 branches with
git diff
, for example:
$ git diff gtk3 gtk4 -- gtkhello.f90
-
And search in the GTK 4 closed issues in the Issues tab. You will find most of the problems we had to solve to migrate the whole project to GTK 4.
-
The GTK 3 & 4 documentation being hosted on the same site https://docs.gtk.org/, you can easily compare the GTK 3 and GTK 4 versions of an API by changing the 3 to a 4 in the URL. For example:
-
You will find links concerning GTK 4 in our Tutorials and GTK resources pages.
- Installation
- My first gtk-fortran application
- Drawing an image in a PNG file (without GUI)
- A program also usable without GUI
- Using Glade3 and gtkf-sketcher (GTK 3)
- Using gtk-fortran as a fpm dependency
- Debugging with GtkInspector
- Learning from examples
- Video tutorials
- How to start my own project from a gtk-fortran example
- git basics
- CMake basics
- Alternatives to CMake
- How to migrate to GTK 4
- How to contribute to gtk-fortran
- How to hack the cfwrapper